导航菜单

页面标题

页面副标题

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

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

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


package com.newheyd.JZKFcanjiren.Activity;

import android.os.Bundle;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.igexin.assist.sdk.AssistPushConsts;
import com.newheyd.JZKFcanjiren.Adapter.DemandEvaluateListAdapter;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.Bean.BaseInfoBean;
import com.newheyd.JZKFcanjiren.Bean.RehabilitationBean;
import com.newheyd.JZKFcanjiren.Bean.RehabilitationEffectBean;
import com.newheyd.JZKFcanjiren.Bean.UserInfo;
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.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.ToastUtils;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
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.CommonDataListTask;
import com.newheyd.JZKFcanjiren.net.NewHYTask;
import com.newheyd.JZKFcanjiren.net.RequestServiceList;
import java.util.ArrayList;
import java.util.HashMap;
import org.json.JSONArray;
import org.json.JSONException;

public class DemandEvaluateActivity extends BaseActivity {
    private BaseInfoBean baseInfoBean;
    private String id;
    private ListView mList;
    private TitleView mTitleview;
    private TextView mTvBirth;
    private TextView mTvCert;
    private TextView mTvClass;
    private TextView mTvEndDate;
    private TextView mTvIdcard;
    private TextView mTvLevel;
    private TextView mTvName;
    private TextView mTvNation;
    private TextView mTvSex;
    private TextView mTvStartDate;
    private TextView mTvTeacher;
    private TextView mTvType;
    private RehabilitationBean rehabilitationBean;
    private ArrayList<RehabilitationEffectBean> mData = new ArrayList<>();
    private DemandEvaluateListAdapter evaluateListAdapter = null;
    private UserInfo userInfo = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_demand_evaluate);
        super.onCreate(savedInstanceState);
        this.userInfo = MyApplication.getInstance().getUserInfo();
        getEvaluate();
        goStatistics();
    }

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

    public void getEvaluate() {
        HashMap<String, String> params = new HashMap<>();
        params.put(AssistPushConsts.MSG_TYPE_TOKEN, this.userInfo == null ? "" : this.userInfo.getToken());
        params.put("id", this.id);
        NewHYTask task = new CommonDataListTask(RequestServiceList.SERVICE_SERVICERECORD, params, BaseInfoBean.class);
        executeRequest(task);
    }

    @Override
    public void onResponseBefore(NewHYTask task) {
        switch (task.getService()) {
            case SERVICE_SERVICERECORD:
                showProgress(NewHYConfig.LOADING_HINT, false);
                break;
        }
    }

    @Override
    public void onResponseAfter(NewHYTask task) {
        switch (task.getService()) {
            case SERVICE_SERVICERECORD:
                cancleProgress();
                break;
        }
    }

    @Override
    public void onResponseSuccessful(NewHYTask task, BaseResult object) {
        switch (task.getService()) {
            case SERVICE_SERVICERECORD:
                DataParser<BaseInfoBean> mResult = (DataParser) object;
                if (mResult.getObjects().size() != 0) {
                    this.baseInfoBean = mResult.getObjects().get(0);
                    if (!isNull(mResult.getData2())) {
                        this.rehabilitationBean = new RehabilitationBean(mResult.getData2());
                    }
                    freshData();
                    String data3 = object.getData3();
                    if (!isNull(data3)) {
                        try {
                            JSONArray arrList = new JSONArray(data3);
                            for (int i = 0; i < arrList.length(); i++) {
                                this.mData.add(new RehabilitationEffectBean(arrList.getJSONObject(i)));
                            }
                        } catch (JSONException e) {
                            this.mData.clear();
                        }
                    }
                    freshDataList();
                    break;
                }
                break;
        }
    }

    public void freshData() {
        this.mTvName.setText(this.baseInfoBean.getName());
        this.mTvSex.setText(DataParseUtil.getSex(this.baseInfoBean.getGender()));
        this.mTvNation.setText(DataParseUtil.getMinZu(this.baseInfoBean.getRace()));
        this.mTvBirth.setText(DataUtil.formatDateOther(this.baseInfoBean.getBirthdate()));
        this.mTvIdcard.setText(this.baseInfoBean.getCitizenId());
        this.mTvCert.setText(this.baseInfoBean.getCardNum());
        this.mTvType.setText(DataParseUtil.getIdtKind(this.baseInfoBean.getIdtKind()));
        this.mTvLevel.setText(DataParseUtil.getIdtLevel(this.baseInfoBean.getIdtLevel()));
        if (this.rehabilitationBean != null) {
            this.mTvTeacher.setText(this.rehabilitationBean.getServicePerson());
            this.mTvClass.setText(this.rehabilitationBean.getServiceClass());
            this.mTvStartDate.setText(DataUtil.formatDateOther(this.rehabilitationBean.getStartApplyDate()));
            this.mTvEndDate.setText(DataUtil.formatDateOther(this.rehabilitationBean.getEndApplyDate()));
        }
    }

    public void freshDataList() {
        for (int i = 0; i < this.mData.size(); i++) {
            long id = i + 1;
            this.mData.get(i).setLocalid(id);
        }
        if (this.evaluateListAdapter == null) {
            this.evaluateListAdapter = new DemandEvaluateListAdapter(this.mContext, this.mData, R.layout.item_demand_evaluate);
            this.evaluateListAdapter.setEmptyHintStr("暂无数据");
            this.mList.setAdapter((ListAdapter) this.evaluateListAdapter);
            return;
        }
        this.evaluateListAdapter.notifyDataSetChanged();
    }

    @Override
    public void onResponseError(NewHYTask task, BaseResult object) {
        switch (task.getService()) {
            case SERVICE_SERVICERECORD:
                ToastUtils.showShortToast(this.mContext, object.getMsg());
                break;
        }
    }

    @Override
    public void onServerError(NewHYTask task, int failedType) {
        switch (task.getService()) {
            case SERVICE_SERVICERECORD:
                onResultShow(failedType);
                break;
        }
    }

    @Override
    public void getExtraParam() {
        this.id = getIntent().getStringExtra("id");
    }

    @Override
    public void initViews() {
        this.mTitleview = (TitleView) findViewById(R.id.titleview);
        this.mTvName = (TextView) findViewById(R.id.tv_name);
        this.mTvSex = (TextView) findViewById(R.id.tv_sex);
        this.mTvNation = (TextView) findViewById(R.id.tv_nation);
        this.mTvBirth = (TextView) findViewById(R.id.tv_birth);
        this.mTvIdcard = (TextView) findViewById(R.id.tv_idcard);
        this.mTvCert = (TextView) findViewById(R.id.tv_cert);
        this.mTvType = (TextView) findViewById(R.id.tv_type);
        this.mTvLevel = (TextView) findViewById(R.id.tv_level);
        this.mTvClass = (TextView) findViewById(R.id.tv_class);
        this.mTvTeacher = (TextView) findViewById(R.id.tv_teacher);
        this.mTvStartDate = (TextView) findViewById(R.id.tv_start_date);
        this.mTvEndDate = (TextView) findViewById(R.id.tv_end_date);
        this.mList = (ListView) findViewById(R.id.list);
    }

    @Override
    public void setListener() {
        this.mTitleview.setOnTitleClik(new TitleView.BackListenner() {
            @Override
            public void BackSet() {
                DemandEvaluateActivity.this.finish();
            }
        }, null);
    }
}