导航菜单

页面标题

页面副标题

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

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

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


package com.newheyd.JZKFcanjiren.Activity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.igexin.assist.sdk.AssistPushConsts;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.Utils.RegexUtils;
import com.newheyd.JZKFcanjiren.Utils.SharedPreferencedUtils;
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.net.CommonTask;
import com.newheyd.JZKFcanjiren.net.NewHYTask;
import com.newheyd.JZKFcanjiren.net.RequestServiceList;
import java.util.HashMap;

public class ActivityChangePwd extends BaseActivity implements View.OnClickListener {
    private Button mBtChanege;
    private EditText mEtNewPwd;
    private EditText mEtNewPwdAgain;
    private EditText mEtOldPwd;
    private TitleView mTitleView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_change_pwd);
        super.onCreate(savedInstanceState);
        goStatistics();
    }

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

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

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

    @Override
    public void onResponseSuccessful(NewHYTask task, BaseResult object) {
        switch (task.getService()) {
            case DISABLED_UPDATEPWD:
                SharedPreferencedUtils.getInstance(this.mContext).remove(AssistPushConsts.MSG_TYPE_TOKEN);
                SharedPreferencedUtils.getInstance(this.mContext).putString("password", task.getParamsMap().get("newPassword"));
                ToastUtils.showShortToast(this.mContext, "密码修改成功");
                this.mTitleView.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        ActivityChangePwd.this.ReLogin();
                        ActivityChangePwd.this.finish();
                    }
                }, 300L);
                break;
        }
    }

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

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

    @Override
    public void initViews() {
        this.mTitleView = (TitleView) findViewById(R.id.titleview_mine_aqzhongxin);
        this.mTitleView.setOnTitleClik(new TitleView.BackListenner() {
            @Override
            public void BackSet() {
                ActivityChangePwd.this.finish();
            }
        }, null);
        this.mEtOldPwd = (EditText) findViewById(R.id.et_old_pwd);
        this.mEtNewPwd = (EditText) findViewById(R.id.et_new_pwd);
        this.mEtNewPwdAgain = (EditText) findViewById(R.id.et_new_pwd_again);
        this.mBtChanege = (Button) findViewById(R.id.bt_change);
    }

    @Override
    public void setListener() {
        this.mBtChanege.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bt_change:
                if (isNull(this.mEtOldPwd.getText().toString())) {
                    ToastUtils.showShortToast(this.mContext, "请输入旧密码");
                    break;
                } else if (isNull(this.mEtNewPwd.getText().toString())) {
                    ToastUtils.showShortToast(this.mContext, "请输入新密码");
                    break;
                } else if (isNull(this.mEtNewPwdAgain.getText().toString())) {
                    ToastUtils.showShortToast(this.mContext, "请输入确认新密码");
                    break;
                } else if (!this.mEtNewPwd.getText().toString().equals(this.mEtNewPwdAgain.getText().toString())) {
                    ToastUtils.showShortToast(this.mContext, "两次输入新密码不一致,请重新输入");
                    break;
                } else {
                    String hint = RegexUtils.judgePassword(this.mContext, this.mEtNewPwdAgain.getText().toString());
                    if (!isNull(hint)) {
                        ToastUtils.showLongToast(this.mContext, hint);
                        break;
                    } else {
                        HashMap<String, String> params = new HashMap<>();
                        params.put(AssistPushConsts.MSG_TYPE_TOKEN, SharedPreferencedUtils.getInstance(this.mContext).getString(AssistPushConsts.MSG_TYPE_TOKEN));
                        params.put("password", this.mEtOldPwd.getText().toString());
                        params.put("newPassword", this.mEtNewPwdAgain.getText().toString());
                        NewHYTask task = new CommonTask(RequestServiceList.DISABLED_UPDATEPWD, params);
                        executeRequest(task);
                        break;
                    }
                }
        }
    }
}