正在查看: 爱心e站 v1.0.0 应用的 AssistiveDeviceSendConfirm.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 爱心e站 v1.0.0 应用的 AssistiveDeviceSendConfirm.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.newheyd.JZKFcanjiren.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.igexin.assist.sdk.AssistPushConsts;
import com.newheyd.JZKFcanjiren.Adapter.PickerPhotoAdapter;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.Bean.AssistiveConfirmBean;
import com.newheyd.JZKFcanjiren.Bean.AvatarBean;
import com.newheyd.JZKFcanjiren.Bean.UserInfo;
import com.newheyd.JZKFcanjiren.LargerPhoto.ShowLargerPhotoActivity;
import com.newheyd.JZKFcanjiren.MyApplication;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.Utils.DataUtil;
import com.newheyd.JZKFcanjiren.Utils.ImageUtil;
import com.newheyd.JZKFcanjiren.Utils.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.ToastUtils;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
import com.newheyd.JZKFcanjiren.View.DateTimePickDialogPlus;
import com.newheyd.JZKFcanjiren.View.PhotoSelect.PhotoPickerActivity;
import com.newheyd.JZKFcanjiren.View.PhotoSelect.entity.Photo;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.config.NewHYConfig;
import com.newheyd.JZKFcanjiren.model.BaseResult;
import com.newheyd.JZKFcanjiren.model.DataParser;
import com.newheyd.JZKFcanjiren.net.AttachUploadTask;
import com.newheyd.JZKFcanjiren.net.CommonDataListTask;
import com.newheyd.JZKFcanjiren.net.CommonTask;
import com.newheyd.JZKFcanjiren.net.NewHYTask;
import com.newheyd.JZKFcanjiren.net.RequestServiceList;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class AssistiveDeviceSendConfirm extends BaseActivity implements View.OnClickListener, PickerPhotoAdapter.OnAttachMentListener {
public static final int CONFIRM_REQUEST = 1000;
public static final String STYLE = "fzqjConfirm";
private String confirmDate;
private String confirmMemo;
private String confirmName;
private String fujuApplyType;
private String id;
private EditText mEtAdvice;
private EditText mEtName;
private Button mHandBtn;
private RecyclerView mRecycleMetarial;
private TitleView mTitleview;
private TextView mTvConfirmTime;
private AssistiveConfirmBean assistiveConfirmBean = null;
private DateTimePickDialogPlus dateTimePicKDialog = null;
private PickerPhotoAdapter pickerPhotoMetarialAdapter = null;
private ArrayList<Photo> photosMetarial = new ArrayList<>();
private Photo uploadPhoto = null;
private Photo deleteInfo = null;
private CompressAnyscTask compressAnyscTask = null;
private List<String> newPaths = null;
private ArrayList<String> resultPhotoUris = null;
private UserInfo userInfo = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_assistive_device_send_confirm);
super.onCreate(savedInstanceState);
this.userInfo = MyApplication.getInstance().getUserInfo();
freshDisablePersonPhotoData();
getAuxiliaryPerConfirm();
goStatistics();
}
public void goStatistics() {
HashMap<String, String> map = LocationAddrUtil.getInstance().getLocationParam(this.mContext);
StastisticUtil.getInstance().onEvent(this.mContext, "AssistiveDeviceSendConfirm", map);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == -1) {
switch (requestCode) {
case 1000:
this.resultPhotoUris = data.getStringArrayListExtra(PhotoPickerActivity.SELECT_RESULTS_ARRAY);
if (this.compressAnyscTask != null && this.compressAnyscTask.getStatus() == AsyncTask.Status.RUNNING) {
this.compressAnyscTask.cancel(true);
this.compressAnyscTask = null;
}
this.compressAnyscTask = new CompressAnyscTask();
this.compressAnyscTask.execute(this.resultPhotoUris);
break;
}
}
}
@Override
public void attachmentDel(Photo info) {
}
@Override
public void onPhotoClickListener(int position, Photo info) {
Intent intent = new Intent(this.mContext, (Class<?>) ShowLargerPhotoActivity.class);
ArrayList<AvatarBean> bigPhotoList = new ArrayList<>();
ArrayList<Photo> photos = this.photosMetarial;
Iterator<Photo> it = photos.iterator();
while (it.hasNext()) {
Photo photo = it.next();
AvatarBean avatarBean = new AvatarBean(photo.getUri());
bigPhotoList.add(avatarBean);
}
intent.putExtra("photos", bigPhotoList);
intent.putExtra("position", position);
startActivity(intent);
}
class CompressAnyscTask extends AsyncTask<ArrayList<String>, List<String>, List<String>> {
CompressAnyscTask() {
}
@Override
protected void onPreExecute() {
AssistiveDeviceSendConfirm.this.showProgress("图片压缩中", false);
}
@Override
public List<String> doInBackground(ArrayList<String>... params) {
List<String> newPaths = ImageUtil.compressImage(AssistiveDeviceSendConfirm.this.mContext, params[0], AssistiveDeviceSendConfirm.STYLE);
return newPaths;
}
@Override
public void onPostExecute(List<String> result) {
if (result != null && result.size() != 0) {
AssistiveDeviceSendConfirm.this.newPaths = result;
AssistiveDeviceSendConfirm.this.cancleProgress();
AssistiveDeviceSendConfirm.this.dealPhoto();
}
}
}
public void dealPhoto() {
ArrayList<Photo> photos = this.photosMetarial;
if (photos == null) {
photos = new ArrayList<>();
}
int i = 0;
while (i < photos.size()) {
if (TextUtils.isEmpty(photos.get(i).getId())) {
photos.remove(photos.get(i));
i--;
}
i++;
}
for (int i2 = 0; i2 < this.newPaths.size(); i2++) {
photos.add(new Photo(this.newPaths.get(i2)));
}
freshDisablePersonPhotoData();
}
public void freshDisablePersonPhotoData() {
if (this.photosMetarial != null && this.deleteInfo != null) {
Iterator<Photo> it = this.photosMetarial.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Photo p = it.next();
if (!isNull(p.getUri()) && p.getUri().equals(this.deleteInfo.getUri())) {
this.photosMetarial.remove(p);
break;
}
}
}
Iterator<Photo> it2 = this.photosMetarial.iterator();
while (it2.hasNext()) {
Photo photo = it2.next();
photo.setStyle(STYLE);
}
if (this.pickerPhotoMetarialAdapter == null) {
this.pickerPhotoMetarialAdapter = new PickerPhotoAdapter(this.mContext, this.photosMetarial);
this.pickerPhotoMetarialAdapter.setOnAttachMentListener(this);
this.pickerPhotoMetarialAdapter.setEditable(true);
this.mRecycleMetarial.setAdapter(this.pickerPhotoMetarialAdapter);
return;
}
this.pickerPhotoMetarialAdapter.setmItems(this.photosMetarial);
this.pickerPhotoMetarialAdapter.notifyDataSetChanged();
}
public void getAuxiliaryPerConfirm() {
HashMap<String, String> params = new HashMap<>();
params.put("id", this.id);
params.put(AssistPushConsts.MSG_TYPE_TOKEN, this.userInfo == null ? "" : this.userInfo.getToken());
NewHYTask task = new CommonDataListTask(RequestServiceList.AUXILIARY_PRECONFIRM, params, AssistiveConfirmBean.class);
executeRequest(task);
}
public void getAuxiliaryConfirm() {
HashMap<String, String> params = new HashMap<>();
params.put("id", this.id);
params.put("confirmName", this.confirmName);
params.put("confirmDate", this.confirmDate);
params.put("confirmMemo", this.confirmMemo);
params.put("issueName", "张三");
params.put(AssistPushConsts.MSG_TYPE_TOKEN, this.userInfo == null ? "" : this.userInfo.getToken());
NewHYTask task = new CommonTask(RequestServiceList.AUXILIARY_CONFIRM, params);
executeRequest(task);
}
public void postFileToServer(Photo uploadPhoto) {
HashMap<String, String> params = new HashMap<>();
HashMap<String, String> imgParms = new HashMap<>();
params.put("relationId", this.id);
params.put("style", uploadPhoto.getStyle());
params.put(AssistPushConsts.MSG_TYPE_TOKEN, this.userInfo == null ? "" : this.userInfo.getToken());
imgParms.put("uploadifyphoto", uploadPhoto.getUri());
NewHYTask filePostTask = new AttachUploadTask(RequestServiceList.ATTACHMENT_UPLOAD, params, imgParms, new HashMap());
executeRequest(filePostTask);
}
@Override
public void onResponseBefore(NewHYTask task) {
switch (task.getService()) {
case AUXILIARY_PRECONFIRM:
case AUXILIARY_CONFIRM:
case ATTACHMENT_UPLOAD:
showProgress(NewHYConfig.LOADING_HINT, false);
break;
}
}
@Override
public void onResponseAfter(NewHYTask task) {
switch (task.getService()) {
case AUXILIARY_PRECONFIRM:
case AUXILIARY_CONFIRM:
case ATTACHMENT_UPLOAD:
cancleProgress();
break;
}
}
@Override
public void onResponseSuccessful(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case AUXILIARY_PRECONFIRM:
DataParser<AssistiveConfirmBean> mResult = (DataParser) object;
if (mResult.getObjects().size() != 0) {
this.assistiveConfirmBean = mResult.getObjects().get(0);
freshData();
break;
}
break;
case AUXILIARY_CONFIRM:
if (this.photosMetarial == null || this.photosMetarial.size() == 0) {
confirmSuccess();
break;
} else {
this.uploadPhoto = this.photosMetarial.get(0);
postFileToServer(this.uploadPhoto);
break;
}
break;
case ATTACHMENT_UPLOAD:
this.photosMetarial.remove(0);
if (this.photosMetarial == null || this.photosMetarial.size() == 0) {
confirmSuccess();
break;
} else {
this.uploadPhoto = this.photosMetarial.get(0);
postFileToServer(this.uploadPhoto);
break;
}
break;
}
}
public void freshData() {
this.mEtName.setText(this.assistiveConfirmBean.getConfirmName());
this.mTvConfirmTime.setText(this.assistiveConfirmBean.getConfirmDate());
this.mEtAdvice.setText(this.assistiveConfirmBean.getConfirmMemo());
freshDisablePersonPhotoData();
}
public void confirmSuccess() {
Intent intent = new Intent();
intent.putExtra("confirmName", this.confirmName);
setResult(-1, intent);
finish();
}
@Override
public void onResponseError(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case AUXILIARY_PRECONFIRM:
case AUXILIARY_CONFIRM:
case ATTACHMENT_UPLOAD:
ToastUtils.showLongToast(this.mContext, object.getMsg());
break;
}
}
@Override
public void onServerError(NewHYTask task, int failedType) {
switch (task.getService()) {
case AUXILIARY_PRECONFIRM:
case AUXILIARY_CONFIRM:
case ATTACHMENT_UPLOAD:
onResultShow(failedType);
break;
}
}
@Override
public void initViews() {
this.mTitleview = (TitleView) findViewById(R.id.titleview);
this.mEtName = (EditText) findViewById(R.id.et_name);
this.mTvConfirmTime = (TextView) findViewById(R.id.tv_confirm_time);
this.mEtAdvice = (EditText) findViewById(R.id.et_advice);
this.mRecycleMetarial = (RecyclerView) findViewById(R.id.recycle);
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(this.mContext, 4);
this.mRecycleMetarial.setLayoutManager(layoutManager);
this.mHandBtn = (Button) findViewById(R.id.hand_btn);
}
@Override
public void getExtraParam() {
this.id = getIntent().getStringExtra("id");
this.fujuApplyType = getIntent().getStringExtra("fujuApplyType");
if ("1".equals(this.fujuApplyType)) {
this.mTitleview.setTextName("辅具适配确认");
} else {
this.mTitleview.setTextName("辅具补贴确认");
}
}
@Override
public void setListener() {
this.mHandBtn.setOnClickListener(this);
this.mTvConfirmTime.setOnClickListener(this);
this.mTitleview.setOnTitleClik(new TitleView.BackListenner() {
@Override
public void BackSet() {
AssistiveDeviceSendConfirm.this.finish();
}
}, null);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.hand_btn:
this.confirmName = this.mEtName.getText().toString().trim();
this.confirmDate = this.mTvConfirmTime.getText().toString();
this.confirmMemo = this.mEtAdvice.getText().toString().trim();
if (isNull(this.confirmName)) {
ToastUtils.showLongToast(this.mContext, "请输入确认人姓名");
break;
} else if (isNull(this.confirmDate)) {
ToastUtils.showLongToast(this.mContext, "请选择确认时间");
break;
} else {
ChoiceTishiDialog("确定适配确认?", false, new BaseActivity.OnChoiceDialogYes() {
@Override
public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
AssistiveDeviceSendConfirm.this.getAuxiliaryConfirm();
}
}, new BaseActivity.OnChoiceDialogNo() {
@Override
public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
}
});
break;
}
case R.id.tv_confirm_time:
this.dateTimePicKDialog = new DateTimePickDialogPlus(this.mContext, "yyyy-MM-dd");
this.dateTimePicKDialog.dateTimePicKDialog((TextView) v, new DateTimePickDialogPlus.OnDateTimeListener() {
@Override
public void onDateChange(String dateTime) {
AssistiveDeviceSendConfirm.this.mTvConfirmTime.setText(dateTime + " " + DataUtil.dateToString(new Date(), " HH:mm:ss"));
}
});
break;
}
}
}