导航菜单

页面标题

页面副标题

Easycash v3.75.13 - ForgetPasswordActivity.java 源代码

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

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


package com.fintopia.lender.module.account;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group;
import butterknife.BindView;
import butterknife.OnClick;
import com.fintopia.lender.R;
import com.fintopia.lender.module.account.model.ForgetPasswordResponse;
import com.fintopia.lender.module.account.widget.OtpGetter;
import com.fintopia.lender.module.baseui.LenderCommonActivity;
import com.fintopia.lender.module.events.EventUserLoginOrRegisterSuccess;
import com.fintopia.lender.module.launch.AppGeneralConfigUtils;
import com.fintopia.lender.module.maintab.MainActivity;
import com.fintopia.lender.module.network.ILenderApiRoutes;
import com.fintopia.lender.module.security.OtpPurpose;
import com.fintopia.lender.widget.LenderDoubleContentSingleButtonDialog;
import com.fintopia.lender.widget.VerificationCodeEditText;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.model.IdnObserver;
import com.lingyue.idnbaselib.model.SdkType;
import com.lingyue.idnbaselib.utils.EcFormatUtil;
import com.lingyue.idnbaselib.utils.FieldRuleUtils;
import com.lingyue.idnbaselib.utils.VerificationType;
import com.lingyue.idnbaselib.widget.editTextBridge.separatorEditText.KtpEditText;
import com.lingyue.idnbaselib.widget.editTextBridge.separatorEditText.MobileEditText;
import com.lingyue.supertoolkit.resourcetools.SharedPreferenceUtils;
import com.lingyue.supertoolkit.widgets.BaseUtils;
import com.lingyue.supertoolkit.widgets.countdown.CustomCountDownTimer;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.veda.android.bananalibrary.net.ICallBack;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.disposables.Disposable;
import java.text.MessageFormat;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

public class ForgetPasswordActivity extends LenderCommonActivity implements TextWatcher {
    int A;

    @BindView(4693)
    Button btnConfirm;

    @BindView(4696)
    Button btnGetVerificationCode;

    @BindView(4733)
    CheckBox cbNewPasswordEye;

    @BindView(4737)
    CheckBox cbReEnterPasswordEye;

    @BindView(4880)
    VerificationCodeEditText etDigitCode;

    @BindView(4884)
    KtpEditText etIdentityNumber;

    @BindView(4891)
    EditText etNewPassword;

    @BindView(4896)
    MobileEditText etPhoneNumber;

    @BindView(4897)
    EditText etReEnterNewPassword;

    @BindView(4953)
    Group groupIdentityNumber;

    @BindView(5138)
    LinearLayout llIVR;

    @BindView(5686)
    TextView tvIvrCountDown;

    @BindView(5912)
    TextView tvTryVerification;

    private String f3u;

    private String f4v;

    private OtpGetter f5w;

    private boolean f6x;
    private boolean y;
    private CustomCountDownTimer z;

    private void U() {
        LenderDoubleContentSingleButtonDialog.d(this).l("dialog_lender_ivr_verification_forget_pwd").k(getString(R.string.lender_ivr_verification_dlg_title)).h(MessageFormat.format(getString(R.string.lender_ivr_verification_dlg_content), EcFormatUtil.u(this.f3u))).j(getString(R.string.lender_ivr_verification_dlg_sub_content)).g(R.string.lender_ivr_dlg_call).i(new LenderDoubleContentSingleButtonDialog.OnDoubleContentDialogButtonClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                ForgetPasswordActivity.this.b0(dialogInterface, i);
            }
        }).show();
    }

    private String V(EditText editText) {
        return editText.getText().toString().trim();
    }

    private void W() {
        this.etPhoneNumber.addTextChangedListener(this);
        this.etIdentityNumber.addTextChangedListener(this);
        this.etDigitCode.addTextChangedListener(this);
        this.etDigitCode.setOnCheckVerificationListener(new VerificationCodeEditText.OnCheckVerificationListener() {
            @Override
            public final void onCheckVerification(String str) {
                ForgetPasswordActivity.this.c0(str);
            }
        });
        this.etNewPassword.addTextChangedListener(this);
        this.etReEnterNewPassword.addTextChangedListener(this);
        this.cbNewPasswordEye.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                ForgetPasswordActivity.this.d0(compoundButton, z);
            }
        });
        this.cbReEnterPasswordEye.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                ForgetPasswordActivity.this.e0(compoundButton, z);
            }
        });
    }

    private boolean X() {
        return isPhoneNumberValid() && (!this.f6x || Y()) && FieldRuleUtils.h(this.etDigitCode.getVerificationCode()) && Z(this.etNewPassword) && Z(this.etReEnterNewPassword);
    }

    private boolean Y() {
        return FieldRuleUtils.c(this.etIdentityNumber.getTrimmedText().trim());
    }

    private boolean Z(EditText editText) {
        return FieldRuleUtils.d(V(editText));
    }

    public void a0() {
        showSoftInput(this.etDigitCode);
    }

    public void b0(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        this.f5w.t(this.f3u, VerificationType.IVR);
    }

    public void c0(String str) {
        showSoftInput(this.etNewPassword);
    }

    @SensorsDataInstrumented
    public void d0(CompoundButton compoundButton, boolean z) {
        if (z) {
            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, z);
    }

    public void dealGetOtpSuccess(VerificationType verificationType) {
        this.etDigitCode.postDelayed(new Runnable() {
            @Override
            public final void run() {
                ForgetPasswordActivity.this.a0();
            }
        }, 100L);
        this.llIVR.setClickable(false);
        this.tvTryVerification.setTextColor(getResources().getColor(R.color.c_base_light_black));
        if (verificationType == VerificationType.SMS) {
            this.tvIvrCountDown.setVisibility(8);
            return;
        }
        this.btnGetVerificationCode.setEnabled(false);
        this.btnGetVerificationCode.setBackgroundResource(R.drawable.base_shape_mid_gray_r_8);
        this.tvIvrCountDown.setVisibility(0);
        CustomCountDownTimer customCountDownTimer = new CustomCountDownTimer(60000L, 1000L) {
            public void e() {
                ForgetPasswordActivity.this.btnGetVerificationCode.setEnabled(true);
                ForgetPasswordActivity.this.btnGetVerificationCode.setBackgroundResource(R.drawable.lender_shape_blue_r_8);
                ForgetPasswordActivity.this.tvIvrCountDown.setVisibility(8);
                ForgetPasswordActivity forgetPasswordActivity = ForgetPasswordActivity.this;
                forgetPasswordActivity.tvTryVerification.setTextColor(forgetPasswordActivity.getResources().getColor(R.color.c_base_blue));
                ForgetPasswordActivity.this.llIVR.setClickable(true);
            }

            public void f(long j) {
                ?? r0 = ForgetPasswordActivity.this;
                r0.tvIvrCountDown.setText(String.format(r0.getString(R.string.ec_count_down_second), Long.valueOf(j / 1000)));
            }
        };
        this.z = customCountDownTimer;
        customCountDownTimer.g();
    }

    @SensorsDataInstrumented
    public void e0(CompoundButton compoundButton, boolean z) {
        if (z) {
            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, z);
    }

    public String f0() {
        return this.f3u;
    }

    private void g0() {
        int i = AppGeneralConfigUtils.o().q().displayTipsRetryNumber;
        this.A = i;
        renderIVRVerificationView(i <= 0);
    }

    private void h0() {
        showLoadingDialog();
        ((ILenderApiRoutes) this.apiHelper.a()).r0(this.etPhoneNumber.getTrimmedText(), this.etDigitCode.getVerificationCode(), this.etNewPassword.getText().toString().trim(), this.etIdentityNumber.getTrimmedText(), SdkType.IDN_FIN.name()).a(new IdnObserver<ForgetPasswordResponse>(getCallBack()) {
            public void onSuccess(ForgetPasswordResponse forgetPasswordResponse) {
                ForgetPasswordActivity.this.dismissLoadingDialog();
                ICallBack iCallBack = ForgetPasswordActivity.this;
                BaseUtils.s(iCallBack, iCallBack.getString(R.string.lender_reset_password_successfully));
                ForgetPasswordActivity.this.userSession.b().b = forgetPasswordResponse.body.mobileNumber;
                ForgetPasswordActivity.this.userSession.b().d(forgetPasswordResponse.body.traceId);
                SharedPreferenceUtils.J(ForgetPasswordActivity.this, "lastSdkType", SdkType.IDN_FIN.name());
                EventBus.c().k(new EventUserLoginOrRegisterSuccess(false));
                if (ForgetPasswordActivity.this.y) {
                    ForgetPasswordActivity.this.startActivity(MainActivity.IntentBuilder.e(ForgetPasswordActivity.this).b(ForgetPasswordActivity.this.f4v).a());
                }
                ForgetPasswordActivity.this.finish();
            }
        });
    }

    public void i0() {
        int i = this.A - 1;
        this.A = i;
        if (i == 0) {
            renderIVRVerificationView(true);
        }
    }

    private void initOtpGetter() {
        OtpGetter otpGetter = new OtpGetter(this);
        this.f5w = otpGetter;
        otpGetter.h(this.btnGetVerificationCode, VerificationType.SMS.name(), OtpPurpose.FORGET_PASSWORD, new OtpGetter.Provider() {
            @Override
            public final String a() {
                String f0;
                f0 = ForgetPasswordActivity.this.f0();
                return f0;
            }
        }, new OtpGetter.Callback() {
            @Override
            public void a(VerificationType verificationType) {
                ForgetPasswordActivity.this.dealGetOtpSuccess(verificationType);
            }

            @Override
            public void b(VerificationType verificationType) {
                ForgetPasswordActivity.this.i0();
                ForgetPasswordActivity.this.llIVR.setClickable(true);
                ForgetPasswordActivity.this.tvIvrCountDown.setVisibility(8);
                ForgetPasswordActivity forgetPasswordActivity = ForgetPasswordActivity.this;
                forgetPasswordActivity.tvTryVerification.setTextColor(forgetPasswordActivity.getResources().getColor(R.color.c_base_blue));
            }
        }, null);
    }

    private boolean isPhoneNumberValid() {
        return FieldRuleUtils.e(this.etPhoneNumber.getTrimmedText().trim());
    }

    public static void startForgetPasswordActivity(Activity activity, @NonNull String str, String str2, boolean z, boolean z2) {
        Intent intent = new Intent(activity, (Class<?>) ForgetPasswordActivity.class);
        intent.putExtra("phoneNumberValue", str);
        intent.putExtra("hasIdentityNumber", z);
        intent.putExtra("redirect_url", str2);
        intent.putExtra("finishJumpToMain", z2);
        activity.startActivity(intent);
    }

    @Override
    protected void A() {
        super.A();
        W();
        initOtpGetter();
        this.groupIdentityNumber.setVisibility(this.f6x ? 0 : 8);
        g0();
    }

    @Override
    protected void G(@NonNull Bundle bundle) {
        super.G(bundle);
        bundle.putString("phoneNumberValue", this.etPhoneNumber.getTrimmedText());
        bundle.putString("redirect_url", this.f4v);
        bundle.putBoolean("hasIdentityNumber", this.f6x);
        bundle.putBoolean("finishJumpToMain", this.y);
    }

    @Override
    @NonNull
    protected String H() {
        return this.etPhoneNumber.getTrimmedText();
    }

    @Override
    public void afterTextChanged(Editable editable) {
        this.btnConfirm.setEnabled(X());
    }

    @OnClick({4693})
    protected void clickConfirmBtn() {
        if (BaseUtils.l()) {
            return;
        }
        if (this.etNewPassword.getText().toString().trim().equals(this.etReEnterNewPassword.getText().toString().trim())) {
            h0();
        } else {
            BaseUtils.p(this, getString(R.string.lender_re_enter_passwords_differ_from_the_another));
            showSoftInput(this.etReEnterNewPassword);
        }
    }

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

    @OnClick({5138})
    public void onClickIVR() {
        if (BaseUtils.l()) {
            return;
        }
        U();
    }

    @Override
    protected void onDestroy() {
        OtpGetter otpGetter = this.f5w;
        if (otpGetter != null) {
            otpGetter.n();
        }
        CustomCountDownTimer customCountDownTimer = this.z;
        if (customCountDownTimer != null) {
            customCountDownTimer.i();
        }
        super.onDestroy();
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onReceiveEventRegister(EventUserLoginOrRegisterSuccess eventUserLoginOrRegisterSuccess) {
        finish();
    }

    public void renderIVRVerificationView(boolean z) {
        if (z) {
            this.llIVR.setVisibility(0);
        } else {
            this.llIVR.setVisibility(8);
        }
    }

    @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 w() {
        this.etPhoneNumber.setText(this.f3u);
    }

    @Override
    protected void y(@NonNull Bundle bundle) {
        super.y(bundle);
        this.f3u = bundle.getString("phoneNumberValue", "");
        this.f4v = bundle.getString("redirect_url", "");
        this.f6x = bundle.getBoolean("hasIdentityNumber", false);
        this.y = bundle.getBoolean("finishJumpToMain", true);
    }

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

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