导航菜单

页面标题

页面副标题

Easycash v3.75.13 - SetPasswordActivity.java 源代码

正在查看: Easycash v3.75.13 应用的 SetPasswordActivity.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.text.Editable;
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 android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.fintopia.lender.R;
import com.fintopia.lender.module.account.widget.OtpGetter;
import com.fintopia.lender.module.baseui.LenderCommonActivity;
import com.fintopia.lender.module.events.SetPasswordEvent;
import com.fintopia.lender.module.launch.AppGeneralConfigUtils;
import com.fintopia.lender.module.network.ILenderApiRoutes;
import com.fintopia.lender.module.security.OtpPurpose;
import com.fintopia.lender.module.utils.YqdUtils;
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.response.BooleanResponse;
import com.lingyue.idnbaselib.utils.EcFormatUtil;
import com.lingyue.idnbaselib.utils.FieldRuleUtils;
import com.lingyue.idnbaselib.utils.VerificationType;
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.infrastructure.BaseActivity;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import java.text.MessageFormat;
import org.greenrobot.eventbus.EventBus;

public class SetPasswordActivity extends LenderCommonActivity implements TextWatcher {

    @BindView(4696)
    Button btnGetVerificationCode;

    @BindView(4712)
    Button btnSetPassword;

    @BindView(4735)
    CheckBox cbPasswordEye;

    @BindView(4737)
    CheckBox cbReEnterPasswordEye;

    @BindView(4895)
    EditText etPassword;

    @BindView(4898)
    EditText etReEnterPassword;

    @BindView(4903)
    VerificationCodeEditText etVerificationCode;

    @BindView(5138)
    LinearLayout llIVR;

    @BindView(5686)
    TextView tvIvrCountDown;

    @BindView(5912)
    TextView tvTryVerification;

    private String f23u;

    private OtpGetter f24v;

    private CustomCountDownTimer f25w;

    int f26x;

    private void Q() {
        LenderDoubleContentSingleButtonDialog.d(this).l("dialog_lender_ivr_verification_set_pwd").k(getString(R.string.lender_ivr_verification_dlg_title)).h(MessageFormat.format(getString(R.string.lender_ivr_verification_dlg_content), EcFormatUtil.u(this.f23u))).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) {
                SetPasswordActivity.this.T(dialogInterface, i);
            }
        }).show();
    }

    private void R() {
        this.etVerificationCode.addTextChangedListener(this);
        this.etPassword.addTextChangedListener(this);
        this.etReEnterPassword.addTextChangedListener(this);
        this.cbPasswordEye.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                SetPasswordActivity.this.U(compoundButton, z);
            }
        });
        this.cbReEnterPasswordEye.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                SetPasswordActivity.this.V(compoundButton, z);
            }
        });
    }

    private boolean S() {
        return FieldRuleUtils.h(this.etVerificationCode.getVerificationCode()) && FieldRuleUtils.d(this.etPassword.getText().toString()) && FieldRuleUtils.d(this.etReEnterPassword.getText().toString());
    }

    public void T(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        this.f24v.t(this.f23u, VerificationType.IVR);
    }

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

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

    public String W() {
        return this.f23u;
    }

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

    private void Y() {
        showLoadingDialog();
        ((ILenderApiRoutes) this.apiHelper.a()).t(this.etVerificationCode.getVerificationCode(), this.etPassword.getText().toString()).K(AndroidSchedulers.a()).a(new IdnObserver<BooleanResponse>(this) {
            public void onSuccess(BooleanResponse booleanResponse) {
                SetPasswordActivity.this.dismissLoadingDialog();
                SetPasswordActivity.this.userSession.b().c = booleanResponse.body;
                EventBus.c().k(new SetPasswordEvent());
                SetPasswordActivity.this.finish();
            }
        });
    }

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

    public void dealGetOtpSuccess(VerificationType verificationType) {
        showSoftInput(this.etVerificationCode);
        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() {
                SetPasswordActivity.this.btnGetVerificationCode.setEnabled(true);
                SetPasswordActivity.this.btnGetVerificationCode.setBackgroundResource(R.drawable.lender_shape_blue_r_8);
                SetPasswordActivity.this.tvIvrCountDown.setVisibility(8);
                SetPasswordActivity setPasswordActivity = SetPasswordActivity.this;
                setPasswordActivity.tvTryVerification.setTextColor(setPasswordActivity.getResources().getColor(R.color.c_base_blue));
                SetPasswordActivity.this.llIVR.setClickable(true);
            }

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

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

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

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

    @Override
    protected void A() {
        ((BaseActivity) this).f.setBackgroundColor(0);
        YqdUtils.l(this.etPassword);
        YqdUtils.l(this.etReEnterPassword);
        R();
        initOtpGetter();
        X();
    }

    @Override
    public void afterTextChanged(Editable editable) {
        this.btnSetPassword.setEnabled(S());
    }

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

    @OnClick({4712})
    public void modifyPasswordConfirm(View view) {
        if (BaseUtils.l()) {
            return;
        }
        if (this.etPassword.getText().toString().equals(this.etReEnterPassword.getText().toString())) {
            Y();
        } else {
            BaseUtils.p(this, getString(R.string.lender_re_enter_passwords_differ_from_the_another));
            showSoftInput(this.etReEnterPassword);
        }
    }

    public void onBackPressed() {
        super/*androidx.activity.ComponentActivity*/.onBackPressed();
        EventBus.c().k(new SetPasswordEvent());
    }

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

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

    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.f23u = this.userSession.b().b;
    }

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

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