导航菜单

页面标题

页面副标题

大众借. v4.1.2 - N0ACT.java 源代码

正在查看: 大众借. v4.1.2 应用的 N0ACT.java JAVA 源代码文件

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


package com.shiliuj.ui.activitys;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.core.app.NotificationCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.alipay.alipaysecuritysdk.common.config.Constant;
import com.base.commonlibrary.base.BaseResult;
import com.base.commonlibrary.base.baseapp.AppActivityManager;
import com.base.commonlibrary.base.baserx.RxHelper;
import com.base.commonlibrary.base.baserx.RxSchedulers;
import com.base.commonlibrary.baseview.recyclerview.MultiItemTypeAdapter;
import com.base.commonlibrary.utils.LogUtil;
import com.base.commonlibrary.utils.RSAUtils;
import com.base.commonlibrary.utils.RegexUtil;
import com.base.commonlibrary.utils.SPUtils;
import com.base.commonlibrary.utils.ToastUtil;
import com.base.commonlibrary.views.TitleLayout;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.shiliuj.mjyp.BMAG01ACT;
import com.shiliuj.mjyp.adapters.YlAdMenuAdapter;
import com.shiliuj.mjyp.app.api.Api;
import com.shiliuj.mjyp.app.api.AppConfig;
import com.shiliuj.mjyp.app.base.BaseBindActivity;
import com.shiliuj.mjyp.app.base.RxSubscriber;
import com.shiliuj.mjyp.app.fragment.FeesDialog;
import com.shiliuj.mjyp.app.fragment.WindowDialog;
import com.shiliuj.ui.bean.ADLog;
import com.shiliuj.ui.bean.AdBean;
import com.shiliuj.ui.bean.AdEcBean;
import com.shiliuj.ui.bean.CalculateBean;
import com.shiliuj.ui.bean.MyOrderListBean;
import com.shiliuj.ui.bean.PageOnOffBean;
import com.shiliuj.ui.bean.WindowBean;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import okhttp3.MediaType;
import okhttp3.RequestBody;

public class N0ACT extends BaseBindActivity {

    @BindView(2131296342)
    TextView allMoney;

    @BindView(2131296343)
    TextView allMoney2;

    @BindView(2131296381)
    Button btnCancle;

    @BindView(2131296390)
    Button btnOk;
    private CalculateBean calculateBean;

    @BindView(2131296402)
    TextView cardNum;
    private CountDownTimer countDownTimer;

    @BindView(2131296455)
    TextView dayNum;
    private int enfLoanFlag;

    @BindView(2131296507)
    TextView failReason;

    @BindView(2131296511)
    TextView feesMoney;

    @BindView(2131296536)
    TextView getMoney;
    private YlAdMenuAdapter homeMenuAdapter;

    @BindView(2131296581)
    ImageView imgStatus;
    private boolean isShowWindow;

    @BindView(2131296620)
    View line_rl;

    @BindView(2131296643)
    LinearLayout llFail;

    @BindView(2131296658)
    LinearLayout llSuccess;
    private String orderNo;

    @BindView(2131296760)
    TextView overMoney;

    @BindView(2131296762)
    TextView pDate;

    @BindView(2131296685)
    RecyclerView recyclerView;
    private int reenfLoanFlag;

    @BindView(2131296814)
    RelativeLayout rlAd;

    @BindView(2131296838)
    RelativeLayout rlOtherFees;

    @BindView(2131296831)
    RelativeLayout rl_hk_day;

    @BindView(2131296912)
    TextView sq_1;

    @BindView(2131296913)
    TextView sq_2;

    @BindView(2131296966)
    TextView tip;

    @BindView(2131296998)
    TitleLayout title;

    @BindView(2131297036)
    TextView tvFailTip;

    @BindView(2131297037)
    TextView tvFailTip3;

    @BindView(2131297040)
    TextView tv_s_tip;
    private int loanType = 1;
    private List<AdBean.AdListBean> menuDatas = new ArrayList();
    private String location = "1";

    protected boolean canLoadMore() {
        return false;
    }

    public int getLayoutId() {
        return 2131492908;
    }

    public void initPresenter() {
    }

    protected void loadMore() {
    }

    protected void refresh() {
    }

    protected void startCountDown() {
        if (this.countDownTimer == null) {
            this.countDownTimer = new CountDownTimer(10000L, 1000L) {
                @Override
                public void onTick(long j) {
                    if (j == 25000) {
                        N0ACT.this.getDetail(false);
                    }
                }

                @Override
                public void onFinish() {
                    N0ACT.this.getDetail(false);
                }
            };
        }
        this.countDownTimer.start();
    }

    protected void onDestroy() {
        super.onDestroy();
        stopCountDown();
    }

    private void stopCountDown() {
        CountDownTimer countDownTimer = this.countDownTimer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
            this.countDownTimer = null;
        }
    }

    public void initView(Bundle bundle) {
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            setRv();
            this.orderNo = extras.getString("ORDERID", "");
            this.enfLoanFlag = extras.getInt(AppConfig.EnfLoanFlag, 0);
            this.reenfLoanFlag = extras.getInt("REEnfLoanFlag", 0);
            LogUtil.d("enfLoanFlag", this.enfLoanFlag + "-->" + this.reenfLoanFlag);
            if (!TextUtils.isEmpty(this.orderNo)) {
                showLoading(getResources().getString(2131689804));
                getDetail(false);
                startCountDown();
            } else {
                setFail(extras.getString(NotificationCompat.CATEGORY_MESSAGE, getResources().getString(2131689894)), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())));
            }
        } else {
            showErrorTip(getResources().getString(2131690148));
        }
        this.tip.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                (Build.VERSION.SDK_INT >= 23 ? (ClipboardManager) N0ACT.this.getSystemService("clipboard") : null).setPrimaryClip(ClipData.newPlainText("text", N0ACT.this.tip.getText().toString()));
                new ToastUtil().showShort(N0ACT.this.mContext, "已复制文本");
                return true;
            }
        });
    }

    private void setRv() {
        RecyclerView.Adapter ylAdMenuAdapter = new YlAdMenuAdapter(this.mContext, 2131492976, this.menuDatas);
        this.homeMenuAdapter = ylAdMenuAdapter;
        this.recyclerView.setAdapter(ylAdMenuAdapter);
        this.homeMenuAdapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
            public boolean onItemLongClick(View view, RecyclerView.ViewHolder viewHolder, int i) {
                return false;
            }

            public void onItemClick(View view, RecyclerView.ViewHolder viewHolder, int i) {
                if (N0ACT.this.menuDatas == null || N0ACT.this.menuDatas.size() <= 0) {
                    return;
                }
                AdBean.AdListBean adListBean = (AdBean.AdListBean) N0ACT.this.menuDatas.get(i);
                String url = adListBean.getUrl();
                String code = adListBean.getCode();
                N0ACT n0act = N0ACT.this;
                n0act.adlog(code, url, "0", n0act.location);
                Bundle bundle = new Bundle();
                bundle.putString("title", "");
                bundle.putString("code", code);
                bundle.putString("url", url);
                bundle.putString("location", N0ACT.this.location);
                N0ACT.this.startActivity(MT9ACT.class, bundle);
            }
        });
    }

    protected void getAdList() {
        HashMap hashMap = new HashMap();
        hashMap.put("location", this.location + "");
        this.mRxManager.add(Api.getDefault().adList(RequestBody.create(MediaType.parse("application/json;charset=UTF-8"), new Gson().toJson(hashMap))).compose(RxHelper.handleResult()).subscribe(new RxSubscriber<AdEcBean>(this.mContext, false) {
            protected void _onError(String str) {
            }

            public void _onNext(AdEcBean adEcBean) {
                String adFlag = adEcBean.getAdFlag();
                N0ACT.this.setADView(false);
                if (adFlag.equals("0")) {
                    List list = (List) new Gson().fromJson(RSAUtils.getInstance().decrypt(adEcBean.getAdList()), new TypeToken<List<AdBean.AdListBean>>() {
                    }.getType());
                    N0ACT n0act = N0ACT.this;
                    if (list == null) {
                        list = new ArrayList();
                    }
                    n0act.menuDatas = list;
                    int size = N0ACT.this.menuDatas.size();
                    if (N0ACT.this.menuDatas == null || size <= 0) {
                        return;
                    }
                    N0ACT.this.setADView(true);
                    N0ACT.this.recyclerView.setLayoutManager(new LinearLayoutManager(N0ACT.this.mContext));
                    N0ACT.this.homeMenuAdapter.replaceAll(N0ACT.this.menuDatas);
                }
            }
        }));
    }

    protected void adlog(String str, String str2, String str3, String str4) {
        this.mRxManager.add(Api.getDefault().adlog(new ADLog(str, (String) SPUtils.getData("PHONE", ""), Constant.SDK_OS, str2, str3, str4)).compose(RxSchedulers.io_main()).subscribe(new RxSubscriber<BaseResult>(this.mContext, false) {
            protected void _onError(String str5) {
            }

            public void _onNext(BaseResult baseResult) {
            }
        }));
    }

    public void setADView(boolean z) {
        stopLoading();
        if (z) {
            this.rlAd.setVisibility(0);
        } else {
            this.rlAd.setVisibility(8);
        }
    }

    protected void getDetail(boolean z) {
        this.mRxManager.add(Api.getDefault().myOrderDetail(this.orderNo).compose(RxSchedulers.io_main()).compose(RxHelper.handleResult()).subscribe(new RxSubscriber<MyOrderListBean.PageBean.RecordsBean>(this.mContext, z) {
            public void _onNext(MyOrderListBean.PageBean.RecordsBean recordsBean) {
                Integer valueOf = Integer.valueOf(recordsBean.getStatus());
                Integer repStatus = recordsBean.getRepStatus();
                Integer manualAuditFlag = recordsBean.getManualAuditFlag();
                String reason = recordsBean.getReason();
                BigDecimal amount = recordsBean.getAmount();
                Integer refuseFlag = recordsBean.getRefuseFlag();
                int loanPeriod = recordsBean.getLoanPeriod();
                BigDecimal dueAmount = recordsBean.getDueAmount();
                String createTime = recordsBean.getCreateTime();
                BigDecimal actualAmount = recordsBean.getActualAmount();
                BigDecimal bigDecimal = new BigDecimal(0);
                if (amount != null && actualAmount != null) {
                    bigDecimal = amount.subtract(actualAmount);
                }
                String dueDate = recordsBean.getDueDate();
                String bankNum = recordsBean.getBankNum();
                String bankName = recordsBean.getBankName() == null ? "" : recordsBean.getBankName();
                N0ACT.this.feesMoney.setText(N0ACT.this.getString(2131689824) + bigDecimal + "");
                N0ACT.this.dayNum.setText(loanPeriod + N0ACT.this.getString(2131689633));
                N0ACT.this.getMoney.setText(N0ACT.this.getString(2131689824) + amount + "");
                if (!RegexUtil.isEmpty(dueDate)) {
                    N0ACT.this.overMoney.setText("" + dueDate);
                } else {
                    N0ACT.this.overMoney.setText("-/-");
                }
                N0ACT.this.allMoney.setText(N0ACT.this.getString(2131689824) + dueAmount + "");
                N0ACT.this.allMoney2.setText(N0ACT.this.getString(2131689824) + dueAmount + "");
                if (!RegexUtil.isEmpty(bankNum) && bankNum.length() >= 4) {
                    N0ACT.this.cardNum.setText(bankName + N0ACT.this.getString(2131689558) + bankNum.substring(bankNum.length() - 4));
                } else {
                    N0ACT.this.cardNum.setText(N0ACT.this.getResources().getString(2131689871));
                }
                N0ACT.this.getConfigForCharge(recordsBean);
                N0ACT.this.setFailOrSuccess(refuseFlag, manualAuditFlag, valueOf, repStatus, reason, createTime, recordsBean.getContent());
                N0ACT.this.stopLoading();
                WindowBean windowBean = (WindowBean) new Gson().fromJson(recordsBean.getWindows(), WindowBean.class);
                if (windowBean.getFlag() != 1 || N0ACT.this.isShowWindow) {
                    return;
                }
                N0ACT.this.getSupportFragmentManager().beginTransaction().add((Fragment) WindowDialog.newInstance(windowBean.getContent()), "WindowDialog").commitAllowingStateLoss();
                N0ACT.this.isShowWindow = true;
            }

            protected void _onError(String str) {
                N0ACT.this.showErrorTip(str);
            }
        }));
    }

    protected void getConfigForCharge(MyOrderListBean.PageBean.RecordsBean recordsBean) {
        this.loanType = recordsBean.getLoanType() == null ? 1 : recordsBean.getLoanType().intValue();
        BigDecimal amount = recordsBean.getAmount();
        BigDecimal interest = recordsBean.getInterest();
        BigDecimal serviceCharge = recordsBean.getServiceCharge();
        BigDecimal creditCertification = recordsBean.getCreditCertification();
        BigDecimal riskManagement = recordsBean.getRiskManagement();
        BigDecimal riskPreparation = recordsBean.getRiskPreparation();
        BigDecimal bigDecimal = new BigDecimal(0);
        if (interest != null && serviceCharge != null && creditCertification != null && riskManagement != null && riskPreparation != null) {
            bigDecimal = interest.add(serviceCharge).add(creditCertification).add(riskManagement).add(riskPreparation);
        }
        int i = this.loanType;
        if (i == 1) {
            this.rlOtherFees.setVisibility(0);
            this.line_rl.setVisibility(0);
            this.allMoney2.setVisibility(8);
            this.allMoney.setVisibility(0);
        } else if (i == 2) {
            this.allMoney2.setVisibility(8);
            this.allMoney.setVisibility(0);
            this.rlOtherFees.setVisibility(0);
            this.line_rl.setVisibility(0);
            bigDecimal = serviceCharge.add(creditCertification).add(riskManagement).add(riskPreparation);
        } else if (i == 3) {
            this.rlOtherFees.setVisibility(8);
            this.line_rl.setVisibility(8);
            this.allMoney2.setVisibility(0);
            this.allMoney.setVisibility(8);
            bigDecimal = amount.add(interest).add(serviceCharge).add(creditCertification).add(riskManagement).add(riskPreparation);
        }
        this.calculateBean = new CalculateBean(amount, interest, serviceCharge, creditCertification, riskManagement, riskPreparation, bigDecimal);
    }

    public void setFailOrSuccess(Integer num, Integer num2, Integer num3, Integer num4, String str, String str2, String str3) {
        if (num2 != null && num2.intValue() == 1) {
            if (num3.intValue() == 3) {
                this.llSuccess.setVisibility(0);
                this.llFail.setVisibility(8);
                this.tv_s_tip.setText(getResources().getString(2131690153));
                this.imgStatus.setImageResource(2131558439);
                this.btnOk.setText(getResources().getString(2131690094));
                this.rl_hk_day.setVisibility(0);
                this.mRxManager.post("Status", "登录");
                this.tip.setText(str3);
                if (this.enfLoanFlag == 1 || this.reenfLoanFlag == 1) {
                    this.btnCancle.setVisibility(0);
                }
                this.location = "1";
                getAdList();
                return;
            }
            if (num.intValue() == 0) {
                this.llSuccess.setVisibility(0);
                this.llFail.setVisibility(8);
                this.btnOk.setText(getResources().getString(2131689959));
                this.imgStatus.setImageResource(2131558440);
                this.rl_hk_day.setVisibility(8);
                this.tip.setText(str3);
                this.tv_s_tip.setText(getResources().getString(2131690151));
                this.sq_1.setText("");
                this.sq_2.setText(getResources().getString(2131689908));
                return;
            }
            setFail(str, str2);
            return;
        }
        if (num3.intValue() == 0 || num3.intValue() == 2) {
            setFail(str, str2);
            return;
        }
        if (num3.intValue() == 1 || num3.intValue() == 4) {
            this.llFail.setVisibility(8);
            this.btnOk.setText(getResources().getString(2131689959));
            this.imgStatus.setImageResource(2131558424);
            this.rl_hk_day.setVisibility(8);
            this.tip.setText(str3);
            this.tv_s_tip.setText(getResources().getString(2131690152));
            this.sq_1.setText("");
            this.sq_2.setText(getResources().getString(2131689908));
            this.llSuccess.setVisibility(8);
            return;
        }
        if (num3.intValue() == 3) {
            this.title.setTitle("已到账");
            this.llSuccess.setVisibility(0);
            this.rlOtherFees.setVisibility(8);
            this.rl_hk_day.setVisibility(8);
            this.llFail.setVisibility(8);
            this.tv_s_tip.setText(getResources().getString(2131690153));
            this.tvFailTip.setVisibility(8);
            this.tvFailTip3.setVisibility(8);
            this.imgStatus.setImageResource(2131558439);
            this.btnOk.setText(getResources().getString(2131690094));
            this.mRxManager.post("Status", "登录");
            this.tip.setText(str3);
            if (this.enfLoanFlag == 1 || this.reenfLoanFlag == 1) {
                this.btnCancle.setVisibility(0);
            }
            this.location = "1";
            getAdList();
            return;
        }
        if (num3.intValue() == 5) {
            this.llFail.setVisibility(8);
            this.btnOk.setText(getResources().getString(2131689959));
            this.imgStatus.setImageResource(2131558420);
            this.rl_hk_day.setVisibility(8);
            this.tip.setText(str3);
            this.title.setTitle("打款失败");
            this.tv_s_tip.setText("你好!打款失败!请核对卡号!联系客服~");
            this.sq_1.setText("");
            this.sq_2.setText(getResources().getString(2131689908));
            this.llSuccess.setVisibility(8);
        }
    }

    private void setFail(String str, String str2) {
        this.location = "2";
        getAdList();
        this.pDate.setText(str2);
        this.llSuccess.setVisibility(8);
        this.llFail.setVisibility(8);
        this.tvFailTip3.setVisibility(0);
        this.tvFailTip.setText("请注意自己的征信!祝您生活愉快");
        this.imgStatus.setImageResource(2131558425);
        this.tv_s_tip.setText(getResources().getString(2131689541));
        this.btnOk.setText(getResources().getString(2131689555));
        this.sq_1.setText(getResources().getString(2131690119));
        this.sq_2.setText(getResources().getString(2131689631));
        this.failReason.setText(str + "");
        this.tip.setText(getResources().getString(2131690146));
        toPageOnOff();
    }

    @OnClick({2131296381})
    protected void onCancle() {
        startActivity(MT4ACT.class);
    }

    @OnClick({2131296390})
    protected void onClick(View view) {
        String string = getResources().getString(2131689555);
        String charSequence = this.btnOk.getText().toString();
        if (charSequence.equals(string)) {
            AppActivityManager.getAppManager().returnToActivity(BMAG01ACT.class);
            finish();
        } else if (charSequence.equals(getResources().getString(2131690094))) {
            startActivity(M0ACT.class);
            finish();
        } else {
            getDetail(true);
        }
    }

    @OnClick({2131296511, 2131296343})
    protected void onClick() {
        if (this.calculateBean != null) {
            getSupportFragmentManager().beginTransaction().add((Fragment) FeesDialog.newInstance(this.calculateBean, Integer.valueOf(this.loanType)), "FeesDialog").commitAllowingStateLoss();
        } else {
            getDetail(false);
        }
    }

    private void toPageOnOff() {
        this.mRxManager.add(Api.getDefault().toPageOnOff().compose(RxHelper.handleResult()).subscribe(new RxSubscriber<PageOnOffBean>(this.mContext, true) {
            protected void _onError(String str) {
            }

            public void _onNext(PageOnOffBean pageOnOffBean) {
                if (pageOnOffBean != null) {
                    String toPage = pageOnOffBean.getToPage();
                    if (pageOnOffBean.getOnOff().equals("1")) {
                        SystemClock.sleep(1500L);
                        Bundle bundle = new Bundle();
                        bundle.putString("title", "");
                        bundle.putString("code", "");
                        bundle.putString("url", toPage);
                        bundle.putString("location", N0ACT.this.location);
                        N0ACT.this.startActivity(MT9ACT.class, bundle);
                        N0ACT.this.finish();
                    }
                }
            }
        }));
    }
}