导航菜单

页面标题

页面副标题

Easycash v3.75.13 - ECQuickPayingBankOtpAct.java 源代码

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

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


package com.lingyue.easycash.business.quickrepay;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.bumptech.glide.Glide;
import com.lingyue.easycash.R;
import com.lingyue.easycash.business.quickrepay.ECQuickPayingBankOtpAct;
import com.lingyue.easycash.business.webevent.WebEvent;
import com.lingyue.easycash.business.webevent.WebEventManager;
import com.lingyue.easycash.commom.EasyCashCommonActivity;
import com.lingyue.easycash.models.event.QuickRepayNewCardBindEvent;
import com.lingyue.easycash.models.response.DirectDebitAccountLinkResponse;
import com.lingyue.easycash.models.response.DirectDebitBankInfo;
import com.lingyue.easycash.utils.EasycashUmengEvent;
import com.lingyue.easycash.utils.SensorTrackEvent;
import com.lingyue.easycash.widght.EasycashQuickRepaymentDialog;
import com.lingyue.easycash.widght.VerificationInputCodeView;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.model.IdnBaseResult;
import com.lingyue.idnbaselib.model.IdnObserver;
import com.lingyue.idnbaselib.utils.EcFormatUtil;
import com.lingyue.idnbaselib.utils.JsonParamsBuilder;
import com.lingyue.idnbaselib.utils.ThirdPartEventUtils;
import com.lingyue.supertoolkit.rxjavatools.RxUtil;
import com.lingyue.supertoolkit.widgets.BaseUtils;
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.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import java.text.MessageFormat;
import java.util.concurrent.TimeUnit;
import org.greenrobot.eventbus.EventBus;

public class ECQuickPayingBankOtpAct extends EasyCashCommonActivity {
    private int C;
    private Disposable K;
    private Runnable O;

    @BindView(R.id.btn_get_verification_code)
    Button btnGetVerificationCode;

    @BindView(R.id.icv_verification_code)
    VerificationInputCodeView icvVerificationInputCode;

    @BindView(R.id.iv_bankcard_logo)
    ImageView ivBankcardLogo;

    @BindView(R.id.tv_tip)
    TextView tvTip;

    @BindView(R.id.tv_validity)
    TextView tvValidity;
    private String B = "";
    private String D = "";
    private String E = "";
    private String F = "";
    private final int G = 120;
    private final int H = 600001;
    private final int I = 600002;
    private final int J = 5;
    private int L = 0;
    private int M = 2000;
    private Handler N = new Handler();

    class AnonymousClass1 extends IdnObserver<DirectDebitAccountLinkResponse> {
        AnonymousClass1(ICallBack iCallBack) {
            super(iCallBack);
        }

        public void b() {
            ECQuickPayingBankOtpAct eCQuickPayingBankOtpAct = ECQuickPayingBankOtpAct.this;
            eCQuickPayingBankOtpAct.showSoftInput(eCQuickPayingBankOtpAct.icvVerificationInputCode.getEditText());
        }

        @Override
        public void onSuccess(DirectDebitAccountLinkResponse directDebitAccountLinkResponse) {
            ECQuickPayingBankOtpAct.this.v0();
            ECQuickPayingBankOtpAct.this.icvVerificationInputCode.getEditText().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    ECQuickPayingBankOtpAct.AnonymousClass1.this.b();
                }
            }, 100L);
            ECQuickPayingBankOtpAct.this.dismissLoadingDialog();
        }
    }

    private void d0() {
        this.L = 0;
        this.icvVerificationInputCode.d();
        BaseUtils.p(this, getString(R.string.easycash_quick_repay_card_binding));
        dismissLoadingDialog();
    }

    private void e0(String str) {
        Glide.with(getContext()).load(str).into(this.ivBankcardLogo);
    }

    private void f0() {
        this.icvVerificationInputCode.h();
        this.icvVerificationInputCode.requestFocus();
        this.icvVerificationInputCode.setOnCompleteListener(new VerificationInputCodeView.OnCompleteListener() {
            @Override
            public final void a(String str) {
                ECQuickPayingBankOtpAct.this.h0(str);
            }
        });
        this.icvVerificationInputCode.getEditText().postDelayed(new Runnable() {
            @Override
            public final void run() {
                ECQuickPayingBankOtpAct.this.i0();
            }
        }, 200L);
    }

    private void g0() {
        this.a.setVisibility(this.userSession.f().showCustomerService ? 0 : 8);
        this.a.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                ECQuickPayingBankOtpAct.this.j0(view);
            }
        });
    }

    public void h0(String str) {
        if (TextUtils.isEmpty(str) || str.length() != 6) {
            return;
        }
        hideSoftInput();
        showLoadingDialog();
        r0(this.C, str);
    }

    public void i0() {
        showSoftInput(this.icvVerificationInputCode.getEditText());
    }

    @SensorsDataInstrumented
    public void j0(View view) {
        if (BaseUtils.l()) {
            SensorsDataAutoTrackHelper.trackViewOnClick(view);
            AutoTrackHelper.trackViewOnClick(view);
        } else {
            openCustomerService();
            SensorsDataAutoTrackHelper.trackViewOnClick(view);
            AutoTrackHelper.trackViewOnClick(view);
        }
    }

    @SensorsDataInstrumented
    public void l0(DialogInterface dialogInterface, int i) {
        if (BaseUtils.l()) {
            SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
            AutoTrackHelper.trackViewOnClick(dialogInterface, i);
        } else {
            finish();
            SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
            AutoTrackHelper.trackViewOnClick(dialogInterface, i);
        }
    }

    public Long m0(Long l) throws Exception {
        return Long.valueOf(120 - l.longValue());
    }

    public void k0(DirectDebitAccountLinkResponse directDebitAccountLinkResponse) {
        if (DirectDebitAccountLinkResponse.STATUS.fromName(directDebitAccountLinkResponse.body.status) != DirectDebitAccountLinkResponse.STATUS.ENABLED) {
            t0(directDebitAccountLinkResponse.body.accountId);
            return;
        }
        dismissLoadingDialog();
        EventBus.c().n(new QuickRepayNewCardBindEvent());
        WebEventManager.e().h(new WebEvent("Native", "quickRepaymentBindNewCard", "true", false));
        DirectDebitAccountLinkResponse.Body body = directDebitAccountLinkResponse.body;
        u0(body.bankBasicInfo, body.maskedAccountNumber);
    }

    private void p0(@NonNull final DirectDebitAccountLinkResponse directDebitAccountLinkResponse) {
        this.N.removeCallbacksAndMessages(null);
        Runnable runnable = new Runnable() {
            @Override
            public final void run() {
                ECQuickPayingBankOtpAct.this.k0(directDebitAccountLinkResponse);
            }
        };
        this.O = runnable;
        this.N.postDelayed(runnable, this.M);
    }

    public void q0() {
        this.btnGetVerificationCode.setEnabled(true);
        this.btnGetVerificationCode.setText(getString(2131886866));
        this.btnGetVerificationCode.setTextColor(getResources().getColor(2131099780));
    }

    private void r0(int i, String str) {
        this.apiHelper.a().H1(i, str).a(new IdnObserver<DirectDebitAccountLinkResponse>(this) {
            @Override
            public void onError(Throwable th, DirectDebitAccountLinkResponse directDebitAccountLinkResponse) {
                super.onError(th, (Throwable) directDebitAccountLinkResponse);
                ECQuickPayingBankOtpAct.this.icvVerificationInputCode.d();
                IdnBaseResult.Status status = directDebitAccountLinkResponse.status;
                if (status != null) {
                    int i2 = status.code;
                    if (600001 != i2) {
                        if (600002 == i2) {
                            ECQuickPayingBankOtpAct eCQuickPayingBankOtpAct = ECQuickPayingBankOtpAct.this;
                            eCQuickPayingBankOtpAct.tvValidity.setTextColor(eCQuickPayingBankOtpAct.getResources().getColor(2131099807));
                            ?? r2 = ECQuickPayingBankOtpAct.this;
                            r2.tvValidity.setText(r2.getString(R.string.easycash_otp_invalid));
                            RxUtil.b(ECQuickPayingBankOtpAct.this.K);
                            ECQuickPayingBankOtpAct.this.q0();
                            return;
                        }
                        return;
                    }
                    RxUtil.b(ECQuickPayingBankOtpAct.this.K);
                    ECQuickPayingBankOtpAct eCQuickPayingBankOtpAct2 = ECQuickPayingBankOtpAct.this;
                    eCQuickPayingBankOtpAct2.tvValidity.setTextColor(eCQuickPayingBankOtpAct2.getResources().getColor(2131099807));
                    ?? r22 = ECQuickPayingBankOtpAct.this;
                    r22.tvValidity.setText(r22.getString(R.string.easycash_otp_vality_retry_max));
                    ECQuickPayingBankOtpAct.this.btnGetVerificationCode.setEnabled(false);
                    ECQuickPayingBankOtpAct eCQuickPayingBankOtpAct3 = ECQuickPayingBankOtpAct.this;
                    eCQuickPayingBankOtpAct3.btnGetVerificationCode.setTextColor(eCQuickPayingBankOtpAct3.getResources().getColor(2131099787));
                    ?? r23 = ECQuickPayingBankOtpAct.this;
                    r23.btnGetVerificationCode.setText(r23.getString(2131886866));
                }
            }

            @Override
            public void onSuccess(DirectDebitAccountLinkResponse directDebitAccountLinkResponse) {
                if (DirectDebitAccountLinkResponse.STATUS.fromName(directDebitAccountLinkResponse.body.status) != DirectDebitAccountLinkResponse.STATUS.ENABLED) {
                    if (DirectDebitAccountLinkResponse.STATUS.fromName(directDebitAccountLinkResponse.body.status) == DirectDebitAccountLinkResponse.STATUS.PENDING) {
                        ECQuickPayingBankOtpAct.this.t0(directDebitAccountLinkResponse.body.accountId);
                    }
                } else {
                    ECQuickPayingBankOtpAct.this.dismissLoadingDialog();
                    EventBus.c().n(new QuickRepayNewCardBindEvent());
                    WebEventManager.e().h(new WebEvent("Native", "quickRepaymentBindNewCard", "true", false));
                    ECQuickPayingBankOtpAct eCQuickPayingBankOtpAct = ECQuickPayingBankOtpAct.this;
                    DirectDebitAccountLinkResponse.Body body = directDebitAccountLinkResponse.body;
                    eCQuickPayingBankOtpAct.u0(body.bankBasicInfo, body.maskedAccountNumber);
                }
            }
        });
    }

    private void s0() {
        showLoadingDialog();
        this.apiHelper.a().U(this.C).a(new AnonymousClass1(this));
    }

    public static void startQuickPayingBankOtp(Activity activity, String str, int i, String str2, String str3, String str4) {
        Intent intent = new Intent(activity, (Class<?>) ECQuickPayingBankOtpAct.class);
        intent.putExtra("bankIconUrl", str);
        intent.putExtra("accountId", i);
        intent.putExtra("mobile", str2);
        intent.putExtra("validityText", str3);
        intent.putExtra("bankLabel", str4);
        activity.startActivity(intent);
    }

    public void t0(int i) {
        this.apiHelper.a().r2(i).a(new IdnObserver<DirectDebitAccountLinkResponse>(this) {
            @Override
            public void onSuccess(DirectDebitAccountLinkResponse directDebitAccountLinkResponse) {
                ECQuickPayingBankOtpAct.this.o0(directDebitAccountLinkResponse);
            }
        });
    }

    public void u0(DirectDebitBankInfo directDebitBankInfo, String str) {
        EasycashQuickRepaymentDialog easycashQuickRepaymentDialog = new EasycashQuickRepaymentDialog(this);
        easycashQuickRepaymentDialog.e(directDebitBankInfo.bankLabel);
        easycashQuickRepaymentDialog.i(R.drawable.easycash_ic_correct);
        easycashQuickRepaymentDialog.j(getString(R.string.easycash_open_quick_open_success));
        easycashQuickRepaymentDialog.d(getString(R.string.easycash_quick_payment_available));
        easycashQuickRepaymentDialog.c(directDebitBankInfo.logoUrl);
        easycashQuickRepaymentDialog.f(str);
        easycashQuickRepaymentDialog.h(getString(R.string.ok), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                ECQuickPayingBankOtpAct.this.l0(dialogInterface, i);
            }
        });
        easycashQuickRepaymentDialog.show();
    }

    public void v0() {
        this.tvValidity.setTextColor(getResources().getColor(2131099787));
        this.tvValidity.setText(this.E);
        this.btnGetVerificationCode.setEnabled(false);
        this.btnGetVerificationCode.setTextColor(getResources().getColor(2131099787));
        Disposable X = Observable.F(0L, 1L, TimeUnit.SECONDS).c0(120L).I(new Function() {
            public final Object apply(Object obj) {
                Long m0;
                m0 = ECQuickPayingBankOtpAct.this.m0((Long) obj);
                return m0;
            }
        }).a0(Schedulers.c()).K(AndroidSchedulers.a()).X(new Consumer() {
            public final void accept(Object obj) {
                ECQuickPayingBankOtpAct.this.w0((Long) obj);
            }
        }, new Consumer() {
            public final void accept(Object obj) {
                ((Throwable) obj).printStackTrace();
            }
        }, new Action() {
            public final void run() {
                ECQuickPayingBankOtpAct.this.q0();
            }
        });
        this.K = X;
        addCompositeDisposable(X);
    }

    public void w0(Long l) {
        this.btnGetVerificationCode.setText(l + "S");
    }

    @Override
    protected void B(@NonNull Bundle bundle) {
        super.B(bundle);
        this.B = bundle.getString("bankIconUrl");
        this.C = bundle.getInt("accountId");
        this.D = bundle.getString("mobile");
        this.E = bundle.getString("validityText");
        this.F = bundle.getString("bankLabel");
    }

    @Override
    protected void D() {
        super.D();
        g0();
        e0(this.B);
        f0();
        this.tvTip.setText(MessageFormat.format(getString(R.string.easycash_open_quick_repay_otp_tip), EcFormatUtil.p(this.D)));
        v0();
        ThirdPartEventUtils.D(this, EasycashUmengEvent.J4, new JsonParamsBuilder().d("bankLabel").a(this.F).c());
    }

    @Override
    protected void N(@NonNull Bundle bundle) {
        super.N(bundle);
        bundle.putString("bankIconUrl", this.B);
        bundle.putInt("accountId", this.C);
        bundle.putString("mobile", this.D);
        bundle.putString("validityText", this.E);
        bundle.putString("bankLabel", this.F);
    }

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

    protected void o0(@NonNull DirectDebitAccountLinkResponse directDebitAccountLinkResponse) {
        this.L++;
        if (DirectDebitAccountLinkResponse.STATUS.fromName(directDebitAccountLinkResponse.body.status) == DirectDebitAccountLinkResponse.STATUS.ENABLED) {
            this.L = 0;
            k0(directDebitAccountLinkResponse);
        } else if (this.L >= 5) {
            d0();
        } else {
            p0(directDebitAccountLinkResponse);
        }
    }

    public void onBackPressed() {
        JsonParamsBuilder a = new JsonParamsBuilder().d("bankLabel").a(this.F);
        if (this.icvVerificationInputCode.getEditText().getText() != null) {
            a.d("inputText").a(this.icvVerificationInputCode.getEditText().getText().toString());
        }
        ThirdPartEventUtils.D(this, EasycashUmengEvent.K4, a.c());
        super/*androidx.activity.ComponentActivity*/.onBackPressed();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        this.N.removeCallbacksAndMessages(null);
        this.N = null;
    }

    @OnClick({R.id.btn_get_verification_code})
    public void onGetVerificationCodeClick() {
        if (BaseUtils.l()) {
            return;
        }
        showLoadingDialog();
        s0();
        ThirdPartEventUtils.D(this, "ec_quick_pay_otp_page_resend", new JsonParamsBuilder().d("bankLabel").a(this.F).c());
    }

    @Override
    protected void onResume() {
        super.onResume();
        SensorTrackEvent sensorTrackEvent = SensorTrackEvent.EC_QUICK_PAYING_BANK_OTP_SHOW;
        ThirdPartEventUtils.Q(this, sensorTrackEvent, sensorTrackEvent.a());
    }

    @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);
    }
}