导航菜单

页面标题

页面副标题

爱心e站 v1.0.0 - AssistiveDeviceApplyActivity.java 源代码

正在查看: 爱心e站 v1.0.0 应用的 AssistiveDeviceApplyActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.newheyd.JZKFcanjiren.Activity;

import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcel;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
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.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.iflytek.cloud.SpeechEvent;
import com.igexin.assist.sdk.AssistPushConsts;
import com.newheyd.JZKFcanjiren.Adapter.AssistiveDeviceAdapter;
import com.newheyd.JZKFcanjiren.Adapter.FilePickerAdapter;
import com.newheyd.JZKFcanjiren.Adapter.PickerPhotoAdapter;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.Bean.AssistiveDeviceBean;
import com.newheyd.JZKFcanjiren.Bean.AssistiveDeviceListBean;
import com.newheyd.JZKFcanjiren.Bean.AvatarBean;
import com.newheyd.JZKFcanjiren.Bean.DisabledBaseInfoBean;
import com.newheyd.JZKFcanjiren.Bean.DisabledFileInfoBean;
import com.newheyd.JZKFcanjiren.Bean.FuJianBean;
import com.newheyd.JZKFcanjiren.Bean.MessageEvent;
import com.newheyd.JZKFcanjiren.Bean.RehabServicApplyDicBean;
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.DataParseUtil;
import com.newheyd.JZKFcanjiren.Utils.DataUtil;
import com.newheyd.JZKFcanjiren.Utils.FileDownloadUtil;
import com.newheyd.JZKFcanjiren.Utils.ImageUtil;
import com.newheyd.JZKFcanjiren.Utils.RegexUtils;
import com.newheyd.JZKFcanjiren.Utils.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.TextUtil;
import com.newheyd.JZKFcanjiren.Utils.ToastUtils;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
import com.newheyd.JZKFcanjiren.View.DateTimePickDialog;
import com.newheyd.JZKFcanjiren.View.Dialog.MyDialog;
import com.newheyd.JZKFcanjiren.View.PhotoSelect.PhotoPickerActivity;
import com.newheyd.JZKFcanjiren.View.PhotoSelect.entity.FileBean;
import com.newheyd.JZKFcanjiren.View.PhotoSelect.entity.Photo;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.config.NewHYConfig;
import com.newheyd.JZKFcanjiren.listener.OnMultyClickListener;
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 com.tencent.connect.common.Constants;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class AssistiveDeviceApplyActivity extends BaseActivity implements PickerPhotoAdapter.OnDelAttachmentListener, View.OnClickListener, FilePickerAdapter.OnDelFileAttachmentListener {
    private AssistiveDeviceAdapter adapter;
    private AssistiveDeviceListBean assistiveDeviceListBean;
    private DisabledFileInfoBean disabledFileInfoBean;
    private RecyclerView fileRecycle;
    private Gson gson;
    private Button hand_btn;
    private Button hand_btn_temp;
    private String id;
    private LinearLayout ll_applytype;
    private LinearLayout ll_check_content;
    private LinearLayout ll_content;
    private LinearLayout ll_disa4_qt;
    private LinearLayout ll_gnxl;
    private LinearLayout ll_need_content;
    private EditText mAddressTv;
    private TextView mBirthTv;
    private TextView mCertTv;
    private TextView mCitizenTv;
    private EditText mContactTv;
    private TextView mLevelTv;
    private LinearLayout mLlDisa4Fzqj;
    private LinearLayout mLlDisa4Ss;
    private TextView mNameTv;
    private TextView mNationTv;
    private RecyclerView mRecycle;
    private TextView mSexTv;
    private TitleView mTitleview;
    private EditText mTvApplyer;
    private TextView mTvApplytime;
    private TextView mTvApplytype;
    private TextView mTvHasneed;
    private EditText mTvJianhuren;
    private TextView mTypeTv;
    private RecyclerView recyclerView;
    private RehabServicApplyDicBean rehabServicApplyDicBean;
    private EditText tv_applymoney;
    private TextView tv_disa4_fzqj;
    private TextView tv_disa4_gnxl;
    private TextView tv_disa4_qt;
    private TextView tv_disa4_ss;
    private TextView tv_xiagnshoubaoxian;
    private HashMap<String, String> params = new HashMap<>();
    private PickerPhotoAdapter pickerPhotoAdapter = null;
    private ArrayList<Photo> photos = null;
    private GridLayoutManager layoutManager = null;
    private ArrayList<String> resultPhotoUris = null;
    private ArrayList<FileBean> files = null;
    private FilePickerAdapter filePickerAdapter = null;
    private CompressAnyscTask compressAnyscTask = null;
    private List<String> newPaths = null;
    private Photo deleteInfo = null;
    private boolean isEditable = true;
    private List<AssistiveDeviceBean> dataList = new ArrayList();
    private List<AssistiveDeviceBean> dataListTemp = new ArrayList();
    private String editType = "";
    private String deleteType = "";
    private String deleteID = "";
    private DisabledBaseInfoBean disabledBaseInfoBean = null;
    private List<FuJianBean> fileList = new ArrayList();
    private UserInfo userInfo = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_assistive_device_apply);
        this.editType = getIntent().getStringExtra(Constants.PARAM_KEY_TYPE);
        super.onCreate(savedInstanceState);
        this.userInfo = MyApplication.getInstance().getUserInfo();
        this.gson = new Gson();
        if (!"3".equals(this.editType)) {
            this.id = getIntent().getStringExtra("id");
        }
        if ("3".equals(this.editType)) {
            preAdd();
        } else {
            getDic();
        }
        getFuJuList();
        initRecycleView();
        goStatistics();
    }

    public void preAdd() {
        HashMap<String, String> params = new HashMap<>();
        params.put(AssistPushConsts.MSG_TYPE_TOKEN, this.userInfo == null ? "" : this.userInfo.getToken());
        NewHYTask task = new CommonTask(RequestServiceList.AUXILIARY_PREADD, params);
        executeRequest(task);
    }

    public void goStatistics() {
        HashMap<String, String> map = LocationAddrUtil.getInstance().getLocationParam(this.mContext);
        StastisticUtil.getInstance().onEvent(this.mContext, "AssistiveDeviceApplyActivity", map);
    }

    @Override
    public void onResponseBefore(NewHYTask task) {
        switch (task.getService()) {
            case GET_DICTIONNARY_DATA:
            case AUXILIARY_PREADD:
            case GET_FUJU_APPLY_INFO:
                showProgress("正在获取数据", false);
                break;
            case FUJU_ITEM_LIST:
                showProgress("正在获取数据", false);
                break;
            case FUJU_APPLY_ADD:
            case FUJU_APPLY_UDATE:
                showProgress("正在提交数据", false);
                break;
            case ATTACHMENT_UPLOAD:
                showProgress("正在上传附件", false);
                break;
            case ATTACHMENT_CALLBACK:
                showProgress("正在获取附件数据", false);
                break;
            case ATTACHMENT_DELETE:
                showProgress("正在删除附件数据", false);
                break;
        }
    }

    @Override
    public void onResponseAfter(NewHYTask task) {
        cancleProgress();
    }

    @Override
    public void onResponseSuccessful(NewHYTask task, BaseResult object) {
        switch (task.getService()) {
            case GET_DICTIONNARY_DATA:
                String data = object.getData();
                if (!TextUtils.isEmpty(data)) {
                    this.rehabServicApplyDicBean = (RehabServicApplyDicBean) this.gson.fromJson(data, RehabServicApplyDicBean.class);
                }
                if ("2".equals(this.editType) || "1".equals(this.editType)) {
                    getApplyInfo(this.id);
                    break;
                }
                break;
            case AUXILIARY_PREADD:
                showMyDialog("1", getResources().getString(R.string.recover_law_str));
                break;
            case GET_FUJU_APPLY_INFO:
                DataParser<DisabledBaseInfoBean> mResult = (DataParser) object;
                if (mResult.getObjects().size() != 0) {
                    this.disabledBaseInfoBean = mResult.getObjects().get(0);
                    this.disabledFileInfoBean = (DisabledFileInfoBean) this.gson.fromJson(object.getData2(), DisabledFileInfoBean.class);
                    String data3 = object.getData3();
                    if (data3 != null) {
                        try {
                            if (this.dataList != null) {
                                this.dataList.clear();
                                if (!"1".equals(this.editType)) {
                                    AssistiveDeviceBean ass = new AssistiveDeviceBean(Parcel.obtain());
                                    ass.setpName("新增");
                                    ass.isAdd = true;
                                    this.dataList.add(ass);
                                }
                            }
                            JSONArray jsonArry3 = new JSONArray(data3);
                            if (jsonArry3 != null) {
                                for (int i = 0; i < jsonArry3.length(); i++) {
                                    JSONObject jsonObject1 = jsonArry3.getJSONObject(i);
                                    AssistiveDeviceBean assistiveDeviceBean = new AssistiveDeviceBean();
                                    assistiveDeviceBean.setAid(jsonObject1.optString("catalogId", ""));
                                    assistiveDeviceBean.setName(jsonObject1.optString("name", ""));
                                    assistiveDeviceBean.setpName(jsonObject1.optString("typeName", ""));
                                    assistiveDeviceBean.setPid(jsonObject1.optString("typeId", ""));
                                    assistiveDeviceBean.setRealPrice(jsonObject1.optDouble("price", 0.0d));
                                    assistiveDeviceBean.setTopPrice(jsonObject1.optDouble("limitPrice", 0.0d));
                                    assistiveDeviceBean.setDelFlag("0");
                                    assistiveDeviceBean.setId(jsonObject1.optString("id"));
                                    if (!"1".equals(this.editType)) {
                                        this.dataList.add(this.dataList.size() - 1, assistiveDeviceBean);
                                    } else {
                                        this.dataList.add(assistiveDeviceBean);
                                    }
                                }
                                initRecycleView();
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                    initViewData();
                    getAttchFile(this.disabledFileInfoBean.getId());
                    break;
                }
                break;
            case FUJU_ITEM_LIST:
                String data1 = object.getData();
                if (data1 != null) {
                    this.assistiveDeviceListBean = (AssistiveDeviceListBean) this.gson.fromJson(data1, AssistiveDeviceListBean.class);
                    SharedPreferences sharedPreferencesEdite = getSharedPreferences("fuju", 0);
                    sharedPreferencesEdite.edit().putString("fujulist", data1).commit();
                    break;
                }
                break;
            case FUJU_APPLY_ADD:
                JSONObject jsonObject = object.getJsonObject();
                if (jsonObject != null) {
                    JSONObject jsonObject12 = jsonObject.optJSONObject(SpeechEvent.KEY_EVENT_RECORD_DATA);
                    if (jsonObject12 != null) {
                        String id = jsonObject12.optString("id");
                        if (!TextUtils.isEmpty(id) && ((this.photos != null && this.photos.size() > 0) || (this.files != null && this.files.size() > 0))) {
                            postFileToServer(id, NewHYConfig.FUJU_APPLY_TYPE_STR);
                            break;
                        } else {
                            TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                                @Override
                                public void onTishiDialogClicked(DialogInterface dialogInterface, int i2) {
                                    MessageEvent messageEvent = new MessageEvent("辅具申请提交成功", 10004);
                                    EventBus.getDefault().post(messageEvent);
                                    AssistiveDeviceApplyActivity.this.finish();
                                }
                            });
                            break;
                        }
                    } else {
                        TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                            @Override
                            public void onTishiDialogClicked(DialogInterface dialogInterface, int i2) {
                                MessageEvent messageEvent = new MessageEvent("辅具申请提交成功", 10004);
                                EventBus.getDefault().post(messageEvent);
                                AssistiveDeviceApplyActivity.this.finish();
                            }
                        });
                        break;
                    }
                } else {
                    TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                        @Override
                        public void onTishiDialogClicked(DialogInterface dialogInterface, int i2) {
                            MessageEvent messageEvent = new MessageEvent("辅具申请提交成功", 10004);
                            EventBus.getDefault().post(messageEvent);
                            AssistiveDeviceApplyActivity.this.finish();
                        }
                    });
                    break;
                }
                break;
            case FUJU_APPLY_UDATE:
                if (!TextUtils.isEmpty(this.id) && ((this.photos != null && this.photos.size() > 0) || (this.files != null && this.files.size() > 0))) {
                    postFileToServer(this.id, NewHYConfig.RECOVER_APPLY_TYPE_STR);
                    break;
                } else {
                    TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                        @Override
                        public void onTishiDialogClicked(DialogInterface dialogInterface, int i2) {
                            MessageEvent messageEvent = new MessageEvent("康复申请提交成功", 10004);
                            EventBus.getDefault().post(messageEvent);
                            AssistiveDeviceApplyActivity.this.finish();
                        }
                    });
                    break;
                }
            case ATTACHMENT_UPLOAD:
                TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                    @Override
                    public void onTishiDialogClicked(DialogInterface dialogInterface, int i2) {
                        MessageEvent messageEvent = new MessageEvent("康复申请提交成功", 10004);
                        EventBus.getDefault().post(messageEvent);
                        AssistiveDeviceApplyActivity.this.finish();
                    }
                });
                break;
            case ATTACHMENT_CALLBACK:
                JSONObject jsonObject13 = object.getJsonObject();
                if (jsonObject13 != null) {
                    try {
                        if (this.fileList != null) {
                            this.fileList.clear();
                        }
                        JSONArray dataarr = jsonObject13.optJSONArray(SpeechEvent.KEY_EVENT_RECORD_DATA);
                        if (dataarr != null) {
                            for (int i2 = 0; i2 < dataarr.length(); i2++) {
                                this.fileList.add((FuJianBean) this.gson.fromJson(dataarr.getString(i2), FuJianBean.class));
                            }
                        }
                    } catch (JSONException e2) {
                        e2.printStackTrace();
                        return;
                    }
                }
                if (this.fileList.size() > 0) {
                    if (this.photos != null) {
                        this.photos.clear();
                    }
                    for (FuJianBean fuJianBean : this.fileList) {
                        if (NewHYConfig.photoStyle.contains(fuJianBean.fileExt)) {
                            Photo photo = new Photo();
                            photo.setId(fuJianBean.id);
                            photo.setUri(NewHYConfig.ROOT + fuJianBean.filePath + fuJianBean.newFileName);
                            photo.setFileName(fuJianBean.fileName);
                            this.photos.add(photo);
                        } else if (NewHYConfig.fileStyle.contains(fuJianBean.fileExt)) {
                            FileBean fileBean = new FileBean();
                            fileBean.setId(fuJianBean.id);
                            fileBean.setName(fuJianBean.fileName);
                            fileBean.setNetpath(NewHYConfig.ROOT + fuJianBean.filePath + fuJianBean.newFileName);
                            fileBean.setUri(NewHYConfig.ROOT + fuJianBean.filePath + fuJianBean.newFileName);
                            fileBean.setType(2);
                            this.files.add(fileBean);
                        }
                    }
                }
                initAttachFile();
                break;
            case ATTACHMENT_DELETE:
                if ("1".equals(this.deleteType)) {
                    Iterator<Photo> it = this.photos.iterator();
                    while (it.hasNext()) {
                        Photo photo2 = it.next();
                        if (this.deleteID.equals(photo2.getId())) {
                            this.photos.remove(photo2);
                            this.pickerPhotoAdapter.notifyDataSetChanged();
                        }
                    }
                    break;
                } else if ("2".equals(this.deleteType)) {
                    Iterator<FileBean> it2 = this.files.iterator();
                    while (it2.hasNext()) {
                        FileBean fileBean2 = it2.next();
                        if (this.deleteID.equals(fileBean2.getId())) {
                            this.files.remove(fileBean2);
                            this.filePickerAdapter.notifyDataSetChanged();
                        }
                    }
                    break;
                }
                break;
        }
    }

    @Override
    public void onResponseError(NewHYTask task, BaseResult object) {
        switch (task.getService()) {
            case GET_DICTIONNARY_DATA:
                ToastUtils.showShortToast(this.mContext, object.getMsg());
                break;
            case AUXILIARY_PREADD:
                showMyDialog("2", object.getMsg());
                break;
            case FUJU_ITEM_LIST:
                ToastUtils.showShortToast(this.mContext, object.getMsg());
                break;
            case FUJU_APPLY_ADD:
            case FUJU_APPLY_UDATE:
                ToastUtils.showShortToast(this.mContext, object.getMsg());
                break;
        }
    }

    @Override
    public void onServerError(NewHYTask task, int failedType) {
        onResultShow(failedType);
    }

    @Override
    public void initViews() {
        this.mTitleview = (TitleView) findViewById(R.id.titleview);
        this.mNameTv = (TextView) findViewById(R.id.name_tv);
        this.mSexTv = (TextView) findViewById(R.id.sex_tv);
        this.mNationTv = (TextView) findViewById(R.id.nation_tv);
        this.mBirthTv = (TextView) findViewById(R.id.birth_tv);
        this.mCitizenTv = (TextView) findViewById(R.id.citizen_tv);
        this.mCertTv = (TextView) findViewById(R.id.cert_tv);
        this.mTypeTv = (TextView) findViewById(R.id.type_tv);
        this.mLevelTv = (TextView) findViewById(R.id.level_tv);
        this.mTvJianhuren = (EditText) findViewById(R.id.tv_jianhuren);
        this.mContactTv = (EditText) findViewById(R.id.contact_tv);
        this.mAddressTv = (EditText) findViewById(R.id.address_tv);
        this.mTvHasneed = (TextView) findViewById(R.id.tv_hasneed);
        this.mTvApplytype = (TextView) findViewById(R.id.tv_applytype);
        this.tv_applymoney = (EditText) findViewById(R.id.tv_applymoney);
        this.mTvApplyer = (EditText) findViewById(R.id.tv_applyer);
        this.mTvApplytime = (TextView) findViewById(R.id.tv_applytime);
        this.mLlDisa4Ss = (LinearLayout) findViewById(R.id.ll_disa4_ss);
        this.mLlDisa4Fzqj = (LinearLayout) findViewById(R.id.ll_disa4_fzqj);
        this.ll_disa4_qt = (LinearLayout) findViewById(R.id.ll_disa4_qt);
        this.ll_gnxl = (LinearLayout) findViewById(R.id.ll_gnxl);
        this.ll_applytype = (LinearLayout) findViewById(R.id.ll_applytype);
        this.ll_content = (LinearLayout) findViewById(2131689634);
        this.ll_need_content = (LinearLayout) findViewById(R.id.ll_need_content);
        this.ll_check_content = (LinearLayout) findViewById(R.id.ll_check_content);
        this.tv_xiagnshoubaoxian = (TextView) findView(R.id.tv_xiagnshoubaoxian);
        this.hand_btn = (Button) findView(R.id.hand_btn);
        this.hand_btn_temp = (Button) findView(R.id.hand_btn_temp);
        this.tv_disa4_ss = (TextView) findView(R.id.tv_disa4_ss);
        this.tv_disa4_gnxl = (TextView) findView(R.id.tv_disa4_gnxl);
        this.tv_disa4_fzqj = (TextView) findView(R.id.tv_disa4_fzqj);
        this.tv_disa4_qt = (TextView) findView(R.id.tv_disa4_qt);
        this.mRecycle = (RecyclerView) findViewById(R.id.recycle);
        this.layoutManager = new GridLayoutManager(this, 4);
        this.mRecycle.setLayoutManager(this.layoutManager);
        GridLayoutManager layoutManager2 = new GridLayoutManager(this, 4);
        this.fileRecycle = (RecyclerView) findViewById(R.id.recycle_file);
        this.fileRecycle.setLayoutManager(layoutManager2);
        this.recyclerView = (RecyclerView) findViewById(R.id.rv_show);
        this.photos = new ArrayList<>();
        this.files = new ArrayList<>();
        freshData();
        freshFileData();
    }

    public void initViewData() {
        this.mLlDisa4Ss.setVisibility(8);
        this.ll_gnxl.setVisibility(8);
        this.ll_disa4_qt.setVisibility(8);
        this.mNameTv.setText(this.userInfo.getNickname());
        this.mSexTv.setText(DataParseUtil.getSex(this.userInfo.getSex()));
        this.mNationTv.setText(DataParseUtil.getMinZu(this.userInfo.getRace()));
        this.mBirthTv.setText(DataUtil.formatDateOther(this.userInfo.getBirthdate()));
        this.mCitizenTv.setText(this.userInfo.getCitizenId());
        this.mCertTv.setText(this.userInfo.getCardNum());
        this.mTypeTv.setText(DataParseUtil.getIdtKind(this.userInfo.getIdtKind()));
        this.mLevelTv.setText(DataParseUtil.getIdtLevel(this.userInfo.getIdtLevel()));
        if ("1".equals(this.editType)) {
            this.mTvJianhuren.setEnabled(false);
            this.mContactTv.setEnabled(false);
            this.mAddressTv.setEnabled(false);
            this.tv_xiagnshoubaoxian.setEnabled(false);
            this.tv_disa4_ss.setEnabled(false);
            this.tv_disa4_gnxl.setEnabled(false);
            this.tv_disa4_fzqj.setEnabled(false);
            this.tv_disa4_qt.setEnabled(false);
            this.hand_btn.setVisibility(8);
            this.hand_btn_temp.setVisibility(8);
            this.mTvApplytime.setEnabled(false);
            this.mTvApplytype.setEnabled(false);
            this.tv_applymoney.setEnabled(false);
            this.mTvApplyer.setEnabled(false);
            if (this.adapter != null) {
                this.adapter.setEditable(false);
            }
            if ("2".equals(this.disabledFileInfoBean.getIsSubmit())) {
                findView(R.id.fl_shenhe_detail).setVisibility(0);
                this.ll_check_content.setVisibility(0);
            } else {
                findView(R.id.fl_shenhe_detail).setVisibility(8);
                this.ll_check_content.setVisibility(8);
            }
        }
        if ("3".equals(this.editType)) {
            this.mTvJianhuren.setText(this.userInfo.getGuardian());
            this.mContactTv.setText(this.userInfo.getGuardianPhone());
            this.mAddressTv.setText(this.userInfo.getNowAdd());
        } else if (this.disabledFileInfoBean != null) {
            this.mTvJianhuren.setText(this.disabledFileInfoBean.getGuarder());
            this.mContactTv.setText(this.disabledFileInfoBean.getLinkTel());
            this.mAddressTv.setText(this.disabledFileInfoBean.getFamilyAddress());
            this.tv_xiagnshoubaoxian.setText(TextUtil.getLableStringFromList(this.rehabServicApplyDicBean.getMedical_insurance(), this.disabledFileInfoBean.getMedicalSafe()));
            this.tv_disa4_fzqj.setText(TextUtil.getLableStringFromList(this.rehabServicApplyDicBean.getDtgx2017_o6_type(), this.disabledFileInfoBean.getO6()));
            this.mTvApplytime.setText(this.disabledFileInfoBean.getApplyDate());
            if ("2".equals(this.disabledFileInfoBean.getFujuApplyType())) {
                this.mTvApplytype.setText("辅具补贴");
                this.tv_applymoney.setVisibility(0);
                this.tv_applymoney.setText(this.disabledFileInfoBean.getSubsidiesPrice());
            } else {
                this.mTvApplytype.setText("辅具适配");
            }
            this.mTvApplyer.setText(this.disabledFileInfoBean.getApplyPerson());
        }
    }

    private void initRecycleView() {
        if ("3".equals(this.editType)) {
            AssistiveDeviceBean ass = new AssistiveDeviceBean(Parcel.obtain());
            ass.setpName("新增");
            ass.isAdd = true;
            this.dataList.add(ass);
        }
        LinearLayoutManager manager = new LinearLayoutManager(this);
        this.recyclerView.setLayoutManager(manager);
        this.adapter = new AssistiveDeviceAdapter(this, this.dataList);
        this.adapter.getAssistiveDeviceDelagate().setActivityName("AssistiveDeviceApplyActivity");
        this.recyclerView.setAdapter(this.adapter);
    }

    @Override
    public void setListener() {
        this.mTitleview.setOnTitleClik(null, null);
        this.mTvApplytime.setOnClickListener(this);
        this.tv_xiagnshoubaoxian.setOnClickListener(this);
        this.tv_disa4_ss.setOnClickListener(this);
        this.tv_disa4_gnxl.setOnClickListener(this);
        this.tv_disa4_fzqj.setOnClickListener(this);
        this.tv_disa4_qt.setOnClickListener(this);
        this.mTvApplytype.setOnClickListener(this);
        this.hand_btn.setOnClickListener(this);
        this.hand_btn_temp.setOnClickListener(this);
        findViewById(R.id.sort_ll).setOnClickListener(this);
        findViewById(R.id.fl_fj).setOnClickListener(this);
        findViewById(R.id.fl_kf).setOnClickListener(this);
        findViewById(R.id.fl_shenhe_detail).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_xiagnshoubaoxian:
                if (this.rehabServicApplyDicBean != null) {
                    String[] medical_insurance = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getMedical_insurance());
                    showMutilAlertDialog(R.id.tv_xiagnshoubaoxian, "请选择享受医疗保险情况", medical_insurance, this.tv_xiagnshoubaoxian.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
            case R.id.fl_kf:
                if (this.ll_need_content.getVisibility() == 0) {
                    this.ll_need_content.setVisibility(8);
                    break;
                } else {
                    this.ll_need_content.setVisibility(0);
                    break;
                }
            case R.id.sort_ll:
                View v_fujufenlei = findViewById(R.id.v_fujufenlei);
                if (v_fujufenlei.getVisibility() == 0) {
                    v_fujufenlei.setVisibility(8);
                    ((ImageView) findViewById(R.id.medical_iv)).setImageResource(R.drawable.right_btn);
                    break;
                } else {
                    v_fujufenlei.setVisibility(0);
                    ((ImageView) findViewById(R.id.medical_iv)).setImageResource(R.drawable.down_btn);
                    break;
                }
            case R.id.fl_fj:
                if (this.ll_content.getVisibility() == 0) {
                    this.ll_content.setVisibility(8);
                    break;
                } else {
                    this.ll_content.setVisibility(0);
                    break;
                }
            case R.id.fl_shenhe_detail:
                if (this.ll_check_content.getVisibility() == 0) {
                    this.ll_check_content.setVisibility(8);
                    break;
                } else {
                    this.ll_check_content.setVisibility(0);
                    break;
                }
            case R.id.hand_btn:
                ChoiceTishiDialog("您确定保存并提交吗,提交后就不能再进行编辑了", false, new BaseActivity.OnChoiceDialogYes() {
                    @Override
                    public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
                        AssistiveDeviceApplyActivity.this.params.put("status", "2");
                        AssistiveDeviceApplyActivity.this.params.put("isSubmit", "2");
                        AssistiveDeviceApplyActivity.this.params.put("auditState", "2");
                        AssistiveDeviceApplyActivity.this.submitForm();
                    }
                }, new BaseActivity.OnChoiceDialogNo() {
                    @Override
                    public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
                    }
                });
                break;
            case R.id.hand_btn_temp:
                this.params.put("status", "1");
                this.params.put("isSubmit", "1");
                this.params.put("auditState", "1");
                submitForm();
                break;
            case R.id.tv_disa4_ss:
                if (this.rehabServicApplyDicBean != null) {
                    String[] ssxuqiu = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getDtgx2017_o4_type());
                    showMutilAlertDialog(R.id.tv_disa4_ss, "请选择手术需求项", ssxuqiu, this.tv_disa4_ss.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                            StringBuffer take_tv = new StringBuffer();
                            for (int i = 0; i < selected.length; i++) {
                                if (selected[i]) {
                                    take_tv.append(AssistiveDeviceApplyActivity.this.rehabServicApplyDicBean.getDtgx2017_o4_type().get(i).getValue()).append(",");
                                }
                            }
                            AssistiveDeviceApplyActivity.this.params.put("O4", take_tv.toString());
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
            case R.id.tv_disa4_gnxl:
                if (this.rehabServicApplyDicBean != null) {
                    String[] gnxl = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getDtgx2017_o5_type());
                    showMutilAlertDialog(R.id.tv_disa4_gnxl, "请选择功能训练需求项", gnxl, this.tv_disa4_gnxl.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                            StringBuffer take_tv = new StringBuffer();
                            for (int i = 0; i < selected.length; i++) {
                                if (selected[i]) {
                                    take_tv.append(AssistiveDeviceApplyActivity.this.rehabServicApplyDicBean.getDtgx2017_o5_type().get(i).getValue()).append(",");
                                }
                            }
                            AssistiveDeviceApplyActivity.this.params.put("O5", take_tv.toString());
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
            case R.id.tv_disa4_fzqj:
                if (this.rehabServicApplyDicBean != null) {
                    String[] fjxl = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getDtgx2017_o6_type());
                    showMutilAlertDialog(R.id.tv_disa4_fzqj, "请选择辅助器具需求项", fjxl, this.tv_disa4_fzqj.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                            StringBuffer take_tv = new StringBuffer();
                            for (int i = 0; i < selected.length; i++) {
                                if (selected[i]) {
                                    take_tv.append(AssistiveDeviceApplyActivity.this.rehabServicApplyDicBean.getDtgx2017_o6_type().get(i).getValue()).append(",");
                                }
                            }
                            AssistiveDeviceApplyActivity.this.params.put("o6", take_tv.toString());
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
            case R.id.tv_applytype:
                String[] applyType = {"辅具适配", "辅具补贴"};
                showChoiceDialog(R.id.tv_applytype, "请选择申请类型", applyType);
                break;
            case R.id.tv_applytime:
                try {
                    DateTimePickDialog dateTimePickDialog = new DateTimePickDialog(this, DataUtil.longToString(System.currentTimeMillis(), "yyyy年MM月dd日"));
                    dateTimePickDialog.dateTimePicKDialog(this.mTvApplytime);
                    dateTimePickDialog.setOnTimeSelectedListener(new DateTimePickDialog.OnTimeSelectedListener() {
                        @Override
                        public void onTimeSelected(String R) {
                            AssistiveDeviceApplyActivity.this.mTvApplytime.setText(R + DataUtil.dateToString(new Date(), " HH:mm:ss"));
                        }
                    });
                    break;
                } catch (ParseException e) {
                    e.printStackTrace();
                    return;
                }
            case R.id.tv_disa4_qt:
                if (this.rehabServicApplyDicBean != null) {
                    String[] qt = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getDtgx2017_o7_type());
                    showMutilAlertDialog(R.id.tv_disa4_qt, "请选择其他需求项", qt, this.tv_disa4_qt.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                            StringBuffer take_tv = new StringBuffer();
                            for (int i = 0; i < selected.length; i++) {
                                if (selected[i]) {
                                    take_tv.append(AssistiveDeviceApplyActivity.this.rehabServicApplyDicBean.getDtgx2017_o7_type().get(i).getValue()).append(",");
                                }
                            }
                            AssistiveDeviceApplyActivity.this.params.put("O7", take_tv.toString());
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
        }
    }

    private void showMyDialog(String keytype, String content) {
        if ("1".equals(keytype)) {
            MyDialog myDialog = new MyDialog(this.mContext, content, "关于服务办理的相关声明", "同意", "不同意", false);
            myDialog.setOnDiaLogListener(new MyDialog.OnDialogListenerPN() {
                @Override
                public void dialogPositiveListener(View customView, DialogInterface dialogInterface, int which) {
                    AssistiveDeviceApplyActivity.this.initViewData();
                    AssistiveDeviceApplyActivity.this.getDic();
                    dialogInterface.dismiss();
                }

                @Override
                public void dialogNegativeListener(View customView, DialogInterface dialogInterface, int which) {
                    ToastUtils.showShortToast(AssistiveDeviceApplyActivity.this.mContext, "您需要同意上述条款才可进行在线办理");
                    AssistiveDeviceApplyActivity.this.finish();
                    dialogInterface.dismiss();
                }
            });
            myDialog.showDialog();
            return;
        }
        TishiDialog(content, true, new BaseActivity.OnTishiDialogClicked() {
            @Override
            public void onTishiDialogClicked(DialogInterface dialogInterface, int i) {
                AssistiveDeviceApplyActivity.this.finish();
            }
        });
    }

    public void getDic() {
        HashMap<String, String> params = new HashMap<>();
        params.put("type", "medical_insurance,dtgx2017_o4_type,dtgx2017_o5_type,dtgx2017_o6_type,dtgx2017_o7_type");
        CommonTask requestTask = new CommonTask(RequestServiceList.GET_DICTIONNARY_DATA, params);
        executeRequest(requestTask);
    }

    public void getFuJuList() {
        HashMap<String, String> params = new HashMap<>();
        UserInfo userInfo = MyApplication.getInstance().getUserInfo();
        if (userInfo != null) {
            params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo.getToken());
            params.put("type", "idt_kind");
            params.put("value", userInfo.getIdtKind());
            CommonTask fujuListTask = new CommonTask(RequestServiceList.FUJU_ITEM_LIST, params);
            executeRequest(fujuListTask);
        }
    }

    public void submitForm() {
        String guarder = this.mTvJianhuren.getText().toString().trim();
        if (!TextUtils.isEmpty(guarder)) {
            this.params.put("guarder", guarder);
            String phonenumber = this.mContactTv.getText().toString().trim();
            if (!TextUtils.isEmpty(phonenumber)) {
                if (RegexUtils.judgePhone(phonenumber) || RegexUtils.judgeMobile(phonenumber)) {
                    this.params.put("linkTel", phonenumber);
                    String address = this.mAddressTv.getText().toString().trim();
                    if (!TextUtils.isEmpty(address)) {
                        this.params.put("familyAddress", address);
                        String applyer = this.mTvApplyer.getText().toString().trim();
                        if (!TextUtils.isEmpty(applyer)) {
                            this.params.put("applyPerson", applyer);
                            String applytime = this.mTvApplytime.getText().toString();
                            if (!TextUtils.isEmpty(applytime)) {
                                this.params.put("applyDate", applytime);
                                String medicalSafeStr = this.tv_xiagnshoubaoxian.getText().toString();
                                String valueStringFromList = TextUtil.getValueStringFromList(this.rehabServicApplyDicBean.getMedical_insurance(), medicalSafeStr);
                                this.params.put("medicalSafe", valueStringFromList);
                                if (TextUtils.isEmpty(this.params.get("medicalSafe"))) {
                                    ToastUtils.showShortToast(this.mContext, "未填写享受医疗保险情况");
                                    return;
                                }
                                String applyType = this.mTvApplytype.getText().toString().trim();
                                if ("辅具适配".equals(applyType)) {
                                    this.params.put("fujuApplyType", "1");
                                } else if ("辅具补贴".equals(applyType)) {
                                    this.params.put("fujuApplyType", "2");
                                }
                                if (TextUtils.isEmpty(this.params.get("fujuApplyType"))) {
                                    ToastUtils.showShortToast(this.mContext, "未填写辅具申请类型");
                                    return;
                                }
                                if (this.ll_applytype.getVisibility() == 0) {
                                    String money = this.tv_applymoney.getText().toString().trim();
                                    if (TextUtils.isEmpty(money)) {
                                        ToastUtils.showShortToast(this.mContext, "未填写补贴金额");
                                        return;
                                    }
                                    this.params.put("subsidiesPrice", money);
                                }
                                String tv_disa4_fzqjstr = this.tv_disa4_fzqj.getText().toString();
                                String o6Str = TextUtil.getValueStringFromList(this.rehabServicApplyDicBean.getDtgx2017_o6_type(), tv_disa4_fzqjstr);
                                this.params.put("o6", o6Str);
                                this.params.put("name", MyApplication.getInstance().getUserInfo().getNickname());
                                this.params.put("citizenId", MyApplication.getInstance().getUserInfo().getCitizenId());
                                this.params.put("areaCode", MyApplication.getInstance().getUserInfo().getJiedaoCode());
                                this.params.put("idtKind", MyApplication.getInstance().getUserInfo().getIdtKind());
                                this.params.put(AssistPushConsts.MSG_TYPE_TOKEN, MyApplication.getInstance().getUserInfo().getToken());
                                if (this.dataList != null) {
                                    this.dataList.addAll(this.dataListTemp);
                                }
                                if (this.dataList.size() > 0) {
                                    JSONArray fujuArr = new JSONArray();
                                    for (AssistiveDeviceBean assistiveDeviceBean : this.dataList) {
                                        if (!"新增".equals(assistiveDeviceBean.getpName())) {
                                            JSONObject jsonObject = new JSONObject();
                                            try {
                                                jsonObject.put("typeId", assistiveDeviceBean.getPid());
                                                jsonObject.put("catalogId", assistiveDeviceBean.getAid());
                                                jsonObject.put("price", assistiveDeviceBean.getRealPrice());
                                                jsonObject.put("limitPrice", assistiveDeviceBean.getTopPrice());
                                                jsonObject.put("id", assistiveDeviceBean.getId());
                                                jsonObject.put("delFlag", assistiveDeviceBean.getDelFlag());
                                                fujuArr.put(jsonObject);
                                            } catch (JSONException e) {
                                                e.printStackTrace();
                                            }
                                        }
                                    }
                                    try {
                                        new JSONObject().put("fujulist", fujuArr);
                                        this.params.put("fujuDetailList", fujuArr.toString());
                                    } catch (JSONException e2) {
                                        e2.printStackTrace();
                                    }
                                }
                                if ("2".equals(this.editType)) {
                                    this.params.put("id", this.id);
                                    this.params.put("personalFrom", this.disabledFileInfoBean.getPersonalFrom());
                                    this.params.put("year", this.disabledFileInfoBean.getYear());
                                    this.params.put("g36", this.disabledFileInfoBean.getG36());
                                    this.params.put("hasAuxiliary", this.disabledFileInfoBean.getHasAuxiliary());
                                    CommonTask updataTask = new CommonTask(RequestServiceList.FUJU_APPLY_UDATE, this.params);
                                    executeRequest(updataTask);
                                    return;
                                }
                                if ("3".equals(this.editType)) {
                                    CommonTask sendTask = new CommonTask(RequestServiceList.FUJU_APPLY_ADD, this.params);
                                    executeRequest(sendTask);
                                    return;
                                }
                                return;
                            }
                            ToastUtils.showShortToast(this.mContext, "未填写申请时间");
                            return;
                        }
                        ToastUtils.showShortToast(this.mContext, "未填写申请人");
                        return;
                    }
                    ToastUtils.showShortToast(this.mContext, "未填写家庭住址");
                    return;
                }
                ToastUtils.showShortToast(this.mContext, this.mContext.getResources().getString(R.string.contract_format));
                return;
            }
            ToastUtils.showShortToast(this.mContext, "未填写联系电话");
            return;
        }
        ToastUtils.showShortToast(this.mContext, "未填写监护人姓名");
    }

    public void showChoiceDialog(final int id, String title, String[] str) {
        MyDialog myDialog = new MyDialog(this, str, title, "取消", false);
        myDialog.setOnDiaLogListener(new MyDialog.OnDialogListenerD() {
            @Override
            public void dialogDanxuanListener(View customView, String select, int which) {
                ((TextView) AssistiveDeviceApplyActivity.this.findViewById(id)).setText(select);
                switch (id) {
                    case R.id.tv_applytype:
                        if ("辅具适配".equals(select)) {
                            AssistiveDeviceApplyActivity.this.params.put("fujuApplyType", "1");
                            AssistiveDeviceApplyActivity.this.ll_applytype.setVisibility(8);
                            break;
                        } else if ("辅具补贴".equals(select)) {
                            AssistiveDeviceApplyActivity.this.params.put("fujuApplyType", "2");
                            AssistiveDeviceApplyActivity.this.ll_applytype.setVisibility(0);
                            break;
                        }
                        break;
                }
            }
        }, new MyDialog.OnDialogListenerN() {
            @Override
            public void dialogNegativeListener(View customView, DialogInterface dialogInterface, int which) {
                ((TextView) AssistiveDeviceApplyActivity.this.findViewById(id)).setText("");
                int i = id;
                dialogInterface.dismiss();
            }
        });
        myDialog.showDialog();
    }

    @Override
    public void attachmentFileDel(final FileBean info) {
        ChoiceTishiDialog("您确定删除服务器上已经上传的附件吗?", false, new BaseActivity.OnChoiceDialogYes() {
            @Override
            public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
                AssistiveDeviceApplyActivity.this.deleteAttchFile(info.getId());
                AssistiveDeviceApplyActivity.this.deleteID = info.getId();
                AssistiveDeviceApplyActivity.this.deleteType = "2";
            }
        }, new BaseActivity.OnChoiceDialogNo() {
            @Override
            public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });
    }

    @Override
    public void onFileClickListener(int positon) {
        FileDownloadUtil fileDownload = new FileDownloadUtil(this.mContext);
        fileDownload.startDownLoadFile(this.files.get(positon).getUri(), this.files.get(positon).getName());
    }

    @Override
    public void attachmentDel(final Photo info) {
        ChoiceTishiDialog("您确定删除服务器上已经上传的附件吗?", false, new BaseActivity.OnChoiceDialogYes() {
            @Override
            public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
                AssistiveDeviceApplyActivity.this.deleteAttchFile(info.getId());
                AssistiveDeviceApplyActivity.this.deleteID = info.getId();
                AssistiveDeviceApplyActivity.this.deleteType = "1";
            }
        }, new BaseActivity.OnChoiceDialogNo() {
            @Override
            public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });
    }

    @Override
    public void onPhotoClickListener(int postion) {
        Intent intent = new Intent(this.mContext, (Class<?>) ShowLargerPhotoActivity.class);
        ArrayList<AvatarBean> bigPhotoList = new ArrayList<>();
        Iterator<Photo> it = this.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", postion);
        startActivity(intent);
    }

    class CompressAnyscTask extends AsyncTask<ArrayList<String>, List<String>, List<String>> {
        CompressAnyscTask() {
        }

        @Override
        protected void onPreExecute() {
            AssistiveDeviceApplyActivity.this.showProgress("图片压缩中", false);
        }

        @Override
        public List<String> doInBackground(ArrayList<String>... params) {
            List<String> newPaths = ImageUtil.compressImage(AssistiveDeviceApplyActivity.this.mContext, params[0]);
            return newPaths;
        }

        @Override
        public void onPostExecute(List<String> result) {
            AssistiveDeviceApplyActivity.this.newPaths = result;
            if (AssistiveDeviceApplyActivity.this.newPaths != null && AssistiveDeviceApplyActivity.this.newPaths.size() != 0) {
                int i = 0;
                while (i < AssistiveDeviceApplyActivity.this.photos.size()) {
                    if (TextUtils.isEmpty(((Photo) AssistiveDeviceApplyActivity.this.photos.get(i)).getId())) {
                        AssistiveDeviceApplyActivity.this.photos.remove(AssistiveDeviceApplyActivity.this.photos.get(i));
                        i--;
                    }
                    i++;
                }
                for (int i2 = 0; i2 < AssistiveDeviceApplyActivity.this.newPaths.size(); i2++) {
                    AssistiveDeviceApplyActivity.this.photos.add(new Photo((String) AssistiveDeviceApplyActivity.this.newPaths.get(i2)));
                }
                AssistiveDeviceApplyActivity.this.cancleProgress();
                AssistiveDeviceApplyActivity.this.freshData();
            }
        }
    }

    public void freshData() {
        if (this.photos != null && this.deleteInfo != null) {
            Iterator<Photo> it = this.photos.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                Photo p = it.next();
                if (!isNull(p.getUri()) && p.getUri().equals(this.deleteInfo.getUri())) {
                    this.photos.remove(p);
                    break;
                }
            }
        }
        if (this.pickerPhotoAdapter == null) {
            this.pickerPhotoAdapter = new PickerPhotoAdapter(this.mContext, this.photos);
            this.pickerPhotoAdapter.setListener(this);
            this.pickerPhotoAdapter.setEditable(this.isEditable);
            this.mRecycle.setAdapter(this.pickerPhotoAdapter);
            return;
        }
        this.pickerPhotoAdapter.setEditable(this.isEditable);
        this.pickerPhotoAdapter.setmItems(this.photos);
        this.pickerPhotoAdapter.notifyDataSetChanged();
    }

    public void freshFileData() {
        if (this.files != null && this.deleteInfo != null) {
            Iterator<FileBean> it = this.files.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                FileBean p = it.next();
                if (!isNull(p.getUri()) && p.getUri().equals(this.deleteInfo.getUri())) {
                    this.files.remove(p);
                    break;
                }
            }
        }
        if (this.filePickerAdapter == null) {
            this.filePickerAdapter = new FilePickerAdapter(this.mContext, this.files);
            this.filePickerAdapter.setListener(this);
            this.filePickerAdapter.setEditable(this.isEditable);
            this.fileRecycle.setAdapter(this.filePickerAdapter);
            return;
        }
        this.filePickerAdapter.setEditable(this.isEditable);
        this.filePickerAdapter.setmItems(this.files);
        this.filePickerAdapter.notifyDataSetChanged();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ImageUtil.compressAftDelete(this.mContext);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == -1) {
            switch (requestCode) {
                case 129:
                    AssistiveDeviceBean assistiveDeviceBean = (AssistiveDeviceBean) data.getParcelableExtra("assistiveDeviceBean");
                    if (assistiveDeviceBean != null) {
                        this.dataList.add(this.dataList.size() - 1, assistiveDeviceBean);
                        this.adapter.notifyDataSetChanged();
                        break;
                    }
                    break;
                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;
                case 1001:
                    FileBean fileBean = new FileBean(data.getStringExtra(NewHYConfig.EXTRA_FILE_PATH), data.getStringExtra(NewHYConfig.EXTRA_FILE_NAME), 2);
                    this.files.add(fileBean);
                    freshFileData();
                    break;
            }
            super.onActivityResult(requestCode, resultCode, data);
        }
    }

    public void postFileToServer(String id, String type) {
        HashMap<String, String> params = new HashMap<>();
        HashMap<String, String> imgParms = new HashMap<>();
        HashMap<String, String> fileParms = new HashMap<>();
        UserInfo userInfo = MyApplication.getInstance().getUserInfo();
        params.put("relationId", id);
        params.put("style", type);
        if (userInfo != null) {
            params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo.getToken());
        }
        if (this.photos != null) {
            for (int i = 0; i < this.photos.size(); i++) {
                Photo photo = this.photos.get(i);
                if (TextUtil.isEmpty(photo.getId())) {
                    imgParms.put("uploadifyphoto" + i, photo.getUri());
                }
            }
        }
        if (this.files != null) {
            for (int i2 = 0; i2 < this.files.size(); i2++) {
                FileBean fileBean = this.files.get(i2);
                if (TextUtil.isEmpty(fileBean.getId())) {
                    fileParms.put("uploadify_file" + i2, fileBean.getUri());
                }
            }
        }
        AttachUploadTask filePostTask = new AttachUploadTask(RequestServiceList.ATTACHMENT_UPLOAD, params, imgParms, fileParms);
        if (imgParms.size() == 0 && fileParms.size() == 0) {
            TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                @Override
                public void onTishiDialogClicked(DialogInterface dialogInterface, int i3) {
                    MessageEvent messageEvent = new MessageEvent("康复申请提交成功", 10004);
                    EventBus.getDefault().post(messageEvent);
                    AssistiveDeviceApplyActivity.this.finish();
                }
            });
        } else {
            executeRequest(filePostTask);
        }
    }

    public void deleteItem(int position) {
        AssistiveDeviceBean assistiveDeviceBean = this.dataList.get(position);
        if (!TextUtil.isEmpty(assistiveDeviceBean.getId())) {
            assistiveDeviceBean.setDelFlag("1");
            this.dataListTemp.add(assistiveDeviceBean);
        }
        this.dataList.remove(position);
        this.adapter.notifyDataSetChanged();
    }

    public void getAttchFile(String id) {
        if (TextUtil.isEmpty(id)) {
            ToastUtils.showShortToast(this.mContext, "未获取到附件的id");
            return;
        }
        HashMap<String, String> params = new HashMap<>();
        UserInfo userInfo = MyApplication.getInstance().getUserInfo();
        if (userInfo != null) {
            params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo.getToken());
            params.put("relationId", id);
            CommonTask getFileTask = new CommonTask(RequestServiceList.ATTACHMENT_CALLBACK, params);
            executeRequest(getFileTask);
        }
    }

    public void deleteAttchFile(String id) {
        HashMap<String, String> params = new HashMap<>();
        UserInfo userInfo = MyApplication.getInstance().getUserInfo();
        if (userInfo != null) {
            params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo.getToken());
            params.put("id", id);
            CommonTask getFileTask = new CommonTask(RequestServiceList.ATTACHMENT_DELETE, params);
            executeRequest(getFileTask);
        }
    }

    private void initAttachFile() {
        if (this.pickerPhotoAdapter == null) {
            this.pickerPhotoAdapter = new PickerPhotoAdapter(this.mContext, this.photos);
            this.pickerPhotoAdapter.setListener(this);
            this.pickerPhotoAdapter.setEditable("2".equals(this.editType));
            this.mRecycle.setAdapter(this.pickerPhotoAdapter);
        } else {
            this.pickerPhotoAdapter.setEditable("2".equals(this.editType));
            this.pickerPhotoAdapter.setmItems(this.photos);
            this.pickerPhotoAdapter.notifyDataSetChanged();
        }
        if (this.filePickerAdapter == null) {
            this.filePickerAdapter = new FilePickerAdapter(this.mContext, this.files);
            this.filePickerAdapter.setListener(this);
            this.filePickerAdapter.setEditable("2".equals(this.editType));
            this.fileRecycle.setAdapter(this.filePickerAdapter);
            return;
        }
        this.filePickerAdapter.setEditable("2".equals(this.editType));
        this.filePickerAdapter.setmItems(this.files);
        this.filePickerAdapter.notifyDataSetChanged();
    }

    public void getApplyInfo(String id) {
        if (!TextUtils.isEmpty(id)) {
            HashMap<String, String> params = new HashMap<>();
            UserInfo userInfo = MyApplication.getInstance().getUserInfo();
            if (userInfo != null) {
                params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo.getToken());
                params.put("id", id);
                NewHYTask infoApplyTask = new CommonDataListTask(RequestServiceList.GET_FUJU_APPLY_INFO, params, DisabledBaseInfoBean.class);
                executeRequest(infoApplyTask);
            }
        }
    }
}