导航菜单

页面标题

页面副标题

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

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

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


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

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import com.duoshan.loan.a;
import com.duoshan.loan.base.BaseActivity;
import com.duoshan.loan.databinding.ActivityInfoAuthenticationBinding;
import com.duoshan.loan.dialog.AgreementDialog;
import com.duoshan.loan.dialog.IdentityHelpDialog;
import com.duoshan.loan.ui.auth.bean.ApiAgreementBean;
import com.duoshan.loan.ui.auth.bean.IdCardOcrBean;
import com.duoshan.loan.ui.auth.bean.IdentityInfoBean;
import com.duoshan.loan.ui.auth.vm.AuthenticViewModel;
import e2.c0;
import e2.g;
import e2.y;
import h2.h;
import h2.i;
import h2.o;
import h4.k;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import l5.b;
import l5.d;
import m4.c;
import t1.d1;
import t1.e1;
import t1.f1;
import t1.g1;
import t1.h1;
import t1.i1;
import t1.j1;
import t1.k1;
import t1.l1;
import t1.m1;
import t1.n1;
import z3.m;

public class InfoAuthenticationActivity extends BaseActivity<ActivityInfoAuthenticationBinding, AuthenticViewModel> {

    public String f2652e;

    public ActivityResultLauncher<Intent> f2653f;

    public boolean f2654g = true;

    public IdCardOcrBean f2655h = new IdCardOcrBean();

    public String f2656i = "";

    public String f2657j = "";

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

    public List<String> f2659l = new ArrayList();

    public String[] f2660m = {m.C, m.D};

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

        public void d(File file, b bVar) throws Exception {
            if (!bVar.b) {
                k.u("请前往设置界面授予存储权限");
            } else {
                c0.b(InfoAuthenticationActivity.this);
                ((AuthenticViewModel) InfoAuthenticationActivity.this.f2433c).h(file);
            }
        }

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

        @Override
        @SuppressLint({"CheckResult"})
        public void b(Bitmap bitmap, String str) {
            ((ActivityInfoAuthenticationBinding) InfoAuthenticationActivity.this.f2431a).shapeCheckBox.setChecked(true);
            if (bitmap != null) {
                new d(InfoAuthenticationActivity.this).r(InfoAuthenticationActivity.this.f2660m).subscribe(new n1(this, g.g(bitmap)));
            }
        }
    }

    public void D(TextView textView, h2.b bVar) {
        O(false, this.f2655h);
    }

    public void E(List list) {
        if (list != null) {
            this.f2658k = list;
        }
    }

    public void F(IdentityInfoBean identityInfoBean) {
        if (identityInfoBean != null) {
            this.f2656i = identityInfoBean.getIdCardFrontUrl();
            this.f2657j = identityInfoBean.getIdCardBackUrl();
            if (!TextUtils.isEmpty(this.f2656i)) {
                ((ActivityInfoAuthenticationBinding) this.f2431a).bgIdentityFront.setImageResource(a.h.bg_upload_success);
                y.h(this, this.f2656i, ((ActivityInfoAuthenticationBinding) this.f2431a).ivIdentityFront, 8);
            }
            if (TextUtils.isEmpty(this.f2657j)) {
                return;
            }
            ((ActivityInfoAuthenticationBinding) this.f2431a).bgIdentityBack.setImageResource(a.h.bg_upload_success);
            y.h(this, this.f2657j, ((ActivityInfoAuthenticationBinding) this.f2431a).ivIdentityBack, 8);
        }
    }

    public void G(String str) {
        this.f2656i = str;
        if (TextUtils.isEmpty(str)) {
            return;
        }
        ((ActivityInfoAuthenticationBinding) this.f2431a).bgIdentityFront.setImageResource(a.h.bg_upload_success);
        y.h(this, this.f2656i, ((ActivityInfoAuthenticationBinding) this.f2431a).ivIdentityFront, 8);
    }

    public void H(String str) {
        this.f2657j = str;
        if (TextUtils.isEmpty(str)) {
            return;
        }
        ((ActivityInfoAuthenticationBinding) this.f2431a).bgIdentityBack.setImageResource(a.h.bg_upload_success);
        y.h(this, this.f2657j, ((ActivityInfoAuthenticationBinding) this.f2431a).ivIdentityBack, 8);
    }

    public void I(IdCardOcrBean idCardOcrBean) {
        this.f2655h = idCardOcrBean;
        O(true, idCardOcrBean);
    }

    public void J(Boolean bool) {
        if (!bool.booleanValue()) {
            k.u("保存协议失败,请重新申请");
        } else {
            e2.a.f(this, this.f2652e);
            finish();
        }
    }

    public void K(View view) {
        int id = view.getId();
        if (id == 2131296667) {
            finish();
        }
        if (id == 2131297137) {
            if (TextUtils.isEmpty(this.f2656i)) {
                k.u("请上传身份证人像面");
                return;
            } else if (TextUtils.isEmpty(this.f2657j)) {
                k.u("请上传身份证国徽面");
                return;
            } else {
                c0.b(this);
                ((AuthenticViewModel) this.f2433c).i(this.f2656i, this.f2657j);
                return;
            }
        }
        switch (id) {
            case a.i.iv_identity_back:
                this.f2654g = false;
                P();
                break;
            case a.i.iv_identity_front:
                this.f2654g = true;
                P();
                break;
            case a.i.iv_identity_help:
                new c.b(this).r(new IdentityHelpDialog(this)).J();
                break;
        }
    }

    public void L(View view) {
        f2.c.b(this, 1);
    }

    public void M(ActivityResult activityResult) {
        if (activityResult.getResultCode() == -1) {
            ((AuthenticViewModel) this.f2433c).g(activityResult.getData().getStringExtra("imagePath"), this.f2654g);
        }
    }

    public final void C() {
        this.f2659l.add("《实名认证授权同意书》");
        this.f2659l.add("《数据查询授权说明书》");
        h hVar = new h();
        hVar.b(new o("我已阅读并同意", getResources().getColor(a.f.color666666)));
        Iterator<String> it = this.f2659l.iterator();
        while (it.hasNext()) {
            hVar.b(new o(it.next(), getResources().getColor(a.f.color2547EC)).q(new i(((ActivityInfoAuthenticationBinding) this.f2431a).tvLink, new m1(this)).r(getResources().getColor(a.f.colorFFD53F))));
        }
        ((ActivityInfoAuthenticationBinding) this.f2431a).tvLink.setText(hVar.h());
    }

    public final void N() {
        this.f2653f = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new f1(this));
    }

    public final void O(boolean z4, IdCardOcrBean idCardOcrBean) {
        new c.b(this).r(new AgreementDialog(this, this.f2658k, idCardOcrBean, z4, new a())).J();
    }

    public final void P() {
        Intent intent = new Intent(this, (Class<?>) CameraActivity.class);
        intent.putExtra("type", !this.f2654g ? 1 : 0);
        this.f2653f.launch(intent);
    }

    @Override
    public void g() {
        String stringExtra = getIntent().getStringExtra("productId");
        this.f2652e = stringExtra;
        ((AuthenticViewModel) this.f2433c).e(stringExtra);
        ((AuthenticViewModel) this.f2433c).f();
    }

    @Override
    public void i() {
        ((AuthenticViewModel) this.f2433c).f2720h.observe(this, new l1(this));
        ((AuthenticViewModel) this.f2433c).f2719g.observe(this, new h1(this));
        ((AuthenticViewModel) this.f2433c).f2716d.observe(this, new j1(this));
        ((AuthenticViewModel) this.f2433c).f2717e.observe(this, new k1(this));
        ((AuthenticViewModel) this.f2433c).f2718f.observe(this, new g1(this));
        ((AuthenticViewModel) this.f2433c).f2721i.observe(this, new i1(this));
    }

    @Override
    @SuppressLint({"NonConstantResourceId"})
    public void initView() {
        n("身份认证");
        f2.b.e();
        C();
        N();
        d1 d1Var = new d1(this);
        VB vb = this.f2431a;
        l(d1Var, ((ActivityInfoAuthenticationBinding) vb).ivIdentityFront, ((ActivityInfoAuthenticationBinding) vb).ivIdentityBack, ((ActivityInfoAuthenticationBinding) vb).ivIdentityHelp, ((ActivityInfoAuthenticationBinding) vb).stvNext);
        k(new e1(this));
    }

    @Override
    public void onBackPressed() {
        f2.c.b(this, 1);
    }
}