导航菜单

页面标题

页面副标题

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

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

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


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

import android.location.Location;
import android.os.Handler;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import com.duoshan.loan.a;
import com.duoshan.loan.base.BaseActivity;
import com.duoshan.loan.databinding.ActivityInfoSupplyBinding;
import com.duoshan.loan.databinding.LayoutSupplyInfoBinding;
import com.duoshan.loan.dialog.PermissionTipsDialog;
import com.duoshan.loan.dialog.SelectExtendInfoDialog;
import com.duoshan.loan.ui.auth.bean.ExtendInfoBean;
import com.duoshan.loan.ui.auth.bean.SupplyExtendBean;
import com.duoshan.loan.ui.auth.bean.UserRegionBean;
import com.duoshan.loan.ui.auth.vm.SupplyViewModel;
import com.duoshan.loan.view.BasicItemView;
import com.jeremyliao.liveeventbus.LiveEventBus;
import com.lxj.xpopup.core.BasePopupView;
import e2.b0;
import e2.d0;
import e2.e;
import e2.q;
import h4.k;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import m4.c;
import t1.a2;
import t1.b2;
import t1.c2;
import t1.d2;
import t1.v1;
import t1.w1;
import t1.x1;
import t1.y1;
import t1.z1;
import z3.i0;
import z3.j;
import z3.m;

public class InfoSupplyActivity extends BaseActivity<ActivityInfoSupplyBinding, SupplyViewModel> {

    public static BasePopupView f2679k;

    public String f2680e;

    public String[] f2681f;

    public String[] f2682g;

    public String f2684i;

    public List<BasicItemView> f2683h = new ArrayList();

    public Map<SupplyExtendBean, View> f2685j = new HashMap();

    public class a implements j {
        public a() {
        }

        @Override
        public void a(List<String> list, boolean z4) {
            if (InfoSupplyActivity.f2679k != null) {
                InfoSupplyActivity.f2679k.o();
            }
        }

        @Override
        public void b(List<String> list, boolean z4) {
            if (InfoSupplyActivity.f2679k != null) {
                InfoSupplyActivity.f2679k.o();
            }
            if (z4) {
                InfoSupplyActivity.this.C();
            }
        }
    }

    public void D() {
        BasePopupView r4 = new c.b(this).r(new PermissionTipsDialog(this, "定位权限使用说明", "1.开启定位权限,可以快速定位您所在位置的城市"));
        f2679k = r4;
        r4.J();
    }

    public void E(UserRegionBean userRegionBean) {
        String str = userRegionBean.getProvince() + "-" + userRegionBean.getCity() + "-" + userRegionBean.getCounty();
        ((ActivityInfoSupplyBinding) this.f2431a).itemDwellAddress.q(str);
        ((ActivityInfoSupplyBinding) this.f2431a).itemCompanyAddress.q(str);
    }

    public static void F(LayoutSupplyInfoBinding layoutSupplyInfoBinding, SupplyExtendBean.OptionsBean optionsBean) {
        layoutSupplyInfoBinding.tvRight.setText(optionsBean.getLabel());
        layoutSupplyInfoBinding.tvRight.setTag(optionsBean.getValue());
    }

    public void G(SupplyExtendBean supplyExtendBean, LayoutSupplyInfoBinding layoutSupplyInfoBinding, View view) {
        new c.b(this).r(new SelectExtendInfoDialog(this, supplyExtendBean.getFiledLabel(), supplyExtendBean.getOptions(), new c2(layoutSupplyInfoBinding))).J();
    }

    public void H(List list) {
        if (list == null || list.isEmpty()) {
            return;
        }
        ((ActivityInfoSupplyBinding) this.f2431a).tvSupplyInfo.setVisibility(0);
        ((ActivityInfoSupplyBinding) this.f2431a).llSupply.setVisibility(0);
        ((ActivityInfoSupplyBinding) this.f2431a).llSupply.removeAllViews();
        this.f2685j.clear();
        Iterator it = list.iterator();
        while (it.hasNext()) {
            SupplyExtendBean supplyExtendBean = (SupplyExtendBean) it.next();
            View inflate = LayoutInflater.from(this).inflate(a.l.layout_supply_info, (ViewGroup) null);
            LayoutSupplyInfoBinding bind = LayoutSupplyInfoBinding.bind(inflate);
            bind.tvName.setText(supplyExtendBean.getFiledLabel());
            if (supplyExtendBean.getFiledType() == 0) {
                bind.editRight.setHint("请输入" + supplyExtendBean.getFiledLabel());
                bind.tvRight.setVisibility(8);
                bind.editRight.setVisibility(0);
            } else {
                bind.tvRight.setHint("请选择" + supplyExtendBean.getFiledLabel());
                bind.tvRight.setVisibility(0);
                bind.editRight.setVisibility(8);
                bind.tvRight.setOnClickListener(new x1(this, supplyExtendBean, bind));
            }
            this.f2685j.put(supplyExtendBean, inflate);
            ((ActivityInfoSupplyBinding) this.f2431a).llSupply.addView(inflate);
        }
    }

    public void I(Boolean bool) {
        if (bool.booleanValue()) {
            e2.a.o(this);
            finish();
        }
    }

    public void J(View view) {
        f2.c.b(this, 4);
    }

    public void K(View view) {
        if (e.l()) {
            M();
        }
    }

    public void L(Boolean bool) {
        if (bool.booleanValue()) {
            A();
            for (int i4 = 0; i4 < this.f2683h.size(); i4++) {
                BasicItemView basicItemView = this.f2683h.get(i4);
                if (TextUtils.isEmpty(basicItemView.getRightText())) {
                    basicItemView.f(true);
                    return;
                }
            }
        }
    }

    public final void A() {
        Iterator<BasicItemView> it = this.f2683h.iterator();
        while (it.hasNext()) {
            it.next().f(false);
        }
    }

    public final void B() {
        if (i0.j(this, m.H, m.G)) {
            C();
        } else {
            i0.a0(this).q(m.H).q(m.G).s(new a());
            new Handler().postDelayed(new d2(this), 100L);
        }
    }

    public final void C() {
        Location f4 = d0.b(this).f();
        if (f4 != null) {
            String str = f4.getLongitude() + "," + f4.getLatitude();
            this.f2684i = str;
            ((SupplyViewModel) this.f2433c).f(str);
        }
    }

    public void M() {
        HashMap hashMap = new HashMap();
        hashMap.put("productId", TextUtils.isEmpty(this.f2680e) ? c1.a.f1050h0 : this.f2680e);
        if (!TextUtils.isEmpty(this.f2684i)) {
            hashMap.put("location", this.f2684i);
        }
        String rightText = ((ActivityInfoSupplyBinding) this.f2431a).itemUsage.getRightText();
        if (TextUtils.isEmpty(rightText)) {
            k.u("请选择借款用途");
            return;
        }
        hashMap.put("loanPurpose", Integer.valueOf(Arrays.asList(this.f2681f).indexOf(rightText) + 1));
        String rightText2 = ((ActivityInfoSupplyBinding) this.f2431a).itemHouseType.getRightText();
        if (TextUtils.isEmpty(rightText2)) {
            k.u("请选择住房类型");
            return;
        }
        hashMap.put("housingType", Integer.valueOf(Arrays.asList(this.f2682g).indexOf(rightText2) + 1));
        if (TextUtils.isEmpty(((ActivityInfoSupplyBinding) this.f2431a).itemDwellAddress.getRightText())) {
            k.u("请选择现居住地址");
            return;
        }
        String[] split = ((ActivityInfoSupplyBinding) this.f2431a).itemDwellAddress.getRightText().split("-");
        if (split.length <= 1) {
            k.u("请重新选择现居住地址");
            return;
        }
        hashMap.put("livingProvince", split[0]);
        hashMap.put("livingCity", split[1]);
        if (split.length > 2) {
            hashMap.put("livingDistrict", split[2]);
        }
        String rightText3 = ((ActivityInfoSupplyBinding) this.f2431a).itemDetailAddress.getRightText();
        if (TextUtils.isEmpty(rightText3)) {
            k.u("请输入现居详细地址");
            return;
        }
        hashMap.put("livingAddress", rightText3);
        String rightText4 = ((ActivityInfoSupplyBinding) this.f2431a).itemCompanyName.getRightText();
        if (TextUtils.isEmpty(rightText4)) {
            k.u("请输入公司名称");
            return;
        }
        hashMap.put("companyName", rightText4);
        if (TextUtils.isEmpty(((ActivityInfoSupplyBinding) this.f2431a).itemCompanyAddress.getRightText())) {
            k.u("请选择公司地址");
            return;
        }
        String[] split2 = ((ActivityInfoSupplyBinding) this.f2431a).itemCompanyAddress.getRightText().split("-");
        if (split2.length <= 1) {
            k.u("请重新选择公司地址");
            return;
        }
        hashMap.put("companyProvince", split2[0]);
        hashMap.put("companyCity", split2[1]);
        if (split2.length > 2) {
            hashMap.put("companyDistrict", split2[2]);
        }
        String rightText5 = ((ActivityInfoSupplyBinding) this.f2431a).itemCompanyDetailAddress.getRightText();
        if (TextUtils.isEmpty(rightText5)) {
            k.u("请输入公司详细地址");
            return;
        }
        hashMap.put("companyAddress", rightText5);
        ArrayList arrayList = new ArrayList();
        if (!this.f2685j.isEmpty()) {
            for (SupplyExtendBean supplyExtendBean : this.f2685j.keySet()) {
                View view = this.f2685j.get(supplyExtendBean);
                ExtendInfoBean extendInfoBean = new ExtendInfoBean();
                if (supplyExtendBean.getFiledType() == 0) {
                    EditText editText = (EditText) view.findViewById(a.i.edit_right);
                    if (TextUtils.isEmpty(editText.getText().toString())) {
                        k.u("请输入" + supplyExtendBean.getFiledLabel() + "信息");
                        return;
                    }
                    extendInfoBean.setFieldName(supplyExtendBean.getFieldName());
                    extendInfoBean.setFieldValue(editText.getText().toString());
                } else {
                    TextView textView = (TextView) view.findViewById(a.i.tv_right);
                    if (TextUtils.isEmpty(textView.getText().toString())) {
                        k.u("请选择" + supplyExtendBean.getFiledLabel() + "信息");
                        return;
                    }
                    extendInfoBean.setFieldName(supplyExtendBean.getFieldName());
                    extendInfoBean.setFieldValue((String) textView.getTag());
                }
                arrayList.add(extendInfoBean);
            }
        }
        hashMap.toString();
        ((SupplyViewModel) this.f2433c).h(hashMap);
        if (arrayList.isEmpty()) {
            return;
        }
        ((SupplyViewModel) this.f2433c).g(arrayList);
    }

    @Override
    public void g() {
        this.f2681f = getResources().getStringArray(a.c.dkyt);
        this.f2682g = getResources().getStringArray(a.c.zflx);
        ((ActivityInfoSupplyBinding) this.f2431a).itemUsage.setData(Arrays.asList(this.f2681f));
        ((ActivityInfoSupplyBinding) this.f2431a).itemHouseType.setData(Arrays.asList(this.f2682g));
        this.f2683h.add(((ActivityInfoSupplyBinding) this.f2431a).itemUsage);
        this.f2683h.add(((ActivityInfoSupplyBinding) this.f2431a).itemHouseType);
        ((ActivityInfoSupplyBinding) this.f2431a).itemUsage.f(true);
        ((SupplyViewModel) this.f2433c).e();
    }

    @Override
    public void i() {
        ((SupplyViewModel) this.f2433c).f2769d.observe(this, new y1(this));
        ((SupplyViewModel) this.f2433c).f2770e.observe(this, new b2(this));
        ((SupplyViewModel) this.f2433c).f2771f.observe(this, new a2(this));
    }

    @Override
    public void initView() {
        n("补充信息");
        this.f2680e = getIntent().getStringExtra("productId");
        B();
        ((ActivityInfoSupplyBinding) this.f2431a).itemCompanyName.getRightEditText().setFilters(b0.c(16));
        k(new w1(this));
        ((ActivityInfoSupplyBinding) this.f2431a).stvNext.setOnClickListener(new v1(this));
        LiveEventBus.get(q.f3687h, Boolean.class).observe(this, new z1(this));
    }

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