导航菜单

页面标题

页面副标题

用信花 v1.1.3 - BorrowMoneyActivity.java 源代码

正在查看: 用信花 v1.1.3 应用的 BorrowMoneyActivity.java JAVA 源代码文件

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


package com.duoshan.loan.ui.auth.activity;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.AnimationUtils;
import com.duoshan.loan.a;
import com.duoshan.loan.base.BaseActivity;
import com.duoshan.loan.databinding.ActivityBorrowMoneyBinding;
import com.duoshan.loan.dialog.AgreementDialog;
import com.duoshan.loan.dialog.SelectMoneyTimeDialog;
import com.duoshan.loan.dialog.SendCodeDialog;
import com.duoshan.loan.ui.auth.adapter.RepayPlanAdapter;
import com.duoshan.loan.ui.auth.bean.ApiAgreementBean;
import com.duoshan.loan.ui.auth.bean.ApplyLoanBean;
import com.duoshan.loan.ui.auth.bean.LoanResultBean;
import com.duoshan.loan.ui.auth.bean.NeedAuthCode;
import com.duoshan.loan.ui.auth.bean.TrialBean;
import com.duoshan.loan.ui.auth.vm.BorrowMoneyViewModel;
import com.jeremyliao.liveeventbus.LiveEventBus;
import e2.f;
import e2.g0;
import e2.m0;
import e2.q;
import h4.k;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import m4.c;
import t1.a0;
import t1.b0;
import t1.c0;
import t1.d0;
import t1.e0;
import t1.x;
import t1.y;
import t1.z;

public class BorrowMoneyActivity extends BaseActivity<ActivityBorrowMoneyBinding, BorrowMoneyViewModel> {

    public String f2593e;

    public String f2594f;

    public ApplyLoanBean f2595g;

    public RepayPlanAdapter f2596h;

    public boolean f2598j;

    public SendCodeDialog f2600l;

    public long f2601m;

    public String f2602n;

    public List<ApiAgreementBean> f2597i = new ArrayList();

    public final int f2599k = 60;

    public class a implements AgreementDialog.a {
        public a() {
        }

        @Override
        public void a(Bitmap bitmap, String str) {
            ((ActivityBorrowMoneyBinding) BorrowMoneyActivity.this.f2431a).shapeCheckBox.setChecked(false);
        }

        @Override
        public void b(Bitmap bitmap, String str) {
            ((ActivityBorrowMoneyBinding) BorrowMoneyActivity.this.f2431a).shapeCheckBox.setChecked(true);
        }
    }

    public class b implements SendCodeDialog.b {

        public final String f2604a;

        public b(String str) {
            this.f2604a = str;
        }

        @Override
        public void a(String str) {
            BorrowMoneyActivity.this.L(str, this.f2604a);
            m0.b(BorrowMoneyActivity.this);
        }

        @Override
        public void b(long j4) {
            BorrowMoneyActivity.this.f2601m = j4;
            BorrowMoneyActivity.this.O();
        }
    }

    public void D(List list) {
        if (list != null) {
            this.f2597i = list;
            if (list.isEmpty()) {
                ((ActivityBorrowMoneyBinding) this.f2431a).llAgreement.setVisibility(4);
            } else {
                ((ActivityBorrowMoneyBinding) this.f2431a).llAgreement.setVisibility(0);
            }
        }
    }

    public void E(ApplyLoanBean applyLoanBean) {
        this.f2595g = applyLoanBean;
        int parseInt = Integer.parseInt(g0.e(0, applyLoanBean.getCanLoanMaxAmount()));
        String str = applyLoanBean.getCanLoanPeriods().get(r2.size() - 1);
        ((ActivityBorrowMoneyBinding) this.f2431a).tvBorrowMoney.setText(parseInt + "");
        ((ActivityBorrowMoneyBinding) this.f2431a).itemViewTimeLimit.q(str + "期");
        ((ActivityBorrowMoneyBinding) this.f2431a).itemViewProductName.q(applyLoanBean.getCompanyName());
        this.f2594f = applyLoanBean.getUserProductBankCardId();
        String bankName = applyLoanBean.getBankName();
        this.f2602n = bankName;
        if (TextUtils.isEmpty(bankName)) {
            ((ActivityBorrowMoneyBinding) this.f2431a).llBankInfo.setVisibility(8);
            ((ActivityBorrowMoneyBinding) this.f2431a).tvAddBank.setVisibility(0);
        } else {
            ((ActivityBorrowMoneyBinding) this.f2431a).llBankInfo.setVisibility(0);
            ((ActivityBorrowMoneyBinding) this.f2431a).tvAddBank.setVisibility(8);
            ((ActivityBorrowMoneyBinding) this.f2431a).ivBankLogo.setImageResource(f.c().b(this.f2602n));
            ((ActivityBorrowMoneyBinding) this.f2431a).tvBankName.setText(this.f2602n);
        }
        HashMap hashMap = new HashMap();
        hashMap.put("loanPeriod", str);
        hashMap.put("loanApplyAmount", Integer.valueOf(parseInt));
        hashMap.put("userProductLoanId", this.f2593e);
        ((BorrowMoneyViewModel) this.f2433c).j(hashMap);
    }

    public void F(TrialBean trialBean) {
        C();
        this.f2596h.l1(trialBean.getLoanTrialPlanList());
    }

    public void G(NeedAuthCode needAuthCode) {
        if (needAuthCode == null) {
            return;
        }
        if (needAuthCode.getNeedAuthCode() == 1) {
            N(needAuthCode.getAuthId());
        } else {
            ((BorrowMoneyViewModel) this.f2433c).g(this.f2593e);
        }
    }

    public void H(Boolean bool) {
        if (bool.booleanValue()) {
            ((BorrowMoneyViewModel) this.f2433c).g(this.f2593e);
        }
    }

    public void I(LoanResultBean loanResultBean) {
        LiveEventBus.get(q.f3685f).post(Boolean.TRUE);
        if (loanResultBean != null) {
            int loanOrderStatus = loanResultBean.getLoanOrderStatus();
            if (loanOrderStatus == 1) {
                e2.a.u(this, this.f2593e);
                finish();
            } else if (loanOrderStatus == 2) {
                e2.a.t(this, loanResultBean);
                finish();
            } else if (loanOrderStatus == 3 || loanOrderStatus == 11) {
                e2.a.s(this, loanResultBean);
                finish();
            }
        }
    }

    public void J(View view) {
        switch (view.getId()) {
            case a.i.ll_bank_info:
            case a.i.tv_add_bank:
                e2.a.g(this, this.f2593e, "");
                break;
            case a.i.stv_confirm:
                if (!TextUtils.isEmpty(this.f2602n)) {
                    O();
                    break;
                } else {
                    k.u("请先绑定银行卡");
                    e2.a.g(this, this.f2593e, "");
                    break;
                }
            case a.i.stv_select_money_time:
                M(this.f2595g);
                break;
            case a.i.tv_link:
                if (!this.f2597i.isEmpty()) {
                    new c.b(this).r(new AgreementDialog(this, this.f2597i, null, false, new a())).J();
                    break;
                }
                break;
            case a.i.tv_plan:
                boolean z4 = !this.f2598j;
                this.f2598j = z4;
                if (!z4) {
                    ((ActivityBorrowMoneyBinding) this.f2431a).tvPlan.setCompoundDrawablesWithIntrinsicBounds(0, 0, a.h.icon_plan_expand, 0);
                    ((ActivityBorrowMoneyBinding) this.f2431a).flPlan.setVisibility(8);
                    break;
                } else {
                    ((ActivityBorrowMoneyBinding) this.f2431a).tvPlan.setCompoundDrawablesWithIntrinsicBounds(0, 0, a.h.icon_plan_fold, 0);
                    ((ActivityBorrowMoneyBinding) this.f2431a).flPlan.setVisibility(0);
                    com.bumptech.glide.b.H(this).y().n(Integer.valueOf(a.h.gif_rocket)).l1(((ActivityBorrowMoneyBinding) this.f2431a).ivLoading);
                    break;
                }
        }
    }

    public void K(String str, String str2) {
        ((ActivityBorrowMoneyBinding) this.f2431a).tvBorrowMoney.setText(str);
        ((ActivityBorrowMoneyBinding) this.f2431a).itemViewTimeLimit.q(str2 + "期");
        HashMap hashMap = new HashMap();
        hashMap.put("userProductLoanId", this.f2593e);
        hashMap.put("loanApplyAmount", str);
        hashMap.put("loanPeriod", str2);
        ((BorrowMoneyViewModel) this.f2433c).j(hashMap);
    }

    public final void C() {
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("agreementType", 2);
        hashMap.put("userProductLoanId", this.f2593e);
        ((BorrowMoneyViewModel) this.f2433c).h(hashMap);
    }

    public final void L(String str, String str2) {
        HashMap hashMap = new HashMap();
        hashMap.put("userProductLoanId", this.f2593e);
        hashMap.put("authCode", str);
        hashMap.put("authId", str2);
        ((BorrowMoneyViewModel) this.f2433c).i(hashMap);
    }

    public final void M(ApplyLoanBean applyLoanBean) {
        new c.b(this).r(new SelectMoneyTimeDialog(this, applyLoanBean.getCanLoanMaxAmount(), applyLoanBean.getCanLoanMinAmount(), applyLoanBean.getCanLoanPeriods(), new e0(this))).J();
    }

    public final void N(String str) {
        SendCodeDialog sendCodeDialog = this.f2600l;
        if (sendCodeDialog == null) {
            this.f2600l = new SendCodeDialog(this, "短信校验", "确认借款前需要进行短信校验", new b(str));
        } else {
            sendCodeDialog.setCodeTime(60);
        }
        new c.b(this).r(this.f2600l).J();
    }

    public final void O() {
        if (((ActivityBorrowMoneyBinding) this.f2431a).llAgreement.getVisibility() == 0 && !((ActivityBorrowMoneyBinding) this.f2431a).shapeCheckBox.isChecked()) {
            k.u("请同意相关协议");
            ((ActivityBorrowMoneyBinding) this.f2431a).llAgreement.startAnimation(AnimationUtils.loadAnimation(this, a.C0035a.shake_anim));
            return;
        }
        String charSequence = ((ActivityBorrowMoneyBinding) this.f2431a).tvBorrowMoney.getText().toString();
        String replace = ((ActivityBorrowMoneyBinding) this.f2431a).itemViewTimeLimit.getRightText().replace("期", "");
        HashMap hashMap = new HashMap();
        hashMap.put("userProductLoanId", this.f2593e);
        hashMap.put("userProductBankCardId", this.f2594f);
        hashMap.put("loanApplyAmount", charSequence);
        hashMap.put("loanPeriod", replace);
        ((BorrowMoneyViewModel) this.f2433c).e(hashMap);
    }

    @Override
    public void g() {
        this.f2593e = getIntent().getStringExtra("userProductLoanId");
    }

    @Override
    public void i() {
        ((BorrowMoneyViewModel) this.f2433c).f2743f.observe(this, new d0(this));
        ((BorrowMoneyViewModel) this.f2433c).f2741d.observe(this, new y(this));
        ((BorrowMoneyViewModel) this.f2433c).f2742e.observe(this, new b0(this));
        ((BorrowMoneyViewModel) this.f2433c).f2744g.observe(this, new a0(this));
        ((BorrowMoneyViewModel) this.f2433c).f2745h.observe(this, new c0(this));
        ((BorrowMoneyViewModel) this.f2433c).f2746i.observe(this, new z(this));
    }

    @Override
    @SuppressLint({"NonConstantResourceId"})
    public void initView() {
        n("借款");
        RepayPlanAdapter repayPlanAdapter = new RepayPlanAdapter();
        this.f2596h = repayPlanAdapter;
        ((ActivityBorrowMoneyBinding) this.f2431a).rvPlan.setAdapter(repayPlanAdapter);
        x xVar = new x(this);
        VB vb = this.f2431a;
        l(xVar, ((ActivityBorrowMoneyBinding) vb).stvSelectMoneyTime, ((ActivityBorrowMoneyBinding) vb).tvPlan, ((ActivityBorrowMoneyBinding) vb).tvAddBank, ((ActivityBorrowMoneyBinding) vb).llBankInfo, ((ActivityBorrowMoneyBinding) vb).tvLink, ((ActivityBorrowMoneyBinding) vb).stvConfirm);
    }

    @Override
    public void onResume() {
        super.onResume();
        ((BorrowMoneyViewModel) this.f2433c).f(this.f2593e);
    }
}