正在查看: Easycash v3.75.13 应用的 IntentOrderCardExp3.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Easycash v3.75.13 应用的 IntentOrderCardExp3.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.lingyue.easycash.widget;
import android.content.Context;
import android.text.InputFilter;
import android.text.TextUtils;
import android.text.method.DigitsKeyListener;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.lingyue.easycash.R;
import com.lingyue.easycash.adapters.AuthLoanAmountAdapter;
import com.lingyue.easycash.adapters.AuthLoanTermAdapter;
import com.lingyue.easycash.business.loan.AmountCheckUtil;
import com.lingyue.easycash.commom.EasyCashCommonActivity;
import com.lingyue.easycash.models.intentionorder.IntentOrderDisplayStrategy;
import com.lingyue.easycash.models.intentionorder.IntentionCalculateResponse;
import com.lingyue.easycash.models.intentionorder.IntentionProduct;
import com.lingyue.easycash.models.intentionorder.LoanPrincipalOption;
import com.lingyue.easycash.models.intentionorder.RepaymentPlan;
import com.lingyue.easycash.models.intentionorder.RepaymentPlanTip;
import com.lingyue.easycash.models.intentionorder.SingleLoanProduct;
import com.lingyue.easycash.widght.AuthGeneralView;
import com.lingyue.easycash.widght.BaseAuthGeneralView;
import com.lingyue.idnbaselib.utils.EcFormatUtil;
import com.lingyue.idnbaselib.widget.OnItemClickListener;
import com.lingyue.supertoolkit.customtools.CollectionUtils;
import com.lingyue.supertoolkit.functions.Func1;
import com.yangqianguan.statistics.AutoTrackHelper;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class IntentOrderCardExp3 extends FrameLayout {
private EasyCashCommonActivity a;
@BindView(R.id.auth_loan_repayment_info_v2)
RepaymentInfoForAuthViewV2 authLoanRepaymentInfo;
private AuthLoanAmountAdapter b;
private AuthLoanTermAdapter c;
@BindView(R.id.cv_estimated_repayment_schedule)
CardView cvEstimatedRepaymentSchedule;
private AuthLoanAmountAndTermCardListener d;
private SingleLoanProduct e;
private IntentionProduct f;
private RepaymentPlan g;
@NonNull
private volatile AmountCheckUtil h;
private List<LoanPrincipalOption> i;
@BindView(R.id.iv_need_higher_amount)
ImageView ivNeedHigherAmount;
private List<RepaymentPlan> j;
private boolean k;
private boolean l;
@BindView(R.id.loan_amount)
AuthGeneralView loanAmountView;
@BindView(R.id.rv_desired_loan_amount)
RecyclerView rvDesiredLoanAmount;
@BindView(R.id.rv_desired_repayment_term)
RecyclerView rvDesiredRepaymentTerm;
public interface AuthLoanAmountAndTermCardListener {
void a(AuthGeneralView authGeneralView);
void b(@NonNull RepaymentPlan repaymentPlan);
void c(@NonNull LoanPrincipalOption loanPrincipalOption);
void d(IntentionProduct intentionProduct);
}
public IntentOrderCardExp3(@NonNull Context context) {
super(context, null);
this.f = new IntentionProduct();
this.h = new AmountCheckUtil(new BigDecimal(60000000), new BigDecimal(100000));
this.i = new ArrayList();
this.j = new ArrayList();
this.k = false;
this.l = true;
}
private void A(List<RepaymentPlan> list) {
int i;
if (TextUtils.isEmpty(this.f.terms) || CollectionUtils.f(list)) {
x();
return;
}
this.g = null;
if (n()) {
String str = this.f.terms;
if (!CollectionUtils.f(list)) {
i = 0;
while (i < list.size()) {
RepaymentPlan repaymentPlan = list.get(i);
if (TextUtils.equals(str, String.valueOf(repaymentPlan.terms))) {
this.g = repaymentPlan;
break;
}
i++;
}
}
i = -1;
if (i == -1) {
IntentionProduct intentionProduct = this.f;
intentionProduct.terms = null;
intentionProduct.timePeriod = null;
intentionProduct.timeUnit = null;
intentionProduct.productId = null;
} else {
this.f.timePeriod = Integer.valueOf(this.g.timePeriod);
IntentionProduct intentionProduct2 = this.f;
RepaymentPlan repaymentPlan2 = this.g;
intentionProduct2.timeUnit = repaymentPlan2.timeUnit;
intentionProduct2.productId = repaymentPlan2.productId;
}
this.c.i(i);
this.c.notifyDataSetChanged();
}
this.d.d(this.f);
w();
}
private void B(IntentionCalculateResponse.UserCreditsInfo userCreditsInfo) {
if (userCreditsInfo == null || !userCreditsInfo.isValid()) {
return;
}
if (this.h.a.doubleValue() == userCreditsInfo.maxAmount && this.h.b.doubleValue() == userCreditsInfo.minAmount) {
return;
}
this.h = new AmountCheckUtil(new BigDecimal(userCreditsInfo.maxAmount), new BigDecimal(userCreditsInfo.minAmount));
}
private void g(RepaymentPlan repaymentPlan) {
this.authLoanRepaymentInfo.setVisibility(0);
RepaymentInfoForAuthViewV2 repaymentInfoForAuthViewV2 = this.authLoanRepaymentInfo;
RepaymentPlan.InnerDisplay innerDisplay = repaymentPlan.display;
repaymentInfoForAuthViewV2.b(innerDisplay.dailyInterestRate, innerDisplay.repayAmount);
RepaymentInfoForAuthViewV2 repaymentInfoForAuthViewV22 = this.authLoanRepaymentInfo;
RepaymentPlanTip repaymentPlanTip = this.e.repaymentPlanTip;
repaymentInfoForAuthViewV22.c(repaymentPlanTip.content, repaymentPlanTip.boldWords);
}
private void j(final AuthGeneralView authGeneralView) {
authGeneralView.d().setTextSize(2, 10.0f);
authGeneralView.d().setTextColor(getResources().getColor(2131099807));
authGeneralView.getEtContent().setKeyListener(DigitsKeyListener.getInstance("0123456789"));
authGeneralView.getEtContent().setInputType(2);
authGeneralView.getEtContent().setFilters(new InputFilter[]{new InputFilter.LengthFilter(17)});
authGeneralView.setFormatter(new BaseAuthGeneralView.Formatter() {
@Override
public final String a(String str) {
String o;
o = IntentOrderCardExp3.this.o(str);
return o;
}
});
authGeneralView.getEtContent().setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
boolean p;
p = IntentOrderCardExp3.this.p(authGeneralView, textView, i, keyEvent);
return p;
}
});
authGeneralView.setOnFocusListener(new BaseAuthGeneralView.OnFocusListener() {
@Override
public final void a() {
IntentOrderCardExp3.this.q();
}
});
authGeneralView.setOnLoseFocusListener(new BaseAuthGeneralView.OnLoseFocusListener() {
@Override
public final void a() {
IntentOrderCardExp3.this.r(authGeneralView);
}
});
}
private void k() {
AuthLoanAmountAdapter authLoanAmountAdapter = new AuthLoanAmountAdapter(this.a, this.i);
this.b = authLoanAmountAdapter;
authLoanAmountAdapter.i(new OnItemClickListener() {
public final void a(View view, int i, Object obj) {
IntentOrderCardExp3.this.s(view, i, (LoanPrincipalOption) obj);
}
});
this.rvDesiredLoanAmount.setAdapter(this.b);
}
private void l() {
AuthLoanTermAdapter authLoanTermAdapter = new AuthLoanTermAdapter(this.a, this.j);
this.c = authLoanTermAdapter;
authLoanTermAdapter.h(new OnItemClickListener() {
public final void a(View view, int i, Object obj) {
IntentOrderCardExp3.this.t(view, i, obj);
}
});
this.rvDesiredRepaymentTerm.setAdapter(this.c);
}
private boolean n() {
if (this.k) {
return this.h.b(y(this.loanAmountView.getAmountText()));
}
return true;
}
public String o(String str) {
if (str.length() == 0) {
u("");
return str;
}
String replaceAll = str.replaceAll("[^0-9]", "");
BigDecimal y2 = y(replaceAll);
u(replaceAll);
return TextUtils.isEmpty(replaceAll) ? "" : EcFormatUtil.l(y2);
}
public boolean p(AuthGeneralView authGeneralView, TextView textView, int i, KeyEvent keyEvent) {
if (i != 5 && i != 6) {
return false;
}
this.a.hideSoftInput();
authGeneralView.getEtContent().clearFocus();
this.d.a(authGeneralView);
return true;
}
public void q() {
u(this.loanAmountView.getAmountText());
}
public void r(AuthGeneralView authGeneralView) {
this.a.hideSoftInput();
if (TextUtils.isEmpty(this.loanAmountView.getAmountText())) {
this.loanAmountView.d().setVisibility(4);
}
this.d.a(authGeneralView);
}
public void s(View view, int i, LoanPrincipalOption loanPrincipalOption) {
if (loanPrincipalOption == null) {
AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, loanPrincipalOption);
return;
}
this.loanAmountView.getEtContent().setText("");
this.k = false;
this.loanAmountView.setVisibility(8);
this.ivNeedHigherAmount.animate().rotation(0.0f);
this.f.principal = loanPrincipalOption.principal;
x();
this.d.c(loanPrincipalOption);
AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, loanPrincipalOption);
}
public void t(View view, int i, Object obj) {
if (obj == null) {
AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, obj);
return;
}
if (!n()) {
IntentionProduct intentionProduct = this.f;
intentionProduct.principal = null;
this.d.d(intentionProduct);
x();
AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, obj);
return;
}
RepaymentPlan repaymentPlan = (RepaymentPlan) obj;
this.f.terms = String.valueOf(repaymentPlan.terms);
this.f.timePeriod = Integer.valueOf(repaymentPlan.timePeriod);
IntentionProduct intentionProduct2 = this.f;
intentionProduct2.timeUnit = repaymentPlan.timeUnit;
intentionProduct2.productId = repaymentPlan.productId;
this.g = repaymentPlan;
w();
this.d.b(repaymentPlan);
AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, obj);
}
private void u(String str) {
BigDecimal y2 = y(str);
boolean hasFocus = this.loanAmountView.getEtContent().hasFocus();
x();
if (this.h.b(y2)) {
this.loanAmountView.p();
this.loanAmountView.d().setVisibility(4);
if (hasFocus) {
this.d.a(this.loanAmountView);
this.f.principal = y2;
return;
}
return;
}
String a = this.h.a(this.a, str);
if (TextUtils.isEmpty(str)) {
this.loanAmountView.p();
this.loanAmountView.d().setTextColor(getResources().getColor(2131099780));
} else {
this.loanAmountView.r();
this.loanAmountView.d().setTextColor(getResources().getColor(2131099807));
}
this.loanAmountView.d().setText(a);
this.loanAmountView.d().setVisibility(0);
if (!hasFocus && TextUtils.isEmpty(str)) {
this.loanAmountView.d().setVisibility(4);
}
IntentionProduct intentionProduct = this.f;
intentionProduct.principal = null;
this.d.d(intentionProduct);
x();
}
private void w() {
RepaymentPlan repaymentPlan = this.g;
if (repaymentPlan == null || repaymentPlan.display == null || (this.f.principal == null && !n())) {
this.authLoanRepaymentInfo.setVisibility(8);
} else {
g(this.g);
}
}
private void x() {
this.g = null;
this.authLoanRepaymentInfo.setVisibility(8);
}
@NonNull
private BigDecimal y(String str) {
return this.h.g(str);
}
@OnClick({R.id.tv_need_higher_amount})
public void clickNeedHigherAmount() {
this.b.f(-1);
IntentionProduct intentionProduct = this.f;
intentionProduct.principal = null;
this.d.d(intentionProduct);
x();
boolean z2 = !this.k;
this.k = z2;
if (!z2) {
this.loanAmountView.setVisibility(8);
this.ivNeedHigherAmount.animate().rotation(0.0f);
} else {
this.loanAmountView.setVisibility(0);
this.ivNeedHigherAmount.animate().rotation(90.0f);
this.loanAmountView.requestFocus();
}
}
public IntentionProduct getSelectedSingleLoanProduct() {
return this.f;
}
public int h() {
return CollectionUtils.e(this.i, new Func1() {
@Override
public final Object a(Object obj) {
return ((LoanPrincipalOption) obj).getPrincipal();
}
});
}
public int i() {
return CollectionUtils.e(this.j, new Func1() {
@Override
public final Object a(Object obj) {
return Integer.valueOf(((RepaymentPlan) obj).getTerms());
}
});
}
public void m(EasyCashCommonActivity easyCashCommonActivity) {
this.a = easyCashCommonActivity;
k();
l();
j(this.loanAmountView);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
View.inflate(getContext(), R.layout.easycash_layout_auth_loan_amount_and_term, this);
ButterKnife.bind(this);
}
public void setAuthLoanAmountAndTermCardListener(AuthLoanAmountAndTermCardListener authLoanAmountAndTermCardListener) {
this.d = authLoanAmountAndTermCardListener;
}
public void v(SingleLoanProduct singleLoanProduct, IntentionCalculateResponse.UserCreditsInfo userCreditsInfo, String str) {
this.e = singleLoanProduct;
this.i.clear();
this.i.addAll(singleLoanProduct.loanPrincipalOptionList);
this.j.clear();
this.j.addAll(singleLoanProduct.repaymentPlanList);
this.k = this.loanAmountView.getVisibility() == 0;
B(userCreditsInfo);
this.b.notifyDataSetChanged();
this.c.notifyDataSetChanged();
A(singleLoanProduct.repaymentPlanList);
if (TextUtils.equals(IntentOrderDisplayStrategy.A3.name(), str) && this.l) {
this.l = false;
z();
}
}
public void z() {
this.b.e(h());
this.c.e(i());
}
public IntentOrderCardExp3(@NonNull Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet, 0);
this.f = new IntentionProduct();
this.h = new AmountCheckUtil(new BigDecimal(60000000), new BigDecimal(100000));
this.i = new ArrayList();
this.j = new ArrayList();
this.k = false;
this.l = true;
}
public IntentOrderCardExp3(@NonNull Context context, @Nullable AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.f = new IntentionProduct();
this.h = new AmountCheckUtil(new BigDecimal(60000000), new BigDecimal(100000));
this.i = new ArrayList();
this.j = new ArrayList();
this.k = false;
this.l = true;
}
}