正在查看: Easycash v3.75.13 应用的 LendingAmountActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Easycash v3.75.13 应用的 LendingAmountActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.fintopia.lender.module.lend;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewStub;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import butterknife.BindView;
import butterknife.OnCheckedChanged;
import butterknife.OnClick;
import com.fintopia.lender.R;
import com.fintopia.lender.module.baseui.LenderCommonActivity;
import com.fintopia.lender.module.common.UserGlobal;
import com.fintopia.lender.module.coupon.CouponConverter;
import com.fintopia.lender.module.coupon.model.CouponInfoResponse;
import com.fintopia.lender.module.coupon.model.CouponStatusGroup;
import com.fintopia.lender.module.coupon.model.MoneyGiveCoupon;
import com.fintopia.lender.module.coupon.model.MoneyOffCoupon;
import com.fintopia.lender.module.coupon.viewitem.CouponItem;
import com.fintopia.lender.module.events.EventLendSuccess;
import com.fintopia.lender.module.events.EventTopUpSuccess;
import com.fintopia.lender.module.events.LenderSignInterrupt;
import com.fintopia.lender.module.launch.AppGeneralConfigUtils;
import com.fintopia.lender.module.launch.model.LenderConfigKey;
import com.fintopia.lender.module.lend.interest.InterestComputer;
import com.fintopia.lender.module.lend.model.ExpectedEarningsResponse;
import com.fintopia.lender.module.lend.model.OrderInitInfo;
import com.fintopia.lender.module.lend.model.OrderInitResponse;
import com.fintopia.lender.module.lend.model.ProductAutoReinvestRewardResponse;
import com.fintopia.lender.module.lend.model.ProductDetailResponse;
import com.fintopia.lender.module.maintab.model.InstalmentMatchModeResult;
import com.fintopia.lender.module.maintab.model.ProductsBean;
import com.fintopia.lender.module.network.ILenderApiRoutes;
import com.fintopia.lender.module.orders.dialog.CouponSelectDialog;
import com.fintopia.lender.module.orders.dialog.TransferTypeSelectDialog;
import com.fintopia.lender.module.orders.models.InvestType;
import com.fintopia.lender.module.orders.models.TransferType;
import com.fintopia.lender.module.profile.model.UserResponse;
import com.fintopia.lender.module.rdl.model.RDLAccountStatus;
import com.fintopia.lender.module.rdl.model.RDLBalanceResponse;
import com.fintopia.lender.module.rdl.model.RDLFinishTopUpEvent;
import com.fintopia.lender.module.sign.LenderSignWebActivity;
import com.fintopia.lender.module.sign.models.BizCheckResultResponseV3;
import com.fintopia.lender.module.topup.TopUpActivity;
import com.fintopia.lender.module.traderecord.model.DebtProductType;
import com.fintopia.lender.module.utils.AutoReinvestUtil;
import com.fintopia.lender.module.utils.SensorTrackEvent;
import com.fintopia.lender.widget.LenderSingleButtonDialog;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.model.IdnObserver;
import com.lingyue.idnbaselib.model.sign.BizCheckResultInfoV3;
import com.lingyue.idnbaselib.utils.DevUtil;
import com.lingyue.idnbaselib.utils.EcFormatUtil;
import com.lingyue.idnbaselib.utils.EcUriUtil;
import com.lingyue.idnbaselib.utils.JsonParamsBuilder;
import com.lingyue.idnbaselib.utils.ThirdPartEventUtils;
import com.lingyue.idnbaselib.utils.ViewUtil;
import com.lingyue.idnbaselib.widget.TouchDelegateComposite;
import com.lingyue.idnbaselib.widget.editTextBridge.MoneyAmountEditText;
import com.lingyue.idnbaselib.widget.keyboard.MoneyKeyboard;
import com.lingyue.supertoolkit.customtools.CollectionUtils;
import com.lingyue.supertoolkit.resourcetools.SharedPreferenceUtils;
import com.lingyue.supertoolkit.widgets.BaseUtils;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.veda.android.bananalibrary.infrastructure.BaseActivity;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONObject;
import retrofit2.Response;
public class LendingAmountActivity extends LenderCommonActivity {
private int A;
private TransferType B;
private BigDecimal C;
private BigDecimal D;
private InterestComputer E;
private BigDecimal F;
private ValueAnimator G;
private CouponItem H;
private MoneyKeyboard I;
private boolean J;
private int K;
private String L;
private boolean M;
private boolean N;
private TouchDelegateComposite O;
private String P;
private InstalmentMatchModeResult Q;
@BindView(4709)
Button btnSelectTheBorrowers;
@BindView(4730)
CheckBox cbDebtDowngradedMessage;
@BindView(4887)
MoneyAmountEditText etMoney;
@BindView(4948)
Group gpTransferType;
@BindView(4951)
Group groupCurrentBalance;
@BindView(5124)
LinearLayout llDebtDowngradedMessage;
@BindView(5147)
LinearLayout llNetError;
@BindView(5486)
ScrollView svContent;
@BindView(5584)
TextView tvAutoAllocateRewardTip;
@BindView(5602)
TextView tvBottomTip;
@BindView(5629)
TextView tvCurrentBalance;
@BindView(5634)
TextView tvDebtDowngradedMessage;
@BindView(5711)
TextView tvLendingType;
@BindView(5742)
TextView tvMoneyTip;
@BindView(5849)
TextView tvSelectCoupon;
@BindView(5910)
TextView tvTransferType;
@BindView(5911)
TextView tvTransferTypeTitle;
private BigDecimal f78u;
private BigDecimal f79v;
@BindView(5999)
View vTransferTypeRegion;
private BigDecimal f80w;
private BigDecimal f81x;
private ProductsBean y;
private String z;
public LendingAmountActivity() {
BigDecimal bigDecimal = BigDecimal.ZERO;
this.C = bigDecimal;
this.D = bigDecimal;
this.K = 0;
this.N = false;
this.P = "";
}
public ObservableSource A0(Response response) throws Exception {
if (response.a() != null) {
c1(((UserResponse) response.a()).body);
}
this.J = RDLAccountStatus.isRDLAvailable(((UserResponse) response.a()).body.rdlAccountStatus);
this.P = ((UserResponse) response.a()).body.rdlProvider;
return this.J ? ((ILenderApiRoutes) this.apiHelper.a()).D0().I(new Function() {
public final Object apply(Object obj) {
BigDecimal z0;
z0 = LendingAmountActivity.z0((Response) obj);
return z0;
}
}) : Observable.H(((UserResponse) response.a()).body.balance);
}
public void B0(TransferType transferType) {
if (transferType != this.B) {
this.B = transferType;
this.tvTransferType.setText(transferType.descResId);
J0();
L0();
}
}
public void C0(SensorTrackEvent sensorTrackEvent) {
try {
JSONObject a = sensorTrackEvent.a();
a.put("financing_product_id", this.y.id);
a.put("financing_product_type", DebtProductType.getCurrentDebtProductTypeCode());
ThirdPartEventUtils.G(this, (Fragment) null, sensorTrackEvent.b(), (String) null, a);
} catch (Exception e) {
DevUtil.a(e);
}
}
public void D0(@Nullable CouponItem couponItem) {
CouponItem couponItem2 = this.H;
this.H = couponItem;
if (TextUtils.equals(couponItem2 != null ? couponItem2.b : "", couponItem != null ? couponItem.b : "")) {
return;
}
if (this.H != null) {
this.tvSelectCoupon.setText(o0(this.H) + this.H.e);
} else {
this.tvSelectCoupon.setText(MessageFormat.format(getString(R.string.lender_piece_coupon), Integer.valueOf(this.A)));
}
M0();
}
public void E0(BigDecimal bigDecimal) {
this.D = bigDecimal;
this.H = null;
if (this.A > 0) {
this.tvSelectCoupon.setText(MessageFormat.format(getString(R.string.lender_piece_coupon), Integer.valueOf(this.A)));
} else {
this.tvSelectCoupon.setText("");
}
M0();
}
private void F0() {
showLoadingDialog();
ILenderApiRoutes iLenderApiRoutes = (ILenderApiRoutes) this.apiHelper.a();
String bigDecimal = this.D.toString();
String str = this.y.id;
CouponItem couponItem = this.H;
iLenderApiRoutes.O(bigDecimal, str, couponItem != null ? couponItem.b : "", TransferType.REINVEST.name(), "").a(new IdnObserver<ExpectedEarningsResponse>(this) {
public void onError(Throwable th, ExpectedEarningsResponse expectedEarningsResponse) {
LendingAmountActivity.this.Z0(null);
LendingAmountActivity.this.dismissLoadingDialog();
}
public void onSuccess(ExpectedEarningsResponse expectedEarningsResponse) {
LendingAmountActivity.this.Z0(expectedEarningsResponse.body.expectedEarningsForNextOrder);
LendingAmountActivity.this.dismissLoadingDialog();
}
});
}
@SuppressLint({"CheckResult"})
public void G0(BigDecimal bigDecimal, CouponInfoResponse couponInfoResponse) {
if (!CollectionUtils.f(couponInfoResponse.body.coupons)) {
CouponConverter.b(this, couponInfoResponse.body.coupons, true).X(new Consumer() {
public final void accept(Object obj) {
LendingAmountActivity.this.Y0((List) obj);
}
}, new Consumer() {
public final void accept(Object obj) {
LendingAmountActivity.this.x0((Throwable) obj);
}
}, new Action() {
public final void run() {
LendingAmountActivity.this.dismissLoadingDialog();
}
});
} else {
dismissLoadingDialog();
Y0(null);
}
}
public void H0(ProductDetailResponse productDetailResponse) {
ProductsBean productsBean = productDetailResponse.body;
this.y = productsBean;
BigDecimal bigDecimal = productsBean.minInvestAmount;
if (bigDecimal == null) {
bigDecimal = BigDecimal.ZERO;
}
this.f79v = bigDecimal;
this.f80w = productsBean.maxInvestAmount;
this.N = productsBean.agreeDebtDowngraded;
this.svContent.setVisibility(0);
this.llNetError.setVisibility(8);
k0();
l0();
j0();
}
public void I0(OrderInitInfo orderInitInfo, BigDecimal bigDecimal) {
ThirdPartEventUtils.z(this, "lender_fixedplan_debt_btn_confirm", new JsonParamsBuilder().d("id").a(String.valueOf(orderInitInfo.orderId)).d("lendAmount").a(String.valueOf(bigDecimal)).c());
sendBizCheckResultRequest(orderInitInfo.businessId, orderInitInfo.businessType, orderInitInfo.checkTypeGroup);
}
public void J0() {
if (this.C.compareTo(BigDecimal.ZERO) <= 0) {
this.tvAutoAllocateRewardTip.setVisibility(8);
return;
}
if (this.B == TransferType.REDEEM) {
this.tvAutoAllocateRewardTip.setText(AutoReinvestUtil.c(this, this.C));
} else {
this.tvAutoAllocateRewardTip.setText(AutoReinvestUtil.d(this, this.C));
}
if (this.tvAutoAllocateRewardTip.getVisibility() == 8) {
ViewUtil.d(this.tvAutoAllocateRewardTip);
}
}
public void K0(@Nullable BigDecimal bigDecimal) {
i0();
BigDecimal bigDecimal2 = this.F;
this.F = bigDecimal;
if (bigDecimal2 == null || bigDecimal == null || bigDecimal2.compareTo(bigDecimal) == 0) {
X0(this.F);
return;
}
ValueAnimator duration = ValueAnimator.ofInt(bigDecimal2.intValue(), this.F.intValue()).setDuration(500L);
this.G = duration;
duration.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animator) {
?? r5 = LendingAmountActivity.this;
TextView textView = r5.tvMoneyTip;
String string = r5.getString(R.string.lender_lending_interests);
Object[] objArr = new Object[1];
objArr[0] = LendingAmountActivity.this.F != null ? EcFormatUtil.j(LendingAmountActivity.this.F) : "*";
textView.setText(MessageFormat.format(string, objArr));
}
@Override
public void onAnimationEnd(Animator animator) {
LendingAmountActivity lendingAmountActivity = LendingAmountActivity.this;
lendingAmountActivity.X0(lendingAmountActivity.F);
}
});
this.G.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LendingAmountActivity.this.y0(valueAnimator);
}
});
this.G.start();
}
private void L0() {
this.tvMoneyTip.setTextColor(getResources().getColor(R.color.c_base_blue));
TextView textView = this.tvMoneyTip;
String string = getString(R.string.lender_lending_interests);
Object[] objArr = new Object[1];
BigDecimal bigDecimal = this.F;
objArr[0] = bigDecimal != null ? EcFormatUtil.j(bigDecimal) : "*";
textView.setText(MessageFormat.format(string, objArr));
InterestComputer.ComputeRequest computeRequest = new InterestComputer.ComputeRequest();
computeRequest.a = this.D;
computeRequest.b = this.y.id;
CouponItem couponItem = this.H;
computeRequest.c = couponItem != null ? couponItem.b : "";
computeRequest.d = this.B;
computeRequest.e = new InterestComputer.CallBack() {
@Override
public void a() {
LendingAmountActivity.this.K0(null);
}
@Override
public void b(BigDecimal bigDecimal2) {
LendingAmountActivity.this.K0(bigDecimal2);
}
};
this.E.g(computeRequest);
this.btnSelectTheBorrowers.setEnabled(true);
}
private void M0() {
this.E.c();
i0();
if (this.etMoney.h()) {
this.F = null;
N0("", false);
O0(false);
this.btnSelectTheBorrowers.setText(getString(this.M ? R.string.lender_confirm_invest : R.string.lender_select_the_borrowers));
return;
}
if (this.D.compareTo(m0()) > 0) {
this.F = null;
N0(getString(R.string.lender_insufficient_balance_to_top_up), true);
O0(false);
this.btnSelectTheBorrowers.setText(R.string.lender_top_up);
return;
}
if (this.D.compareTo(this.f79v) < 0) {
this.F = null;
N0(MessageFormat.format(getString(R.string.lender_lend_amount_error_hint), this.f79v), false);
O0(false);
} else {
BigDecimal bigDecimal = this.f80w;
if (bigDecimal != null && this.D.compareTo(bigDecimal) > 0) {
this.F = null;
N0(MessageFormat.format(getString(R.string.lender_lend_amount_more_error_hint), this.f80w), false);
O0(false);
} else if (this.f81x == BigDecimal.ZERO || this.D.longValue() % this.f81x.longValue() == 0) {
L0();
O0(true);
} else {
this.F = null;
N0(MessageFormat.format(getString(R.string.lender_base_multiple), this.f81x), false);
O0(false);
}
}
this.btnSelectTheBorrowers.setText(getString(this.M ? R.string.lender_confirm_invest : R.string.lender_select_the_borrowers));
}
private void N0(String str, boolean z) {
this.tvMoneyTip.setTextColor(getResources().getColor(R.color.c_base_yellow));
this.tvMoneyTip.setText(str);
this.btnSelectTheBorrowers.setEnabled(z);
}
private void O0(boolean z) {
ProductsBean productsBean = this.y;
if (productsBean == null || !productsBean.isAllowAutoAllocate()) {
return;
}
this.vTransferTypeRegion.setEnabled(z);
this.tvTransferTypeTitle.setTextColor(ContextCompat.getColor(this, z ? R.color.c_base_black : R.color.c_base_light_black));
this.tvTransferType.setTextColor(ContextCompat.getColor(this, z ? R.color.c_base_black : R.color.c_base_light_black));
}
public void P0(BigDecimal bigDecimal) {
this.f78u = bigDecimal;
this.tvCurrentBalance.setText(EcFormatUtil.l(bigDecimal));
}
public void Q0(CouponInfoResponse couponInfoResponse) {
if (CollectionUtils.f(couponInfoResponse.body.coupons)) {
this.tvSelectCoupon.setText("");
} else {
this.A = couponInfoResponse.body.coupons.size();
this.tvSelectCoupon.setText(MessageFormat.format(getString(R.string.lender_piece_coupon), Integer.valueOf(this.A)));
}
}
private void R0() {
showLoadingDialog();
sendGetUserInfoRequest();
U0();
T0();
}
private void S0() {
showLoadingDialog();
((ILenderApiRoutes) this.apiHelper.a()).Q0(this.z).a(new IdnObserver<ProductAutoReinvestRewardResponse>(this) {
public void onSuccess(ProductAutoReinvestRewardResponse productAutoReinvestRewardResponse) {
LendingAmountActivity.this.dismissLoadingDialog();
LendingAmountActivity.this.C = productAutoReinvestRewardResponse.body.autoReinvestInterestRate;
LendingAmountActivity.this.J0();
}
});
}
private void T0() {
((ILenderApiRoutes) this.apiHelper.a()).n1(CouponStatusGroup.ENABLED, this.z, "").a(new IdnObserver<CouponInfoResponse>(this) {
public void onError(Throwable th, CouponInfoResponse couponInfoResponse) {
super.onError(th, couponInfoResponse);
LendingAmountActivity.this.a1();
}
public void onSuccess(CouponInfoResponse couponInfoResponse) {
LendingAmountActivity.this.Q0(couponInfoResponse);
LendingAmountActivity.this.a1();
}
});
}
private void U0() {
((ILenderApiRoutes) this.apiHelper.a()).l1(this.z).a(new IdnObserver<ProductDetailResponse>(this) {
public void onError(Throwable th, ProductDetailResponse productDetailResponse) {
super.onError(th, productDetailResponse);
LendingAmountActivity.this.hideSoftInput();
LendingAmountActivity.this.svContent.setVisibility(8);
LendingAmountActivity.this.llNetError.setVisibility(0);
LendingAmountActivity.this.a1();
}
public void onSuccess(ProductDetailResponse productDetailResponse) {
LendingAmountActivity.this.H0(productDetailResponse);
LendingAmountActivity.this.a1();
LendingAmountActivity.this.C0(SensorTrackEvent.LENDER_LEND_CLICK_RESUME);
}
});
}
private void V0(final BigDecimal bigDecimal) {
showLoadingDialog();
((ILenderApiRoutes) this.apiHelper.a()).n1(CouponStatusGroup.ENABLED, this.y.id, bigDecimal.toString()).a(new IdnObserver<CouponInfoResponse>(getCallBack()) {
public void onSuccess(CouponInfoResponse couponInfoResponse) {
LendingAmountActivity.this.G0(bigDecimal, couponInfoResponse);
}
});
}
private void W0(final BigDecimal bigDecimal) {
showLoadingDialog();
HashMap hashMap = new HashMap();
hashMap.put(BorrowerListBaseActivity.KEY_PRODUCT_ID, this.z);
hashMap.put("lenderInputAmount", bigDecimal.toString());
hashMap.put("totalBorrowerAmount", BigDecimal.ZERO);
hashMap.put("selectedBorrowerAmount", BigDecimal.ZERO);
CouponItem couponItem = this.H;
hashMap.put(BorrowerListBaseActivity.KEY_COUPON_ID, couponItem != null ? couponItem.b : "");
hashMap.put("transferType", this.B);
hashMap.put("investType", InvestType.AUTO_DEBT_V2.name());
hashMap.put("borrowerInfoList", null);
hashMap.put("allowDebtDowngrade", Boolean.valueOf(this.N));
((ILenderApiRoutes) this.apiHelper.a()).o0(hashMap).a(new IdnObserver<OrderInitResponse>(this) {
public void onSuccess(OrderInitResponse orderInitResponse) {
LendingAmountActivity.this.I0(orderInitResponse.body, bigDecimal);
}
});
}
public void X0(@Nullable BigDecimal bigDecimal) {
Object obj;
String string = getString(R.string.lender_lending_interests);
Object[] objArr = new Object[1];
objArr[0] = bigDecimal != null ? EcFormatUtil.j(bigDecimal) : "*";
String format = MessageFormat.format(string, objArr);
CouponItem couponItem = this.H;
if (couponItem != null && (obj = couponItem.a) != null && (obj instanceof MoneyGiveCoupon)) {
format = format.concat("+" + MessageFormat.format(getString(R.string.lender_give_welfare), this.H.e));
}
this.tvMoneyTip.setText(format);
}
public void Y0(@Nullable List<CouponItem> list) {
CouponSelectDialog couponSelectDialog = new CouponSelectDialog(this, !CollectionUtils.f(list) ? new ArrayList(list) : new ArrayList(), this.H);
couponSelectDialog.c(new CouponSelectDialog.Listener() {
@Override
public final void a(CouponItem couponItem) {
LendingAmountActivity.this.D0(couponItem);
}
});
couponSelectDialog.show();
}
public void Z0(@Nullable BigDecimal bigDecimal) {
TransferTypeSelectDialog transferTypeSelectDialog = new TransferTypeSelectDialog(this, this.B, this.C, bigDecimal);
transferTypeSelectDialog.g(new TransferTypeSelectDialog.Listener() {
@Override
public final void a(TransferType transferType) {
LendingAmountActivity.this.B0(transferType);
}
});
transferTypeSelectDialog.show();
}
public void a1() {
int i = this.K + 1;
this.K = i;
if (i >= 3) {
dismissLoadingDialog();
}
}
private void b1(BigDecimal bigDecimal) {
W0(bigDecimal);
}
private void c1(UserResponse.BodyBean bodyBean) {
UserGlobal b = this.userSession.b();
b.f = bodyBean.invitationCode;
String str = bodyBean.mobileNumber;
b.b = str;
b.e = bodyBean.balance;
b.i = bodyBean.fixedAmount;
b.h = bodyBean.demandAmount;
b.j = bodyBean.bankInfo;
b.k = bodyBean.remainWithdrawTimes;
b.f40m = bodyBean.couponCount;
SharedPreferenceUtils.J(this, "userMobile", str);
}
private void i0() {
ValueAnimator valueAnimator = this.G;
if (valueAnimator == null || !valueAnimator.isRunning()) {
return;
}
this.G.cancel();
}
private void j0() {
if (TextUtils.isEmpty(this.y.debtDowngradedMessage)) {
this.llDebtDowngradedMessage.setVisibility(8);
return;
}
this.llDebtDowngradedMessage.setVisibility(0);
this.tvDebtDowngradedMessage.setText(this.y.debtDowngradedMessage);
this.cbDebtDowngradedMessage.setChecked(this.y.agreeDebtDowngraded);
}
private void k0() {
ProductsBean productsBean = this.y;
this.tvLendingType.setText(MessageFormat.format(getString(R.string.lender_lending_type_and_days), EcFormatUtil.q(Double.valueOf(productsBean.displayBasicRate + productsBean.displayFloatRate)), Integer.valueOf(this.y.inServiceDays)));
}
private void l0() {
if (t0() || !this.y.isAllowAutoAllocate()) {
this.B = TransferType.REDEEM;
this.gpTransferType.setVisibility(8);
return;
}
this.B = TransferType.REINVEST;
this.gpTransferType.setVisibility(0);
this.tvTransferType.setText(this.B.descResId);
O0(false);
S0();
}
private BigDecimal m0() {
CouponItem couponItem = this.H;
if (couponItem != null) {
Object obj = couponItem.a;
if (obj instanceof MoneyOffCoupon) {
return this.f78u.add(((MoneyOffCoupon) obj).deductAmount);
}
}
return this.f78u;
}
private BigDecimal n0(BigDecimal bigDecimal) {
CouponItem couponItem = this.H;
if (couponItem == null) {
return bigDecimal;
}
Object obj = couponItem.a;
return obj instanceof MoneyOffCoupon ? bigDecimal.subtract(((MoneyOffCoupon) obj).deductAmount) : bigDecimal;
}
private String o0(@NonNull CouponItem couponItem) {
Object obj = couponItem.a;
return obj instanceof MoneyOffCoupon ? "-" : obj instanceof MoneyGiveCoupon ? "+" : "";
}
private void p0(BigDecimal bigDecimal) {
C0(SensorTrackEvent.LENDER_LEND_CLICK_CHOOSE_BORROWER);
if (this.y.isManualDebtProduct()) {
String str = this.z;
CouponItem couponItem = this.H;
DebtBorrowerListActivity.startDebtBorrowerListActivity(this, str, bigDecimal, couponItem != null ? couponItem.b : "");
} else {
ProductsBean productsBean = this.y;
String str2 = productsBean.id;
TransferType transferType = this.B;
CouponItem couponItem2 = this.H;
BorrowerListActivity.startBorrowerListActivity(this, str2, bigDecimal, transferType, couponItem2 != null ? couponItem2.b : "", null, productsBean.inServiceDays);
}
}
private void q0(BigDecimal bigDecimal, BigDecimal bigDecimal2) {
jumpToWebPage(Uri.parse(((BaseActivity) this).appGlobal.a.a().toString()).buildUpon().path("webview/rdl/lendTopUp").appendQueryParameter("reqSpeBar", "1").appendQueryParameter("topUpAmount", bigDecimal.toString()).appendQueryParameter("lendAmountWithDiscount", bigDecimal2.toString()).appendQueryParameter("rdlProvider", this.P).build().toString());
}
public void r0(BizCheckResultInfoV3 bizCheckResultInfoV3) {
LenderSignWebActivity.startLenderSignWebActivity(this, EcUriUtil.b(Uri.parse(bizCheckResultInfoV3.handWrittenInfo.templateUrl), bizCheckResultInfoV3.handWrittenInfo.minStrokeCount, bizCheckResultInfoV3.businessId).toString(), -1L, bizCheckResultInfoV3, null);
}
private void s0() {
ProductsBean productsBean;
BigDecimal moneyNoFormatBigDecimal = this.etMoney.getMoneyNoFormatBigDecimal();
if (moneyNoFormatBigDecimal.compareTo(BigDecimal.ZERO) <= 0 || moneyNoFormatBigDecimal.compareTo(this.f79v) < 0) {
return;
}
BigDecimal bigDecimal = this.f80w;
if ((bigDecimal == null || moneyNoFormatBigDecimal.compareTo(bigDecimal) <= 0) && (productsBean = this.y) != null) {
if (!productsBean.isAutoDebtProduct()) {
ThirdPartEventUtils.y(this, "lender_fixedplan_btn_selectborrower");
p0(moneyNoFormatBigDecimal);
return;
}
InstalmentMatchModeResult instalmentMatchModeResult = this.Q;
if (instalmentMatchModeResult == null || !instalmentMatchModeResult.isNewMode()) {
b1(moneyNoFormatBigDecimal);
return;
}
String str = this.z;
CouponItem couponItem = this.H;
DebtBorrowerListActivity.startDebtBorrowerListActivity(this, str, moneyNoFormatBigDecimal, couponItem != null ? couponItem.b : "");
}
}
private void sendBizCheckResultRequest(String str, String str2, String str3) {
((ILenderApiRoutes) this.apiHelper.a()).y0(str, str2, str3).a(new IdnObserver<BizCheckResultResponseV3>(this) {
public void onSuccess(BizCheckResultResponseV3 bizCheckResultResponseV3) {
LendingAmountActivity.this.dismissLoadingDialog();
LendingAmountActivity.this.r0(bizCheckResultResponseV3.body);
}
});
}
private void sendGetUserInfoRequest() {
((ILenderApiRoutes) this.apiHelper.a()).b().w(new Function() {
public final Object apply(Object obj) {
ObservableSource A0;
A0 = LendingAmountActivity.this.A0((Response) obj);
return A0;
}
}).a0(Schedulers.c()).K(AndroidSchedulers.a()).a(new Observer<BigDecimal>() {
public void onNext(BigDecimal bigDecimal) {
LendingAmountActivity.this.P0(bigDecimal);
}
public void onComplete() {
LendingAmountActivity.this.a1();
}
public void onError(Throwable th) {
LendingAmountActivity.this.hideSoftInput();
LendingAmountActivity.this.svContent.setVisibility(8);
LendingAmountActivity.this.llNetError.setVisibility(0);
LendingAmountActivity.this.a1();
}
public void onSubscribe(Disposable disposable) {
}
});
}
public static void startLendActivity(Activity activity, String str) {
Intent intent = new Intent(activity, (Class<?>) LendingAmountActivity.class);
intent.putExtra(BorrowerListBaseActivity.KEY_PRODUCT_ID, str);
activity.startActivity(intent);
}
private boolean t0() {
return AppGeneralConfigUtils.o().f("app_config.is_ojk_demo_user", Boolean.FALSE).booleanValue();
}
private boolean u0() {
InstalmentMatchModeResult instalmentMatchModeResult = this.Q;
return (instalmentMatchModeResult == null || !this.M || instalmentMatchModeResult.isNewMode()) ? false : true;
}
@SensorsDataInstrumented
public static void v0(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
AutoTrackHelper.trackViewOnClick(dialogInterface, i);
}
public void w0() {
if (isFinishing() || isDestroyed()) {
return;
}
Rect rect = new Rect();
this.cbDebtDowngradedMessage.getHitRect(rect);
int dimensionPixelSize = getResources().getDimensionPixelSize(R.dimen.ds30);
rect.left -= dimensionPixelSize;
rect.top -= dimensionPixelSize;
rect.right += dimensionPixelSize;
rect.bottom += dimensionPixelSize;
this.O.b(this.cbDebtDowngradedMessage, rect);
}
public void x0(Throwable th) throws Exception {
dismissLoadingDialog();
}
public void y0(ValueAnimator valueAnimator) {
this.tvMoneyTip.setText(MessageFormat.format(getString(R.string.lender_lending_interests), EcFormatUtil.j(new BigDecimal(((Integer) valueAnimator.getAnimatedValue()).intValue()))));
}
public static BigDecimal z0(Response response) throws Exception {
return response.a() != null ? ((RDLBalanceResponse) response.a()).body.balance : BigDecimal.ZERO;
}
@Override
@SuppressLint({"ClickableViewAccessibility"})
protected void A() {
super.A();
this.I = new MoneyKeyboard(this);
this.etMoney.setAfterTextChangedListener(new MoneyAmountEditText.AfterTextChangedListener() {
public final void a(BigDecimal bigDecimal) {
LendingAmountActivity.this.E0(bigDecimal);
}
});
this.groupCurrentBalance.setVisibility(t0() ? 8 : 0);
this.btnSelectTheBorrowers.setText(u0() ? getString(R.string.lender_confirm_invest) : getString(R.string.lender_select_the_borrowers));
this.tvBottomTip.setVisibility(this.M ? 8 : 0);
initTouchDelegate();
}
@Override
protected void G(@NonNull Bundle bundle) {
super.G(bundle);
bundle.putString(BorrowerListBaseActivity.KEY_PRODUCT_ID, this.z);
bundle.putBoolean("isRDLAvailable", this.J);
InstalmentMatchModeResult instalmentMatchModeResult = this.Q;
if (instalmentMatchModeResult != null) {
bundle.putSerializable(DebtBorrowerListActivity.PARAM_INSTALMENT_MATCH_MODE_RESULT, instalmentMatchModeResult);
}
}
@OnClick({4707})
public void clickRetryBtn() {
if (BaseUtils.l()) {
return;
}
R0();
}
@OnClick({5993})
public void clickSelectCoupon() {
if (BaseUtils.l()) {
return;
}
V0(this.etMoney.getMoneyNoFormatBigDecimal());
C0(SensorTrackEvent.LENDER_LEND_CLICK_COUPON);
}
@OnClick({5999})
public void clickSelectTransferType() {
if (BaseUtils.l()) {
return;
}
F0();
}
@OnClick({5066})
public void clickTransferTypeInstruction() {
if (BaseUtils.l()) {
return;
}
LenderSingleButtonDialog.d(this).h(3).f(R.string.lender_transfer_type_instruction).e(R.string.lender_ok).k("dialog_transfer_type_instruction").i(new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LendingAmountActivity.v0(dialogInterface, i);
}
}).show();
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
this.I.j(motionEvent);
return super.dispatchTouchEvent(motionEvent);
}
@Override
public int getLayoutID() {
return R.layout.lender_activity_lend;
}
@Override
protected void init() {
super.init();
this.L = AppGeneralConfigUtils.o().p(LenderConfigKey.DEBT_PRODUCT_TYPE, DebtProductType.RIGID_PAYMENT.name());
this.M = DebtProductType.AUTO_DEBT_MATCH.name().equals(this.L);
}
public void initTouchDelegate() {
TouchDelegate touchDelegateComposite = new TouchDelegateComposite(new ViewStub(this));
this.O = touchDelegateComposite;
this.llDebtDowngradedMessage.setTouchDelegate(touchDelegateComposite);
this.cbDebtDowngradedMessage.post(new Runnable() {
@Override
public final void run() {
LendingAmountActivity.this.w0();
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void lendSuccess(EventLendSuccess eventLendSuccess) {
finish();
}
public void onBackPressed() {
if (this.I.s()) {
return;
}
super/*androidx.activity.ComponentActivity*/.onBackPressed();
}
@OnCheckedChanged({4730})
public void onCheckDebtDowngradedMessage(CompoundButton compoundButton, boolean z) {
this.N = z;
ThirdPartEventUtils.D(this, z ? "ec_lendingselectedcheckbox_click" : "ec_lendingcancelcheckbox_click", (String) null);
}
@Override
protected void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
this.E = new InterestComputer(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
this.E.d();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventTopUpSuccess(EventTopUpSuccess eventTopUpSuccess) {
finish();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRDLFinishTopUpEvent(RDLFinishTopUpEvent rDLFinishTopUpEvent) {
s0();
}
@Override
protected void onResume() {
super.onResume();
this.I.h(this.etMoney, new int[]{R.id.iv_transfer_type_instruction, R.id.v_transfer_type_region, R.id.v_select_coupon_region, R.id.btn_select_the_borrowers});
this.etMoney.requestFocus();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSignInterrupt(LenderSignInterrupt lenderSignInterrupt) {
finish();
}
@Override
public Disposable runOnActiveEvent(Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.a(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnCreated(@NonNull Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.b(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnDestroy(@NonNull Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.c(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.d(this, lifecycleEvent, runnable);
}
@Override
public Disposable runOnEvents(@NonNull LifecycleEvent[] lifecycleEventArr, @Nullable Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.e(this, lifecycleEventArr, runnable);
}
@OnClick({4709})
public void selectTheBorrowers() {
if (BaseUtils.l()) {
return;
}
if (this.etMoney.h()) {
BaseUtils.s(this, getString(R.string.lender_please_fill_in_the_amount));
return;
}
BigDecimal moneyNoFormatBigDecimal = this.etMoney.getMoneyNoFormatBigDecimal();
BigDecimal m02 = m0();
if (moneyNoFormatBigDecimal.compareTo(m02) <= 0) {
s0();
return;
}
ThirdPartEventUtils.y(this, "lender_insufficient_balance_btn_topup");
BigDecimal scale = moneyNoFormatBigDecimal.subtract(m02).setScale(0, 0);
if (this.J) {
q0(scale, n0(moneyNoFormatBigDecimal));
} else {
TopUpActivity.startTopUpActivity(this, scale);
}
C0(SensorTrackEvent.LENDER_LEND_CLICK_RECHARGE);
}
@Override
protected void w() {
super.w();
this.f81x = AppGeneralConfigUtils.o().j();
R0();
}
@Override
protected void y(@NonNull Bundle bundle) {
super.y(bundle);
this.z = bundle.getString(BorrowerListBaseActivity.KEY_PRODUCT_ID);
this.J = bundle.getBoolean("isRDLAvailable");
if (bundle.containsKey(DebtBorrowerListActivity.PARAM_INSTALMENT_MATCH_MODE_RESULT)) {
this.Q = (InstalmentMatchModeResult) bundle.getSerializable(DebtBorrowerListActivity.PARAM_INSTALMENT_MATCH_MODE_RESULT);
} else {
this.Q = this.userSession.b().f42o;
}
}
}