导航菜单

页面标题

页面副标题

Easycash v3.75.13 - ECChangePasswordActivity.java 源代码

正在查看: Easycash v3.75.13 应用的 ECChangePasswordActivity.java JAVA 源代码文件

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


package com.lingyue.easycash.account;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.lingyue.easycash.R;
import com.lingyue.easycash.account.model.UserResponse;
import com.lingyue.easycash.commom.EasyCashCommonActivity;
import com.lingyue.easycash.models.EventLoginOrRegisterEnd;
import com.lingyue.easycash.models.UserGlobal;
import com.lingyue.easycash.utils.EasycashUmengEvent;
import com.lingyue.easycash.utils.YqdUtils;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.model.IdnObserver;
import com.lingyue.idnbaselib.model.SdkType;
import com.lingyue.idnbaselib.utils.FieldRuleUtils;
import com.lingyue.idnbaselib.utils.ThirdPartEventUtils;
import com.lingyue.supertoolkit.resourcetools.SharedPreferenceUtils;
import com.lingyue.supertoolkit.widgets.BaseUtils;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import org.greenrobot.eventbus.EventBus;

public class ECChangePasswordActivity extends EasyCashCommonActivity implements TextWatcher {
    private String B = "paramMobileNumber";
    private String C;

    @BindView(R.id.btn_set_new_password)
    Button btnSetNewPassword;

    @BindView(R.id.cb_new_password_eye)
    CheckBox cbNewPasswordEye;

    @BindView(R.id.cb_old_password_eye)
    CheckBox cbOldPasswordEye;

    @BindView(R.id.cb_re_enter_password_eye)
    CheckBox cbReEnterPasswordEye;

    @BindView(R.id.et_new_password)
    EditText etNewPassword;

    @BindView(R.id.et_old_password)
    EditText etOldPassword;

    @BindView(R.id.et_re_enter_new_password)
    EditText etReEnterNewPassword;

    private boolean U() {
        String obj = this.etOldPassword.getText().toString();
        if (TextUtils.isEmpty(obj)) {
            BaseUtils.p(this, getString(R.string.please_input_old_password));
            showSoftInput(this.etOldPassword);
            return false;
        }
        if (obj.length() < 6 || obj.length() > 32) {
            BaseUtils.p(this, getString(R.string.please_input_old_password_limit_six));
            showSoftInput(this.etOldPassword);
            return false;
        }
        String obj2 = this.etNewPassword.getText().toString();
        if (TextUtils.isEmpty(obj2)) {
            BaseUtils.p(this, getString(R.string.please_input_new_password));
            showSoftInput(this.etNewPassword);
            return false;
        }
        if (obj2.length() < 6 || obj2.length() > 32) {
            BaseUtils.p(this, getString(R.string.please_set_password_from_6_to_32));
            showSoftInput(this.etNewPassword);
            return false;
        }
        String obj3 = this.etReEnterNewPassword.getText().toString();
        if (TextUtils.isEmpty(obj3)) {
            BaseUtils.p(this, getString(R.string.please_input_new_password));
            showSoftInput(this.etReEnterNewPassword);
            return false;
        }
        if (obj3.length() < 6 || obj3.length() > 32) {
            BaseUtils.p(this, getString(R.string.please_set_password_from_6_to_32));
            showSoftInput(this.etReEnterNewPassword);
            return false;
        }
        if (obj2.equals(obj3)) {
            return true;
        }
        BaseUtils.p(this, getString(R.string.easycash_re_enter_passwords_differ_from_the_another));
        showSoftInput(this.etReEnterNewPassword);
        return false;
    }

    private void V() {
        this.etNewPassword.addTextChangedListener(this);
        this.etOldPassword.addTextChangedListener(this);
        this.etReEnterNewPassword.addTextChangedListener(this);
        this.cbOldPasswordEye.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
                ECChangePasswordActivity.this.X(compoundButton, z2);
            }
        });
        this.cbNewPasswordEye.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
                ECChangePasswordActivity.this.Y(compoundButton, z2);
            }
        });
        this.cbReEnterPasswordEye.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
                ECChangePasswordActivity.this.Z(compoundButton, z2);
            }
        });
    }

    private boolean W() {
        return FieldRuleUtils.d(this.etOldPassword.getText().toString()) && FieldRuleUtils.d(this.etNewPassword.getText().toString()) && FieldRuleUtils.d(this.etReEnterNewPassword.getText().toString());
    }

    @SensorsDataInstrumented
    public void X(CompoundButton compoundButton, boolean z2) {
        if (z2) {
            this.etOldPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
        } else {
            this.etOldPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
        }
        EditText editText = this.etOldPassword;
        editText.setSelection(editText.getText().length());
        SensorsDataAutoTrackHelper.trackViewOnClick(compoundButton);
        AutoTrackHelper.b(compoundButton, z2);
    }

    @SensorsDataInstrumented
    public void Y(CompoundButton compoundButton, boolean z2) {
        if (z2) {
            this.etNewPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
        } else {
            this.etNewPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
        }
        EditText editText = this.etNewPassword;
        editText.setSelection(editText.getText().length());
        SensorsDataAutoTrackHelper.trackViewOnClick(compoundButton);
        AutoTrackHelper.b(compoundButton, z2);
    }

    @SensorsDataInstrumented
    public void Z(CompoundButton compoundButton, boolean z2) {
        if (z2) {
            this.etReEnterNewPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
        } else {
            this.etReEnterNewPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
        }
        EditText editText = this.etReEnterNewPassword;
        editText.setSelection(editText.getText().length());
        SensorsDataAutoTrackHelper.trackViewOnClick(compoundButton);
        AutoTrackHelper.b(compoundButton, z2);
    }

    public void a0(UserResponse userResponse) {
        BaseUtils.p(getApplicationContext(), getString(R.string.modify_success));
        saveUserResponse(userResponse);
        UserGlobal b = this.userSession.b();
        b.mobileNumber = this.C;
        this.userSession.i(b);
        SharedPreferenceUtils.J(this, "userMobile", this.C);
        SharedPreferenceUtils.J(this, "lastSdkType", SdkType.IDN_YQD.name());
        EventBus.c().k(new EventLoginOrRegisterEnd(true));
        finish();
    }

    private void b0() {
        showLoadingDialog();
        this.apiHelper.a().H(this.etOldPassword.getText().toString(), this.etNewPassword.getText().toString()).K(AndroidSchedulers.a()).a(new IdnObserver<UserResponse>(this) {
            @Override
            public void onSuccess(UserResponse userResponse) {
                ECChangePasswordActivity.this.dismissLoadingDialog();
                ECChangePasswordActivity.this.a0(userResponse);
            }
        });
    }

    private void saveUserResponse(UserResponse userResponse) {
        UserGlobal b = this.userSession.b();
        UserResponse.Body body = userResponse.body;
        b.userName = body.name;
        b.mobileNumber = body.mobileNumber;
        b.updateTraceId(body.traceId);
        this.userSession.i(b);
    }

    public static void startECChangePasswordActivity(Activity activity) {
        activity.startActivity(new Intent(activity, (Class<?>) ECChangePasswordActivity.class));
    }

    @Override
    protected void B(@NonNull Bundle bundle) {
        super.B(bundle);
        this.C = bundle.getString(this.B);
    }

    @Override
    protected void D() {
        this.f.setBackgroundColor(0);
        YqdUtils.y(this.etOldPassword);
        YqdUtils.y(this.etNewPassword);
        YqdUtils.y(this.etReEnterNewPassword);
        V();
    }

    @Override
    protected void N(@NonNull Bundle bundle) {
        super.N(bundle);
        bundle.putString(this.B, this.C);
    }

    @Override
    public void afterTextChanged(Editable editable) {
        this.btnSetNewPassword.setEnabled(W());
    }

    @Override
    public int getLayoutID() {
        return R.layout.easycash_activity_change_password;
    }

    @OnClick({R.id.btn_set_new_password})
    public void modifyPasswordConfirm(View view) {
        if (BaseUtils.l()) {
            return;
        }
        ThirdPartEventUtils.y(this, EasycashUmengEvent.K);
        if (U()) {
            b0();
        }
    }

    @Override
    public Disposable runOnActiveEvent(Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.a(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnCreated(@NonNull Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.b(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnDestroy(@NonNull Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.c(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.d(this, lifecycleEvent, runnable);
    }

    @Override
    public Disposable runOnEvents(@NonNull LifecycleEvent[] lifecycleEventArr, @Nullable Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.e(this, lifecycleEventArr, runnable);
    }

    @Override
    protected void z() {
        this.C = this.userSession.b().mobileNumber;
    }

    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
    }

    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
    }
}