导航菜单

页面标题

页面副标题

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

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

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


package com.newheyd.JZKFcanjiren.Activity;

import android.os.Bundle;
import android.widget.TextView;
import com.igexin.assist.sdk.AssistPushConsts;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.Bean.BaseInfoBean;
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.HashMap;

public class BaseInfoActivity extends BaseActivity {
    private TitleView mTitleview;
    private TextView mTvAddress;
    private TextView mTvBirth;
    private TextView mTvCert;
    private TextView mTvCitizen;
    private TextView mTvContract;
    private TextView mTvGuardianName;
    private TextView mTvLevel;
    private TextView mTvName;
    private TextView mTvNation;
    private TextView mTvSex;
    private TextView mTvType;
    private UserInfo userInfo = null;
    private BaseInfoBean baseInfoBean = null;

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

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

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

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

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

    @Override
    public void onResponseSuccessful(NewHYTask task, BaseResult object) {
        switch (task.getService()) {
            case GET_DIS_BASE_INFO:
                DataParser<BaseInfoBean> mResult = (DataParser) object;
                if (mResult.getObjects().size() != 0) {
                    this.baseInfoBean = mResult.getObjects().get(0);
                    freshData();
                    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.mTvCitizen.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()));
        this.mTvGuardianName.setText(this.baseInfoBean.getGuardian());
        this.mTvContract.setText(this.baseInfoBean.getTel());
        this.mTvAddress.setText(this.baseInfoBean.getNowAdd());
    }

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

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

    @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.mTvCitizen = (TextView) findViewById(R.id.tv_citizen);
        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.mTvGuardianName = (TextView) findViewById(R.id.tv_guardian_name);
        this.mTvContract = (TextView) findViewById(R.id.tv_contract);
        this.mTvAddress = (TextView) findViewById(R.id.tv_address);
    }

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