导航菜单

页面标题

页面副标题

Cashalo v2.25.0.0 - p.java 源代码

正在查看: Cashalo v2.25.0.0 应用的 p.java JAVA 源代码文件

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


package com.oriente.cashalo.page.fragment;

import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.ConsoleMessage;
import android.webkit.GeolocationPermissions;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;
import com.fullstory.FS;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.metrics.Trace;
import com.oriente.adapter.analytics.impl.CommonAnalytics;
import com.oriente.adapter.config.ValueConfig;
import com.oriente.adapter.page.BaseUiFragment;
import com.oriente.adapter.page.LoadingEvent;
import com.oriente.cashalo.R;
import com.oriente.cashalo.businese.f;
import com.oriente.cashalo.page.model.entity.LoanState;
import com.oriente.cashalo.page.model.entity.LoanStatus;
import com.oriente.cashalo.service.PluginService;
import com.oriente.cashalo.service.model.borrow.BorrowInfo;
import com.oriente.cashalo.service.model.loan.AgreementModel;
import com.oriente.cashalo.service.model.loan.AutoDebitData;
import com.oriente.cashalo.service.model.loan.EarlyRepaymentOption;
import com.oriente.cashalo.service.model.loan.LoanDetailsModel;
import com.oriente.cashalo.service.model.loan.LoanHistoryItem;
import com.oriente.cashalo.service.model.loan.LoanPaymentDetails;
import com.oriente.cashalo.service.model.product.ProductModel;
import com.oriente.cashalo.utils.FormatUtils;
import com.oriente.cashalo.utils.OrientUtils;
import com.oriente.cashalo.widget.PairInfoText;
import com.oriente.core.internal.ScreenName;
import com.oriente.core.page.PageIdentify;
import com.oriente.core.page.RouterUri;
import com.oriente.core.page.jump.Jumper;
import com.oriente.core.router.Router;
import com.oriente.core.router.RouterScene;
import com.oriente.core.store.cache.GlobalSession;
import com.oriente.core.utils.AmountUtils;
import com.oriente.core.utils.ResUtils;
import com.oriente.core.utils.SpanBuilder;
import com.oriente.core.utils.StringUtils;
import com.oriente.http.callback.RequestCallback;
import com.oriente.http.model.RequestContext;
import com.oriente.http.model.RequestResult;
import com.oriente.manager.OrientManager;
import com.oriente.moduleapi.AnalyticsService;
import com.oriente.uikit.group.ColumnLayout;
import com.oriente.uikit.group.WidgetLayout;
import com.oriente.uikit.group.WrapLayout;
import com.oriente.uikit.group.webview.webview.ProxyWebView;
import com.oriente.uikit.utils.ViewUtils;
import com.oriente.uimodule.alert.Alert;
import com.oriente.uimodule.alert.AlertBuilder;
import com.oriente.user.UserUtils;
import com.oriente.utils.WebViewUtils;
import java.math.BigDecimal;
import java.util.Map;
import org.greenrobot.eventbus.EventBus;

@ScreenName("loan_details")
public class p extends BaseUiFragment implements View.OnClickListener, f.b {
    PairInfoText A;
    PairInfoText B;
    PairInfoText C;
    PairInfoText D;
    ImageView E;
    private com.oriente.cashalo.businese.f F;
    private String G;
    private boolean H;
    private Trace I = FirebasePerformance.getInstance().newTrace("webview-page-render");
    protected String J = getClass().getSimpleName();
    TextView a;
    TextView b;
    TextView c;
    TextView d;
    TextView e;
    TextView f;
    TextView g;
    TextView h;
    TextView i;
    TextView j;
    TextView k;
    TextView l;
    WrapLayout m;
    PairInfoText n;
    PairInfoText o;
    PairInfoText p;
    PairInfoText q;
    PairInfoText r;
    PairInfoText s;
    PairInfoText t;
    PairInfoText u;
    PairInfoText v;
    PairInfoText w;
    PairInfoText x;
    PairInfoText y;
    PairInfoText z;

    class a implements RequestCallback<AutoDebitData> {
        a() {
        }

        public void onRequestFinished(RequestContext<AutoDebitData> requestContext, RequestResult<AutoDebitData> requestResult) {
            if (!requestResult.isSuccessFull() || requestResult.getResult() == null || !StringUtils.isVisibleUnNull(((AutoDebitData) requestResult.getResult()).getTips())) {
                p.this.j.setVisibility(8);
            } else {
                p.this.j.setVisibility(0);
                p.this.j.setText(((AutoDebitData) requestResult.getResult()).getTips());
            }
        }
    }

    class b implements View.OnClickListener {
        final AlertBuilder a;

        b(AlertBuilder alertBuilder) {
            this.a = alertBuilder;
        }

        @Override
        public void onClick(View view) {
            this.a.dismiss();
        }
    }

    class c implements RequestCallback<String> {
        final ProxyWebView a;

        c(ProxyWebView proxyWebView) {
            this.a = proxyWebView;
        }

        public void onRequestFinished(RequestContext<String> requestContext, RequestResult<String> requestResult) {
            if (requestResult.isHttpSuccessFull()) {
                ProxyWebView proxyWebView = this.a;
                String str = (String) requestResult.getResult();
                FS.trackWebView(proxyWebView);
                proxyWebView.loadDataWithBaseURL("", str, "text/html", "UTF-8", null);
            }
        }
    }

    class d extends WebChromeClient {
        d() {
        }

        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            return super.onConsoleMessage(consoleMessage);
        }

        @Override
        public void onGeolocationPermissionsShowPrompt(String str, GeolocationPermissions.Callback callback) {
            OrientManager.getPlugin(AnalyticsService.class).logFirebaseEvent(p.this.J, Jumper.obtain(new Object[]{"geolocation", System.currentTimeMillis() + "", "origin", str}));
            callback.invoke(str, true, true);
            super.onGeolocationPermissionsShowPrompt(str, callback);
        }

        @Override
        public void onProgressChanged(WebView webView, int i) {
            super.onProgressChanged(webView, i);
            if (i == 100) {
                EventBus.getDefault().post(new LoadingEvent(false));
            }
        }

        @Override
        public void onReceivedTitle(WebView webView, String str) {
            super.onReceivedTitle(webView, str);
            OrientManager.getPlugin(AnalyticsService.class).logFirebaseEvent(p.this.J, Jumper.obtain(new Object[]{"received_title", System.currentTimeMillis() + ""}));
        }
    }

    class e extends WebViewClient {
        final String a;
        final ProxyWebView b;

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                e.this.b.scrollTo(0, 0);
            }
        }

        e(String str, ProxyWebView proxyWebView) {
            this.a = str;
            this.b = proxyWebView;
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            OrientManager.getPlugin(AnalyticsService.class).logFirebaseEvent(p.this.J, Jumper.obtain(new Object[]{"page_finished", System.currentTimeMillis() + ""}));
            this.b.postDelayed(new a(), 50L);
            p.this.I.stop();
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            OrientManager.getPlugin(AnalyticsService.class).logFirebaseEvent(p.this.J, Jumper.obtain(new Object[]{"page_started", System.currentTimeMillis() + ""}));
            p.this.I.start();
        }

        @Override
        public void onReceivedError(WebView webView, int i, String str, String str2) {
            OrientManager.getPlugin(AnalyticsService.class).logFirebaseEvent(p.this.J, Jumper.obtain(new Object[]{"received_error", System.currentTimeMillis() + ""}));
            EventBus.getDefault().post(new LoadingEvent(false));
        }

        @Override
        public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            OrientManager.getPlugin(AnalyticsService.class).logFirebaseEvent(p.this.J, Jumper.obtain(new Object[]{"received_ssl_error", System.currentTimeMillis() + ""}));
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            String str2;
            OrientManager.getPlugin(AnalyticsService.class).logFirebaseEvent(p.this.J, Jumper.obtain(new Object[]{"override_url", "1"}));
            if (!p.this.H || (!str.equals(this.a) && ((str2 = p.this.G) == null || !str.equals(str2)))) {
                return Router.from(p.this).deliver(str, RouterScene.WEB) || super.shouldOverrideUrlLoading(webView, str);
            }
            FS.trackWebView(webView);
            webView.loadUrl(str);
            return false;
        }
    }

    private void a(LoanHistoryItem loanHistoryItem, LoanStatus loanStatus) {
        TextView textView = (TextView) ViewUtils.view(this, R.id.tvLoanAmountDes);
        TextView textView2 = (TextView) ViewUtils.view(this, R.id.tvLoanDateDesc);
        loanStatus.applyStatus(this.a);
        loanStatus.applyDueAmountDateDesc(textView2, "", false);
        loanStatus.applyDueAmountDateDesc(textView, "", true);
        if (loanStatus.isState(LoanState.PAID)) {
            ViewUtils.setVisibility(this.d, 8);
            ViewUtils.setVisibility(this.e, 8);
            this.c.setText(StringUtils.isInvisibleOrNull(loanHistoryItem.repaidAt) ? loanHistoryItem.dueAt : loanHistoryItem.repaidAt);
            this.b.setText(FormatUtils.unit2DotLower(loanHistoryItem.dueAmount, 0.8f, ResUtils.dip2px(5.0f), 0.0f));
            this.b.setTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_text_primary));
        } else {
            ViewUtils.setVisibility(this.d, 0);
            ViewUtils.setVisibility(this.e, 0);
            this.c.setText(loanHistoryItem.dueAt);
            this.b.setText(FormatUtils.unit2DotLower(loanHistoryItem.dueAmount, 0.8f, ResUtils.dip2px(5.0f), 0.0f));
        }
        a(loanStatus, loanHistoryItem.loanId);
        this.F.i();
        b(loanHistoryItem.loanId);
    }

    private void b(String str) {
        com.oriente.cashalo.service.a.c(str, new RequestContext.Builder(this).loadingAllowed(false).build(new a()));
    }

    private boolean c(String str) {
        return ProductModel.PMI.code.equals(str);
    }

    private void d(String str) {
        View inflate = LayoutInflater.from(getActivity()).inflate(com.oriente.verify.R.layout.dialog_agreement, (ViewGroup) null);
        ProxyWebView view = ViewUtils.view(inflate, com.oriente.verify.R.id.webView);
        AlertBuilder dismissBackpress = Alert.from(getActivity()).custView(inflate).dismissTouchOut(false).dismissBackpress(false);
        ColumnLayout view2 = ViewUtils.view(inflate, com.oriente.verify.R.id.alert_buttons);
        ViewUtils.view(inflate, com.oriente.verify.R.id.alert_button_left).setVisibility(8);
        view2.setColumnNumber(1);
        ViewUtils.view(inflate, com.oriente.verify.R.id.alert_button_right).setText(ResUtils.string(com.oriente.adapter.R.string.ori_common_btn_ok));
        inflate.findViewById(com.oriente.verify.R.id.alert_button_right).setOnClickListener(new b(dismissBackpress));
        dismissBackpress.show();
        if (str != null && str.endsWith(".pdf")) {
            str = "https://docs.google.com/gview?embedded=true&url=" + str;
            this.G = "https://docs.google.com/viewerng/viewer?url=" + str;
            this.H = true;
        }
        if (str != null && (str.startsWith("https://api.cashalo.com") || str.startsWith("https://stg-api.cashalo.com"))) {
            if (ValueConfig.isDevDebug() && str.indexOf("api.cashalo.com") > 0) {
                str = str.replace("api.cashalo.com", "stg-api.cashalo.com");
            }
            PluginService.getRawString(str, new RequestContext.Builder(this).build(new c(view)));
        }
        if (view != null) {
            view.setDefaultWebChrome(new d());
            view.setDefaultWebClient(new e(str, view));
            WebViewUtils.INSTANCE.updateConfig(view);
        }
        if (str == null || str.startsWith("https://api.cashalo.com") || str.startsWith("https://stg-api.cashalo.com")) {
            return;
        }
        a((WebView) view, str);
    }

    @Override
    protected String getDurationScreenEventName() {
        return "durationLoanDetailsScreen";
    }

    @Override
    public void onClick(View view) {
        LoanDetailsModel a2 = this.F.a();
        if (a2 != null) {
            int id = view.getId();
            if (R.id.tvPayNow == id) {
                GlobalSession.remove(ValueConfig.BUNDLE_KEY_LOAN_ITEM);
                GlobalSession.remove(ValueConfig.BUNDLE_KEY_LOAN_DETAILS);
                GlobalSession.remove(ValueConfig.BUNDLE_KEY_LOAN_EARLY);
                GlobalSession.put(ValueConfig.BUNDLE_KEY_LOAN_DETAILS, a2);
                Router.from(this).deliver(RouterUri.PAYMENT_OPTION_PAGE, RouterScene.INNER);
                a("Pay");
                return;
            }
            if (R.id.pairAdapter == id) {
                if (this.F.h()) {
                    Jumper.from(this).argument(Jumper.obtain(new Object[]{ValueConfig.BUNDLE_PAGE_ENTITY, a2, t.d, Boolean.valueOf(this.F.h())})).jumpFragment(t.class);
                    a("RepaymentSchedule");
                    return;
                }
                return;
            }
            if (R.id.tvEarlyPay != id) {
                if (R.id.totalInsurancePremiumIv == id && StringUtils.isVisibleUnNull(a2.insuranceSummaryUrl)) {
                    d(a2.insuranceSummaryUrl);
                    return;
                }
                return;
            }
            GlobalSession.remove(ValueConfig.BUNDLE_KEY_LOAN_ITEM);
            GlobalSession.remove(ValueConfig.BUNDLE_KEY_LOAN_DETAILS);
            GlobalSession.remove(ValueConfig.BUNDLE_KEY_LOAN_EARLY);
            GlobalSession.put(ValueConfig.BUNDLE_KEY_LOAN_EARLY, Boolean.TRUE);
            GlobalSession.put(ValueConfig.BUNDLE_KEY_LOAN_DETAILS, a2);
            Router.from(this).deliver(RouterUri.PAYMENT_OPTION_PAGE, RouterScene.INNER);
            a("Pay");
        }
    }

    @Override
    protected void onContentViewCreated(View view, Bundle bundle, Bundle bundle2) {
        this.F = new com.oriente.cashalo.businese.f(getPageId(), bundle, this);
        this.mTitleBar.setDividerHeight(0);
        this.a = (TextView) ViewUtils.view(view, R.id.tvLoanStatus);
        this.b = (TextView) ViewUtils.view(view, R.id.tvLoanAmount);
        this.c = (TextView) ViewUtils.view(view, R.id.tvLoanDate);
        this.d = (TextView) ViewUtils.view(view, R.id.tvPayNow);
        this.e = (TextView) ViewUtils.view(view, R.id.tvPayTips);
        this.h = (TextView) ViewUtils.view(view, R.id.tvPeriod);
        this.i = (TextView) ViewUtils.view(view, R.id.tvEarlyPay);
        this.j = (TextView) ViewUtils.view(view, R.id.autoDebitTips);
        this.o = ViewUtils.view(view, R.id.pairTips);
        this.n = ViewUtils.view(view, R.id.pairAdapter);
        this.p = ViewUtils.view(view, R.id.pairAmount);
        this.l = (TextView) ViewUtils.view(view, R.id.totalInsurancePremiumTv);
        this.k = (TextView) ViewUtils.view(view, R.id.totalInsurancePremiumTitleTv);
        this.m = ViewUtils.view(view, R.id.totalInsurancePremiumLy);
        this.q = ViewUtils.view(view, R.id.pairCertificateOfCoverTax);
        this.r = ViewUtils.view(view, R.id.pairPrincipalFee);
        this.s = ViewUtils.view(view, R.id.pairLoanAmount);
        this.t = ViewUtils.view(view, R.id.pairLoanProcessFee);
        this.u = ViewUtils.view(view, R.id.pairInterestFee);
        this.v = ViewUtils.view(view, R.id.pairPlatformFee);
        this.w = ViewUtils.view(view, R.id.pairPaymentFee);
        this.x = ViewUtils.view(view, R.id.pairLatePaymentPenalty);
        this.y = ViewUtils.view(view, R.id.pairInstallments);
        this.z = ViewUtils.view(view, R.id.pairTerms);
        this.A = ViewUtils.view(view, R.id.pairPurpose);
        PairInfoText view2 = ViewUtils.view(view, R.id.pairBankAccount);
        this.B = view2;
        view2.setLayoutHorizontalByWeight(1.0f, 2.0f);
        this.C = ViewUtils.view(view, R.id.paircumulativePenalty);
        this.D = ViewUtils.view(view, R.id.pairAfterMaturityDateInterest);
        this.f = (TextView) ViewUtils.view(view, R.id.tvLoanAgreement);
        this.g = (TextView) ViewUtils.view(view, R.id.loan_details_apply_date);
        this.n.setOnClickListener(this);
        this.i.setOnClickListener(this);
        this.h.setVisibility(8);
        this.i.setVisibility(8);
        ViewUtils.view(view, R.id.tvPayNow).setOnClickListener(this);
        ImageView imageView = (ImageView) ViewUtils.view(view, R.id.totalInsurancePremiumIv);
        this.E = imageView;
        imageView.setOnClickListener(this);
        LoanStatus d2 = this.F.d();
        if (this.F.f()) {
            a(this.F.b(), d2);
        } else {
            a(this.F.a(), d2, true);
        }
        if (this.F.h() && d2.isState(LoanState.PAID)) {
            ((TextView) ViewUtils.view(this, R.id.tvLoanDateDesc)).setText(R.string.ori_loan_details_desc_date_repayment);
        }
        if (d2.isState(LoanState.OVERDUE)) {
            ViewUtils.setVisibility(this.o, 0);
            if (d2.isInGraceDay()) {
                this.o.setDescText(ResUtils.string(R.string.ori_home_myloan_tips_payment_discount));
                this.o.setDescTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_text_notice));
                this.o.setBackgroundColor(ResUtils.color(com.oriente.adapter.R.color.ori_notice));
            } else {
                this.o.setDescText(ResUtils.string(R.string.ori_home_myloan_tips_payment_overdue));
                this.o.setDescTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_text_notice_importance));
                this.o.setBackgroundColor(ResUtils.color(com.oriente.adapter.R.color.ori_notice_importance));
            }
        }
    }

    @Override
    protected View onCreateContentView(LayoutInflater layoutInflater, ViewGroup viewGroup) {
        return layoutInflater.inflate(R.layout.fragment_loan_details, viewGroup, false);
    }

    @Override
    public void onVisibleChanged(boolean z) {
        if (!z || this.F == null) {
            return;
        }
        PageIdentify pageIdentify = getPageIdentify();
        String name = pageIdentify.getName();
        pageIdentify.recycle();
        LoanStatus d2 = this.F.d();
        OrientManager.getPlugin(AnalyticsService.class).trackingFactory().screen(name).put("status", d2.getStatusResource()).put("days", Integer.valueOf(d2.getDays())).put("load_id", this.F.c()).track();
    }

    private void a(LoanDetailsModel loanDetailsModel, LoanStatus loanStatus, boolean z) {
        boolean h = this.F.h();
        if (z) {
            TextView textView = (TextView) ViewUtils.view(this, R.id.tvLoanAmountDes);
            TextView textView2 = (TextView) ViewUtils.view(this, R.id.tvLoanDateDesc);
            loanStatus.applyStatus(this.a);
            LoanPaymentDetails loanPaymentDetails = loanDetailsModel.repayingDetail;
            if (loanPaymentDetails != null) {
                String str = h ? loanPaymentDetails.term : "";
                loanStatus.applyDueAmountDateDesc(textView2, "", false);
                loanStatus.applyDueAmountDateDesc(textView, "", true);
                if (StringUtils.isVisibleUnNull(str)) {
                    this.h.setText(String.format(ResUtils.string(R.string.ori_loan_details_desc_period_format), str));
                    this.h.setVisibility(0);
                }
                if (loanStatus.isState(LoanState.PAID)) {
                    ViewUtils.setVisibility(this.d, 8);
                    ViewUtils.setVisibility(this.e, 8);
                    this.c.setText(loanPaymentDetails.dueAt);
                    this.b.setText(FormatUtils.unit2DotLower(loanPaymentDetails.dueAmount, 0.8f, ResUtils.dip2px(5.0f), 0.0f));
                    this.b.setTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_text_primary));
                } else {
                    ViewUtils.setVisibility(this.d, 0);
                    ViewUtils.setVisibility(this.e, 0);
                    this.c.setText(loanPaymentDetails.dueAt);
                    this.b.setText(FormatUtils.unit2DotLower(loanPaymentDetails.dueAmount, 0.8f, ResUtils.dip2px(5.0f), 0.0f));
                    if (loanStatus.getOverDueDays() > 0) {
                        this.c.setTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_text_warning));
                        this.b.setTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_text_warning));
                        if (loanStatus.isInGraceDay() && StringUtils.isVisibleUnNull(loanPaymentDetails.beforeDiscountDueAmount)) {
                            this.b.setText(FormatUtils.unit2DotLower(loanPaymentDetails.beforeDiscountDueAmount, 0.8f, ResUtils.dip2px(5.0f), 0.0f));
                        }
                    }
                }
            }
        }
        ViewUtils.setVisibility(ViewUtils.view(this, R.id.layoutDetails), 0);
        a(loanDetailsModel, h, loanStatus);
        a(loanStatus, loanDetailsModel.loanId);
        if (StringUtils.isVisibleUnNull(loanDetailsModel.loanType) && (TextUtils.equals(loanDetailsModel.loanType, ProductModel.EMPLOYEELOAN.code) || TextUtils.equals(loanDetailsModel.loanType, ProductModel.LAZATALOAN.code))) {
            ViewUtils.setVisibility(this.E, 0);
        } else {
            ViewUtils.setVisibility(this.E, 8);
        }
        b(loanDetailsModel.loanId);
    }

    private void a(LoanDetailsModel loanDetailsModel, boolean z, LoanStatus loanStatus) {
        Boolean bool;
        int dip2px = ResUtils.dip2px(2.0f);
        if (z) {
            this.p.setVisibility(8);
            this.y.setValueText(loanDetailsModel.installments, true);
            float f = dip2px;
            this.r.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.principal, 1.0f, f, 0.0f));
            this.r.setVisibility(AmountUtils.toDouble(loanDetailsModel.principal, 0.0d) == 0.0d ? 8 : 0);
            this.s.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.repayingDetail.desiredAmount, 1.0f, f, 0.0f));
        } else {
            this.r.setVisibility(8);
            this.s.setVisibility(8);
            this.y.setVisibility(8);
            this.p.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.repayingDetail.desiredAmount, 1.0f, dip2px, 0.0f));
            WidgetLayout.LayoutParams layoutParams = this.t.getLayoutParams();
            boolean z2 = layoutParams instanceof WidgetLayout.LayoutParams;
            if (z2) {
                layoutParams.leftMargin = 0;
            }
            this.t.setDescTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_black));
            this.t.setValueTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_black));
            WidgetLayout.LayoutParams layoutParams2 = this.m.getLayoutParams();
            if (z2) {
                layoutParams2.leftMargin = 0;
            }
            TextView textView = this.k;
            if (textView != null) {
                textView.setTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_black));
            }
            TextView textView2 = this.l;
            if (textView2 != null) {
                textView2.setTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_black));
            }
        }
        float f2 = dip2px;
        this.t.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.processingFee, 1.0f, f2, 0.0f));
        this.t.setVisibility(AmountUtils.toDouble(loanDetailsModel.processingFee, 0.0d) == 0.0d ? 8 : 0);
        this.u.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.interest, 1.0f, f2, 0.0f));
        String str = loanDetailsModel.interestFee;
        BigDecimal bigDecimal = BigDecimal.ZERO;
        if (AmountUtils.toBigDecimal(str, bigDecimal).compareTo(bigDecimal) == 1) {
            this.u.setDescText(ResUtils.string(R.string.ori_loan_details_desc_interest_overdue));
        } else {
            this.u.setDescText(ResUtils.string(R.string.ori_loan_details_desc_interest));
        }
        this.u.setVisibility(AmountUtils.toDouble(loanDetailsModel.interest, 1.0d) == 0.0d ? 8 : 0);
        this.v.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.platformServiceFee, 1.0f, f2, 0.0f));
        this.v.setVisibility(AmountUtils.toDouble(loanDetailsModel.platformServiceFee, 0.0d) == 0.0d ? 8 : 0);
        this.C.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.cumulativePenalty, 1.0f, f2, 0.0f));
        this.C.setVisibility(AmountUtils.toDouble(loanDetailsModel.cumulativePenalty, 0.0d) == 0.0d ? 8 : 0);
        this.D.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.interestFee, 1.0f, f2, 0.0f));
        this.D.setVisibility(AmountUtils.toDouble(loanDetailsModel.interestFee, 0.0d) == 0.0d ? 8 : 0);
        this.w.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.repaymentFee, 1.0f, f2, 0.0f));
        this.w.setVisibility(AmountUtils.toDouble(loanDetailsModel.repaymentFee, 0.0d) == 0.0d ? 8 : 0);
        this.l.setText(FormatUtils.unit2DotLower(loanDetailsModel.totalInsurancePremium, 1.0f, f2, 0.0f));
        this.m.setVisibility(AmountUtils.toDouble(loanDetailsModel.totalInsurancePremium, 0.0d) == 0.0d ? 8 : 0);
        this.q.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.policyGenerationFee, 1.0f, f2, 0.0f));
        this.q.setVisibility(AmountUtils.toDouble(loanDetailsModel.policyGenerationFee, 0.0d) == 0.0d ? 8 : 0);
        if (!StringUtils.isInvisibleOrNull(loanDetailsModel.oneTimePenalty) && AmountUtils.toFloat(loanDetailsModel.oneTimePenalty, 1.0f) != 0.0f) {
            this.x.setValueText(FormatUtils.unit2DotLower(loanDetailsModel.oneTimePenalty, 1.0f, f2, 0.0f));
            this.x.setVisibility(0);
        } else {
            this.x.setVisibility(8);
        }
        if (loanStatus.isState(LoanState.PAID)) {
            this.x.setValueTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_black));
        }
        StringBuilder sb = new StringBuilder();
        if (this.F.g()) {
            if (AmountUtils.toInt(loanDetailsModel.installments, 0) > 1) {
                sb.append(String.format(ResUtils.string(R.string.ori_loan_details_desc_format_month), loanDetailsModel.installments));
            } else {
                sb.append(String.format(ResUtils.string(com.oriente.borrow.R.string.ori_borrow_desc_extend_loan_month), loanDetailsModel.installments));
            }
        } else if (StringUtils.isVisibleUnNull(loanDetailsModel.days)) {
            sb.append(String.format(ResUtils.string(R.string.ori_loan_details_desc_format_days), loanDetailsModel.days));
        }
        if (StringUtils.isVisibleUnNull(loanDetailsModel.effectiveAt) && StringUtils.isVisibleUnNull(loanDetailsModel.dueAt)) {
            sb.append('\n');
            sb.append(loanDetailsModel.effectiveAt);
            sb.append(" - ");
            sb.append(loanDetailsModel.dueAt);
        }
        this.z.setValueText(sb, true);
        this.A.setValueText(loanDetailsModel.purpose, true);
        if (LoanDetailsModel.SCENARIO_CONSUMER.equals(loanDetailsModel.scenario)) {
            if (c(loanDetailsModel.loanType)) {
                this.A.setDescText(ResUtils.string(R.string.ori_loan_details_desc_store));
                this.A.setValueText(loanDetailsModel.storeName);
                this.B.setVisibility(8);
            } else {
                this.B.setValueText(loanDetailsModel.bankAccount);
            }
        } else {
            if (ProductModel.EXTENDLOAN.code.equals(loanDetailsModel.loanType)) {
                this.B.setVisibility(8);
                this.A.setValueText(ResUtils.string(R.string.ori_loan_details_desc_loan_extension));
            } else if (ProductModel.CASHABUY.code.equals(loanDetailsModel.loanType)) {
                this.A.setValueText(loanDetailsModel.purpose, true);
                this.A.setDescText(ResUtils.string(R.string.ori_loan_details_desc_casharcredit_receivables));
                this.B.setDescText(ResUtils.string(R.string.ori_loan_details_desc_casharcredit_bill_no));
                this.B.setValueText(loanDetailsModel.outOrderNo);
                this.B.setVisibility(0);
            } else {
                this.B.setDescText(a(loanDetailsModel));
                this.B.setValueText(loanDetailsModel.bankAccount);
                this.B.setVisibility(0);
            }
            this.A.setVisibility(0);
        }
        String str2 = loanDetailsModel.appliedAt;
        SpanBuilder create = SpanBuilder.create(ResUtils.string(R.string.ori_loan_details_desc_view_document), new int[0]);
        if (this.F.a() != null && this.F.a().agreementList != null && this.F.a().agreementList.size() > 0) {
            for (int i = 0; i < this.F.a().agreementList.size(); i++) {
                final AgreementModel agreementModel = this.F.a().agreementList.get(i);
                if (i != 0) {
                    create.append(", ", SpanBuilder.createColor(ResUtils.color(com.oriente.adapter.R.color.ori_text_secondary), false));
                }
                create.append(agreementModel.agreementName, SpanBuilder.createClick(ResUtils.color(com.oriente.adapter.R.color.ori_text_link), new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        p.this.a(agreementModel, view);
                    }
                }, this.f));
            }
        }
        create.apply(this.f);
        this.g.setText(StringUtils.strim(str2) + " " + String.format(ResUtils.string(R.string.ori_loan_details_tips_date_loan_apply), loanDetailsModel.number));
        EarlyRepaymentOption earlyRepaymentOption = loanDetailsModel.earlyRepaymentOption;
        if (earlyRepaymentOption != null && (bool = earlyRepaymentOption.earlyShow) != null && bool.booleanValue()) {
            this.i.setVisibility(0);
        } else {
            this.i.setVisibility(8);
        }
    }

    public void a(AgreementModel agreementModel, View view) {
        int i;
        int i2;
        int i3;
        int i4;
        if (agreementModel != null && StringUtils.isVisibleUnNull(agreementModel.tipText)) {
            if (StringUtils.isVisibleUnNull(this.F.a().serviceTel)) {
                i = agreementModel.tipText.indexOf(this.F.a().serviceTel);
                i2 = this.F.a().serviceTel.length() + i;
            } else {
                i = 0;
                i2 = 0;
            }
            if (StringUtils.isVisibleUnNull(this.F.a().serviceEmail)) {
                i3 = agreementModel.tipText.indexOf(this.F.a().serviceEmail);
                i4 = this.F.a().serviceEmail.length() + i3;
            } else {
                i3 = 0;
                i4 = 0;
            }
            SpanBuilder create = SpanBuilder.create(agreementModel.tipText, new int[0]);
            if (i > 0 && i2 > 0 && i2 >= i) {
                create.color(i, i2, ResUtils.color(com.oriente.adapter.R.color.ori_text_warning), false);
            }
            if (i3 > 0 && i4 > 0 && i4 >= i3) {
                create.color(i3, i4, ResUtils.color(com.oriente.adapter.R.color.ori_text_warning), false);
            }
            Alert.from(this).dismissBackpress(false).dismissTouchOut(false).message(create.build()).button(ResUtils.string(com.oriente.adapter.R.string.ori_common_btn_ok)).show();
            return;
        }
        if (agreementModel == null || !StringUtils.isVisibleUnNull(agreementModel.agreementUrl)) {
            return;
        }
        a(view, agreementModel.agreementUrl, agreementModel.agreementName, agreementModel.downloadFlag);
        a(agreementModel.agreementName);
    }

    private String a(LoanDetailsModel loanDetailsModel) {
        String str = loanDetailsModel.bankAccountType;
        str.hashCode();
        str.hashCode();
        switch (str) {
            case "2":
                return ResUtils.string(R.string.ori_loan_details_desc_to_paymaya);
            case "3":
                return ResUtils.string(R.string.ori_loan_details_desc_to_lazada);
            case "4":
                return ResUtils.string(R.string.ori_loan_details_desc_to_gcash);
            default:
                return ResUtils.string(R.string.ori_loan_details_desc_to_bank);
        }
    }

    private void a(LoanStatus loanStatus, String str) {
        if (this.F.h()) {
            this.n.setVisibility(0);
            this.n.setDescText(ResUtils.string(R.string.ori_loan_details_desc_repayment_schedule));
            if (!loanStatus.isState(LoanState.PAID)) {
                ((TextView) ViewUtils.view(this, R.id.tvLoanAmountDes)).setText(R.string.ori_loan_details_desc_amount_due);
            }
            if (loanStatus.isState(LoanState.OVERDUE)) {
                int e2 = this.F.e();
                if (e2 > 0) {
                    if (e2 > 1) {
                        this.a.setText(com.oriente.adapter.R.string.ori_component_tag_overdues);
                    }
                    this.n.setValueText(String.format("%d %s", Integer.valueOf(e2), ResUtils.string(com.oriente.adapter.R.string.ori_component_tag_overdues)));
                    this.n.setValueTextColor(ResUtils.color(com.oriente.adapter.R.color.ori_text_warning));
                    return;
                }
                if (this.F.g()) {
                    this.a.setText(com.oriente.adapter.R.string.ori_component_tag_overdues);
                }
            }
        }
    }

    private void a(View view, String str, String str2, String str3) {
        if (str2.endsWith("、") || str2.endsWith("、")) {
            str2 = str2.substring(0, str2.length() - 1);
        }
        Jumper.from(this).argument(Jumper.obtain(new Object[]{ValueConfig.BUNDLE_PAGE_TITLE, str2, ValueConfig.BUNDLE_PAGE_URL, str, ValueConfig.BUNDLE_WEBVIEW_GOBACK, Boolean.TRUE, BorrowInfo.ORDER_NO, this.F.a() != null ? this.F.a().number : "", "contractName", str2, "contractUrl", str, "needCheckEmail", Boolean.valueOf(TextUtils.equals("1", str3))})).jumpFragment(WebViewFragment.class);
    }

    protected void a(WebView webView, String str) {
        if (webView != null) {
            Map<String, String> collectHttpHeader = OrientUtils.collectHttpHeader();
            collectHttpHeader.put("accessToken", UserUtils.getAccessToken());
            if (str.startsWith(WebViewFragment.HOST) && !WebViewFragment.HOST.equals(ValueConfig.sRequestHost)) {
                str = str.replace(WebViewFragment.HOST, ValueConfig.sRequestHost);
            }
            FS.trackWebView(webView);
            webView.loadUrl(str, collectHttpHeader);
        }
    }

    @Override
    public void a(RequestResult<LoanDetailsModel> requestResult) {
        if (!requestResult.isBizSuccess() || requestResult.getResult() == null || requestResult.getResult() == null || requestResult.getResult() == null) {
            return;
        }
        a((LoanDetailsModel) requestResult.getResult(), this.F.d(), false);
    }

    private void a(String str) {
        LoanPaymentDetails loanPaymentDetails;
        LoanStatus d2 = this.F.d();
        LoanDetailsModel a2 = this.F.a();
        CommonAnalytics.analyticsClick(getPageId(), str, CommonAnalytics.toProperties("status", d2.getStatusResource(), "days", Integer.valueOf(d2.getDays()), "loan_id", this.F.c(), "loan_type", (a2 == null || (loanPaymentDetails = a2.repayingDetail) == null) ? null : loanPaymentDetails.productType));
    }
}