正在查看: Mabilis Cash v1.19.4 应用的 PHRepaymentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Mabilis Cash v1.19.4 应用的 PHRepaymentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.loans.mabiliscash.trade;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.fintopia.face.living.faceDetector.SensorUtil;
import com.fintopia.libCommon.tool.CommonExtensionKt;
import com.fintopia.libCommon.widgets.dialog.bottom.BaseBottomSheetDialog;
import com.lingyue.supertoolkit.statistics.TrackingUtil;
import com.lingyue.supertoolkit.tools.FastClickCheckUtil;
import com.lingyue.supertoolkit.widgets.adapters.LinearVerticalDivider;
import com.lingyue.supertoolkit.widgets.adapters.OnItemClickListener;
import com.lingyue.tracklib.ThirdPartTrackLib;
import com.lingyue.tracklib.TrackEventParamsConfigurator;
import com.loans.mabiliscash.R;
import com.loans.mabiliscash.appconfig.AppSwitchConfigKey;
import com.loans.mabiliscash.auth.helper.AuthUtils;
import com.loans.mabiliscash.common.BindClickCall;
import com.loans.mabiliscash.common.PHBaseActivity;
import com.loans.mabiliscash.common.PHViewBindingActivity;
import com.loans.mabiliscash.databinding.ActivityRepaymentBinding;
import com.loans.mabiliscash.models.Coupon;
import com.loans.mabiliscash.models.OnLineServicePageName;
import com.loans.mabiliscash.models.RepayRequest;
import com.loans.mabiliscash.models.TrackingEvents;
import com.loans.mabiliscash.models.event.AuthFinishEvent;
import com.loans.mabiliscash.models.event.EventSwitchHomePage;
import com.loans.mabiliscash.models.event.RepaymentSucceedEvent;
import com.loans.mabiliscash.models.request.RepayExtraInfoRequest;
import com.loans.mabiliscash.models.response.InstalmentListResponse;
import com.loans.mabiliscash.models.response.RepayExtraInfoResponse;
import com.loans.mabiliscash.net.ECObserver;
import com.loans.mabiliscash.net.IApiRoutes;
import com.loans.mabiliscash.sentry.sentrybusiness.ISentryBusinessEventAutoFinish;
import com.loans.mabiliscash.trade.adapters.RepaymentAdapter;
import com.loans.mabiliscash.upload.PhoneInfoUploadManager;
import com.loans.mabiliscash.upload.uploader.AppListUploader;
import com.loans.mabiliscash.upload.uploader.SMSUploader;
import com.loans.mabiliscash.upload.uploader.SensorUploader;
import com.loans.mabiliscash.web.PHWebViewActivity;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.veda.android.bananalibrary.common.BananaBaseApplication;
import com.veda.android.statistics.AutoTrackHelper;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.schedulers.Schedulers;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.collections.MapsKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Route(path = "/repayment/list")
@Metadata
@SourceDebugExtension
public final class PHRepaymentActivity extends PHViewBindingActivity<ActivityRepaymentBinding> implements ISentryBusinessEventAutoFinish {
@NotNull
public static final Companion Companion = new Companion(null);
@Nullable
private RepaymentAdapter q;
@Nullable
private MenuItem r;
private boolean s;
private boolean f239u;
@NotNull
private final SensorUtil p = new SensorUtil(BananaBaseApplication.getApplication());
@NotNull
private RepayExtraInfoResponse.RepayExtraInfo f238t = C0();
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
@JvmStatic
public final void a(@NotNull Context context) {
Intrinsics.checkNotNullParameter(context, "context");
context.startActivity(new Intent(context, (Class<?>) PHRepaymentActivity.class));
}
private Companion() {
}
}
public static final void A0(PHRepaymentActivity pHRepaymentActivity, Map map) {
String str;
Intrinsics.checkNotNullParameter(map, "params");
map.put("requirement_id", 9);
map.put("track_sign", "apost.b7.d110.click.post_b7_d110_click");
Long l = pHRepaymentActivity.f238t.selectedRepayCouponId;
if (l == null || (str = l.toString()) == null) {
str = "";
}
map.put("selected_coupon_id", str);
RepayExtraInfoResponse.RepayExtraInfo repayExtraInfo = pHRepaymentActivity.f238t;
BigDecimal bigDecimal = repayExtraInfo.amountBeforeDiscount;
if (bigDecimal != null) {
BigDecimal bigDecimal2 = repayExtraInfo.amount;
Intrinsics.checkNotNullExpressionValue(bigDecimal2, "amount");
BigDecimal subtract = bigDecimal.subtract(bigDecimal2);
Intrinsics.checkNotNullExpressionValue(subtract, "subtract(...)");
map.put("selected_coupon_amount", subtract);
}
map.put("bill_id_selected", pHRepaymentActivity.B0());
map.put("bill_amout_selected", pHRepaymentActivity.D0());
map.put("actual_amount_after_discount", pHRepaymentActivity.f238t.amount);
}
private final String B0() {
List<InstalmentListResponse.Instalment> m;
RepaymentAdapter repaymentAdapter = this.q;
if (repaymentAdapter != null && (m = repaymentAdapter.m()) != null) {
ArrayList arrayList = new ArrayList();
for (Object obj : m) {
if (((InstalmentListResponse.Instalment) obj).isSelected) {
arrayList.add(obj);
}
}
String d02 = CollectionsKt.d0(arrayList, ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, new Function1() {
public final Object invoke(Object obj2) {
CharSequence x0;
x0 = PHRepaymentActivity.x0((InstalmentListResponse.Instalment) obj2);
return x0;
}
}, 30, (Object) null);
if (d02 != null) {
return d02;
}
}
return "";
}
public final RepayExtraInfoResponse.RepayExtraInfo C0() {
RepayExtraInfoResponse.RepayExtraInfo repayExtraInfo = new RepayExtraInfoResponse.RepayExtraInfo();
repayExtraInfo.amount = D0();
repayExtraInfo.bottomText = CommonExtensionKt.g(R.string.total_repayment, new Object[0]);
return repayExtraInfo;
}
public final BigDecimal D0() {
List<InstalmentListResponse.Instalment> m;
RepaymentAdapter repaymentAdapter = this.q;
if (repaymentAdapter != null && (m = repaymentAdapter.m()) != null) {
ArrayList arrayList = new ArrayList();
for (Object obj : m) {
if (((InstalmentListResponse.Instalment) obj).isSelected) {
arrayList.add(obj);
}
}
BigDecimal valueOf = BigDecimal.valueOf(0L);
Intrinsics.checkNotNullExpressionValue(valueOf, "valueOf(...)");
Iterator it = arrayList.iterator();
while (it.hasNext()) {
BigDecimal bigDecimal = ((InstalmentListResponse.Instalment) it.next()).owedAmount;
Intrinsics.checkNotNullExpressionValue(bigDecimal, "owedAmount");
valueOf = valueOf.add(bigDecimal);
Intrinsics.checkNotNullExpressionValue(valueOf, "add(...)");
}
if (valueOf != null) {
return valueOf;
}
}
BigDecimal bigDecimal2 = BigDecimal.ZERO;
Intrinsics.checkNotNullExpressionValue(bigDecimal2, "ZERO");
return bigDecimal2;
}
public static final void E0(final PHRepaymentActivity pHRepaymentActivity, final String str, String str2) {
if (str == null || str.length() == 0) {
return;
}
pHRepaymentActivity.j1(TrackingEvents.PH_REPAYMENT_SHOW_ONLINE_SERVICE);
((ActivityRepaymentBinding) pHRepaymentActivity.o).r.setVisibility(0);
pHRepaymentActivity.V(((ActivityRepaymentBinding) pHRepaymentActivity.o).r, new BindClickCall() {
@Override
public final void onClick(View view) {
PHRepaymentActivity.F0(PHRepaymentActivity.this, str, view);
}
});
}
public static final void F0(PHRepaymentActivity pHRepaymentActivity, String str, View view) {
pHRepaymentActivity.j1(TrackingEvents.PH_REPAYMENT_CLICK_ONLINE_SERVICE);
PHWebViewActivity.start(pHRepaymentActivity, str);
}
private final void G0() {
V(((ActivityRepaymentBinding) this.o).b, new BindClickCall() {
@Override
public final void onClick(View view) {
PHRepaymentActivity.R0(PHRepaymentActivity.this, view);
}
});
V(((ActivityRepaymentBinding) this.o).i, new BindClickCall() {
@Override
public final void onClick(View view) {
PHRepaymentActivity.U0(PHRepaymentActivity.this, view);
}
});
V(((ActivityRepaymentBinding) this.o).d, new BindClickCall() {
@Override
public final void onClick(View view) {
PHRepaymentActivity.H0(PHRepaymentActivity.this, view);
}
});
}
public static final void H0(final PHRepaymentActivity pHRepaymentActivity, View view) {
final List<Coupon> list;
RepayExtraInfoResponse.RepayExtraInfo.CouponInfo couponInfo = pHRepaymentActivity.f238t.couponInfo;
if (couponInfo == null || (list = couponInfo.couponDetailList) == null) {
return;
}
if (list.isEmpty()) {
list = null;
}
if (list != null) {
ThirdPartTrackLib.d(pHRepaymentActivity, "post_b7_c217_click", new TrackEventParamsConfigurator() {
@Override
public final void a(Map map) {
PHRepaymentActivity.I0(PHRepaymentActivity.this, map);
}
});
BaseBottomSheetDialog repaymentCouponListDialog = new RepaymentCouponListDialog(pHRepaymentActivity, pHRepaymentActivity.f238t.selectedRepayCouponId, list, new Function1() {
public final Object invoke(Object obj) {
Unit J0;
J0 = PHRepaymentActivity.J0(PHRepaymentActivity.this, list, (Coupon) obj);
return J0;
}
}, new Function2() {
public final Object invoke(Object obj, Object obj2) {
Unit L0;
L0 = PHRepaymentActivity.L0(PHRepaymentActivity.this, list, (Coupon) obj, (Coupon) obj2);
return L0;
}
}, new Function1() {
public final Object invoke(Object obj) {
Unit N0;
N0 = PHRepaymentActivity.N0(PHRepaymentActivity.this, list, (Coupon) obj);
return N0;
}
});
repaymentCouponListDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public final void onShow(DialogInterface dialogInterface) {
PHRepaymentActivity.P0(PHRepaymentActivity.this, list, dialogInterface);
}
});
repaymentCouponListDialog.show();
}
}
public static final void I0(PHRepaymentActivity pHRepaymentActivity, Map map) {
String str;
Intrinsics.checkNotNullParameter(map, "params");
map.put("requirement_id", 11);
map.put("track_sign", "apost.b7.c217.click.post_b7_c217_click");
Long l = pHRepaymentActivity.f238t.selectedRepayCouponId;
if (l == null || (str = l.toString()) == null) {
str = "";
}
map.put("selected_coupon_id", str);
RepayExtraInfoResponse.RepayExtraInfo repayExtraInfo = pHRepaymentActivity.f238t;
BigDecimal bigDecimal = repayExtraInfo.amountBeforeDiscount;
if (bigDecimal != null) {
BigDecimal bigDecimal2 = repayExtraInfo.amount;
Intrinsics.checkNotNullExpressionValue(bigDecimal2, "amount");
BigDecimal subtract = bigDecimal.subtract(bigDecimal2);
Intrinsics.checkNotNullExpressionValue(subtract, "subtract(...)");
map.put("selected_coupon_amount", subtract);
}
}
public static final Unit J0(final PHRepaymentActivity pHRepaymentActivity, final List list, final Coupon coupon) {
List<InstalmentListResponse.Instalment> m;
ThirdPartTrackLib.d(pHRepaymentActivity, "post_b7_c218_d220_click", new TrackEventParamsConfigurator() {
@Override
public final void a(Map map) {
PHRepaymentActivity.K0(list, coupon, pHRepaymentActivity, map);
}
});
RepaymentAdapter repaymentAdapter = pHRepaymentActivity.q;
if (repaymentAdapter != null && (m = repaymentAdapter.m()) != null) {
pHRepaymentActivity.l1(m, Long.valueOf(coupon != null ? coupon.id : -1L));
}
return Unit.a;
}
public static final void K0(List list, Coupon coupon, PHRepaymentActivity pHRepaymentActivity, Map map) {
int i;
Object obj;
Intrinsics.checkNotNullParameter(map, "params");
map.put("requirement_id", 11);
map.put("track_sign", "apost.b7.c218.d220.click.post_b7_c218_d220_click");
List list2 = list;
if ((list2 instanceof Collection) && list2.isEmpty()) {
i = 0;
} else {
Iterator it = list2.iterator();
i = 0;
while (it.hasNext()) {
if (((Coupon) it.next()).canUse && (i = i + 1) < 0) {
CollectionsKt.s();
}
}
}
map.put("available_coupons", Integer.valueOf(i));
map.put("unavailable_coupons", Integer.valueOf(list.size() - i));
map.put("selected_coupon_id", coupon != null ? Long.valueOf(coupon.id) : "");
if (coupon == null || (obj = coupon.expectDeductAmount) == null) {
obj = 0;
}
map.put("selected_coupon_amount", obj);
map.put("bill_id_selected", pHRepaymentActivity.B0());
map.put("bill_amout_selected", pHRepaymentActivity.D0());
}
public static final Unit L0(final PHRepaymentActivity pHRepaymentActivity, final List list, final Coupon coupon, final Coupon coupon2) {
ThirdPartTrackLib.d(pHRepaymentActivity, "post_b7_c218_d219_click", new TrackEventParamsConfigurator() {
@Override
public final void a(Map map) {
PHRepaymentActivity.M0(list, coupon, coupon2, pHRepaymentActivity, map);
}
});
return Unit.a;
}
public static final void M0(List list, Coupon coupon, Coupon coupon2, PHRepaymentActivity pHRepaymentActivity, Map map) {
Object obj;
?? r4;
Intrinsics.checkNotNullParameter(map, "params");
map.put("requirement_id", 11);
map.put("track_sign", "apost.b7.c218.d219.click.post_b7_c218_d219_click");
List list2 = list;
int i = 0;
int i2 = 0;
if (!(list2 instanceof Collection) || !list2.isEmpty()) {
Iterator it = list2.iterator();
while (it.hasNext()) {
if (((Coupon) it.next()).canUse && (i = i + 1) < 0) {
CollectionsKt.s();
}
}
}
map.put("available_coupons", Integer.valueOf(i));
map.put("unavailable_coupons", Integer.valueOf(list.size() - i));
map.put("old_coupon_id", coupon != null ? Long.valueOf(coupon.id) : "");
map.put("new_coupon_id", coupon2 != null ? Long.valueOf(coupon2.id) : "");
if (coupon == null || (obj = coupon.expectDeductAmount) == null) {
obj = 0;
}
map.put("old_coupon_amount", obj);
if (coupon2 != null && (r4 = coupon2.expectDeductAmount) != 0) {
i2 = r4;
}
map.put("new_coupon_amount", i2);
map.put("bill_id_selected", pHRepaymentActivity.B0());
map.put("bill_amout_selected", pHRepaymentActivity.D0());
}
public static final Unit N0(final PHRepaymentActivity pHRepaymentActivity, final List list, final Coupon coupon) {
ThirdPartTrackLib.d(pHRepaymentActivity, "post_b7_c218_d221_click", new TrackEventParamsConfigurator() {
@Override
public final void a(Map map) {
PHRepaymentActivity.O0(list, coupon, pHRepaymentActivity, map);
}
});
return Unit.a;
}
public static final void O0(List list, Coupon coupon, PHRepaymentActivity pHRepaymentActivity, Map map) {
int i;
Object obj;
Intrinsics.checkNotNullParameter(map, "params");
map.put("requirement_id", 11);
map.put("track_sign", "apost.b7.c218.d221.click.post_b7_c218_d221_click");
List list2 = list;
if ((list2 instanceof Collection) && list2.isEmpty()) {
i = 0;
} else {
Iterator it = list2.iterator();
i = 0;
while (it.hasNext()) {
if (((Coupon) it.next()).canUse && (i = i + 1) < 0) {
CollectionsKt.s();
}
}
}
map.put("available_coupons", Integer.valueOf(i));
map.put("unavailable_coupons", Integer.valueOf(list.size() - i));
map.put("selected_coupon_id", coupon != null ? Long.valueOf(coupon.id) : "");
if (coupon == null || (obj = coupon.expectDeductAmount) == null) {
obj = 0;
}
map.put("selected_coupon_amount", obj);
map.put("bill_id_selected", pHRepaymentActivity.B0());
map.put("bill_amout_selected", pHRepaymentActivity.D0());
}
public static final void P0(final PHRepaymentActivity pHRepaymentActivity, final List list, DialogInterface dialogInterface) {
ThirdPartTrackLib.d(pHRepaymentActivity, "post_b7_c218_exposure", new TrackEventParamsConfigurator() {
@Override
public final void a(Map map) {
PHRepaymentActivity.Q0(list, pHRepaymentActivity, map);
}
});
}
public static final void Q0(List list, PHRepaymentActivity pHRepaymentActivity, Map map) {
Intrinsics.checkNotNullParameter(map, "params");
map.put("requirement_id", 11);
map.put("track_sign", "apost.b7.c218.exposure.post_b7_c218_exposure");
List list2 = list;
int i = 0;
if (!(list2 instanceof Collection) || !list2.isEmpty()) {
Iterator it = list2.iterator();
while (it.hasNext()) {
if (((Coupon) it.next()).canUse && (i = i + 1) < 0) {
CollectionsKt.s();
}
}
}
map.put("available_coupons", Integer.valueOf(i));
map.put("unavailable_coupons", Integer.valueOf(list.size() - i));
map.put("using_product_coupon_id", pHRepaymentActivity.f238t.selectedRepayCouponId);
RepayExtraInfoResponse.RepayExtraInfo repayExtraInfo = pHRepaymentActivity.f238t;
BigDecimal bigDecimal = repayExtraInfo.amountBeforeDiscount;
if (bigDecimal != null) {
BigDecimal bigDecimal2 = repayExtraInfo.amount;
Intrinsics.checkNotNullExpressionValue(bigDecimal2, "amount");
BigDecimal subtract = bigDecimal.subtract(bigDecimal2);
Intrinsics.checkNotNullExpressionValue(subtract, "subtract(...)");
map.put("using_product_coupon_amount", subtract);
}
map.put("bill_id_selected", pHRepaymentActivity.B0());
map.put("bill_amout_selected", pHRepaymentActivity.D0());
}
public static final void R0(final PHRepaymentActivity pHRepaymentActivity, View view) {
PhoneInfoUploadManager.c.a().f("loan_payment", new Function0() {
public final Object invoke() {
Unit S0;
S0 = PHRepaymentActivity.S0(PHRepaymentActivity.this);
return S0;
}
}, new Function0() {
public final Object invoke() {
Unit T0;
T0 = PHRepaymentActivity.T0(PHRepaymentActivity.this);
return T0;
}
}, new SMSUploader(pHRepaymentActivity, AppSwitchConfigKey.PHI_NEED_UPLOAD_SMS_REPAY), new AppListUploader(pHRepaymentActivity, AppSwitchConfigKey.PHI_NEED_UPLOAD_APP_LIST_REPAY), new SensorUploader(AppSwitchConfigKey.PHI_NEED_UPLOAD_SENSOR_REPAY, pHRepaymentActivity.p));
}
public static final Unit S0(PHRepaymentActivity pHRepaymentActivity) {
pHRepaymentActivity.showLoadingDialog();
return Unit.a;
}
public static final Unit T0(PHRepaymentActivity pHRepaymentActivity) {
pHRepaymentActivity.dismissLoadingDialog();
pHRepaymentActivity.z0();
return Unit.a;
}
public static final void U0(PHRepaymentActivity pHRepaymentActivity, View view) {
if (!pHRepaymentActivity.userSession.c().hasFinishedLoanAuth) {
AuthUtils.o(pHRepaymentActivity, pHRepaymentActivity.apiHelper, pHRepaymentActivity.userSession).h(pHRepaymentActivity, new AuthUtils.LoadingAuthCallback(pHRepaymentActivity));
} else {
EventBus.c().k(new EventSwitchHomePage(0));
pHRepaymentActivity.finish();
}
}
private final void V0() {
this.q = new RepaymentAdapter(this);
((ActivityRepaymentBinding) this.o).n.setLayoutManager(new LinearLayoutManager(this));
((ActivityRepaymentBinding) this.o).n.setAdapter(this.q);
((ActivityRepaymentBinding) this.o).n.setItemAnimator((RecyclerView.ItemAnimator) null);
((ActivityRepaymentBinding) this.o).n.addItemDecoration(new LinearVerticalDivider(CommonExtensionKt.b(2131165610), CommonExtensionKt.b(2131165441), CommonExtensionKt.a(R.color.c_f3f3f3)));
RepaymentAdapter repaymentAdapter = this.q;
if (repaymentAdapter != null) {
repaymentAdapter.h(new OnItemClickListener() {
public final void a(View view, int i, Object obj) {
PHRepaymentActivity.W0(PHRepaymentActivity.this, view, i, (InstalmentListResponse.Instalment) obj);
}
});
}
RepaymentAdapter repaymentAdapter2 = this.q;
if (repaymentAdapter2 != null) {
repaymentAdapter2.t(new RepaymentAdapter.InstalmentSelectChangeListener() {
@Override
public final void a(List list) {
PHRepaymentActivity.Y0(PHRepaymentActivity.this, list);
}
});
}
}
public static final void W0(final PHRepaymentActivity pHRepaymentActivity, View view, int i, final InstalmentListResponse.Instalment instalment) {
if (FastClickCheckUtil.a(view)) {
AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, instalment);
return;
}
if (instalment == null) {
AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, instalment);
return;
}
if (!instalment.isSelected) {
RepaymentAdapter repaymentAdapter = pHRepaymentActivity.q;
if (repaymentAdapter != null) {
repaymentAdapter.s(i);
}
} else if (i == 0) {
RepaymentAdapter repaymentAdapter2 = pHRepaymentActivity.q;
if (repaymentAdapter2 != null) {
repaymentAdapter2.u(1);
}
} else {
RepaymentAdapter repaymentAdapter3 = pHRepaymentActivity.q;
if (repaymentAdapter3 != null) {
repaymentAdapter3.u(i);
}
}
ThirdPartTrackLib.d(pHRepaymentActivity, "post_b7_d126_click", new TrackEventParamsConfigurator() {
@Override
public final void a(Map map) {
PHRepaymentActivity.X0(PHRepaymentActivity.this, instalment, map);
}
});
pHRepaymentActivity.k1();
AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, instalment);
}
public static final void X0(PHRepaymentActivity pHRepaymentActivity, InstalmentListResponse.Instalment instalment, Map map) {
String str;
Intrinsics.checkNotNullParameter(map, "params");
map.put("requirement_id", 9);
map.put("track_sign", "apost.b7.d126.click.post_b7_d126_click");
Long l = pHRepaymentActivity.f238t.selectedRepayCouponId;
if (l == null || (str = l.toString()) == null) {
str = "";
}
map.put("coupon_id", str);
map.put("is_overdue", Boolean.valueOf(instalment.isOverdue()));
map.put("order_date", instalment.timeCreated);
map.put("due_payday", instalment.billingDate);
map.put("bill_id", instalment.instalmentId);
map.put("bill_amount", instalment.owedAmount);
RepayExtraInfoResponse.RepayExtraInfo repayExtraInfo = pHRepaymentActivity.f238t;
BigDecimal bigDecimal = repayExtraInfo.amountBeforeDiscount;
if (bigDecimal != null) {
BigDecimal bigDecimal2 = repayExtraInfo.amount;
Intrinsics.checkNotNullExpressionValue(bigDecimal2, "amount");
BigDecimal subtract = bigDecimal.subtract(bigDecimal2);
Intrinsics.checkNotNullExpressionValue(subtract, "subtract(...)");
map.put("selected_coupon_amount", subtract);
}
map.put("bill_id_selected", pHRepaymentActivity.B0());
map.put("bill_amout_selected", pHRepaymentActivity.D0());
}
public static final void Y0(PHRepaymentActivity pHRepaymentActivity, List list) {
Intrinsics.b(list);
pHRepaymentActivity.l1(list, null);
}
public static final void Z0(PHRepaymentActivity pHRepaymentActivity) {
pHRepaymentActivity.f238t = pHRepaymentActivity.C0();
d1(pHRepaymentActivity, false, false, 1, null);
}
public static final void a1(PHRepaymentActivity pHRepaymentActivity, Map map) {
Intrinsics.checkNotNullParameter(map, "params");
map.put("requirement_id", 11);
map.put("track_sign", "apost.b7.d124.click.post_b7_d124_click");
map.put("bill_id_selected", pHRepaymentActivity.B0());
map.put("bill_amout_selected", pHRepaymentActivity.D0());
}
public final void b1(InstalmentListResponse instalmentListResponse, boolean z2) {
List<InstalmentListResponse.Instalment> list;
List<InstalmentListResponse.Instalment> m;
InstalmentListResponse.InstalmentBodyBean instalmentBodyBean = instalmentListResponse.body;
if (instalmentBodyBean == null || (list = instalmentBodyBean.instalmentList) == null) {
return;
}
int i = 0;
if (list.isEmpty()) {
((ActivityRepaymentBinding) this.o).l.setVisibility(8);
((ActivityRepaymentBinding) this.o).e.setVisibility(8);
((ActivityRepaymentBinding) this.o).g.setVisibility(0);
return;
}
((ActivityRepaymentBinding) this.o).l.setVisibility(0);
((ActivityRepaymentBinding) this.o).g.setVisibility(8);
MenuItem menuItem = this.r;
if (menuItem != null) {
menuItem.setVisible(true);
}
if (z2) {
List<InstalmentListResponse.Instalment> list2 = instalmentBodyBean.instalmentList;
Intrinsics.checkNotNullExpressionValue(list2, "instalmentList");
int i2 = 0;
for (Object obj : list2) {
int i3 = i2 + 1;
if (i2 < 0) {
CollectionsKt.t();
}
InstalmentListResponse.Instalment instalment = (InstalmentListResponse.Instalment) obj;
RepaymentAdapter repaymentAdapter = this.q;
if (repaymentAdapter != null && (m = repaymentAdapter.m()) != null) {
List<InstalmentListResponse.Instalment> list3 = m;
if (!(list3 instanceof Collection) || !list3.isEmpty()) {
Iterator<T> it = list3.iterator();
while (true) {
if (it.hasNext()) {
InstalmentListResponse.Instalment instalment2 = (InstalmentListResponse.Instalment) it.next();
if (Intrinsics.a(instalment2.instalmentId, instalment.instalmentId) && instalment2.isSelected) {
instalment.isSelected = true;
i++;
break;
}
}
}
}
}
i2 = i3;
}
if (i == 0) {
List<InstalmentListResponse.Instalment> list4 = instalmentBodyBean.instalmentList;
Intrinsics.checkNotNullExpressionValue(list4, "instalmentList");
h1(list4);
}
} else {
List<InstalmentListResponse.Instalment> list5 = instalmentBodyBean.instalmentList;
Intrinsics.checkNotNullExpressionValue(list5, "instalmentList");
h1(list5);
}
RepaymentAdapter repaymentAdapter2 = this.q;
if (repaymentAdapter2 != null) {
repaymentAdapter2.p(instalmentBodyBean.instalmentList);
}
k1();
}
private final void c1(final boolean z2, final boolean z3) {
if (this.f239u) {
return;
}
this.apiHelper.a().p0().w(AndroidSchedulers.a()).K(Schedulers.b()).j(new Action() {
public final void run() {
PHRepaymentActivity.e1(PHRepaymentActivity.this, z2);
}
}).a(new ECObserver<InstalmentListResponse>() {
{
super(PHRepaymentActivity.this);
}
@Override
public void e(Throwable th, InstalmentListResponse instalmentListResponse) {
super.e(th, instalmentListResponse);
PHRepaymentActivity.this.i1();
}
@Override
public void c(InstalmentListResponse instalmentListResponse) {
Intrinsics.checkNotNullParameter(instalmentListResponse, "result");
PHRepaymentActivity.this.b1(instalmentListResponse, z3);
}
@Override
public void onSubscribe(Disposable disposable) {
Intrinsics.checkNotNullParameter(disposable, "d");
super.onSubscribe(disposable);
PHRepaymentActivity.this.f239u = true;
PHRepaymentActivity.this.showLoadingDialog();
}
});
}
static void d1(PHRepaymentActivity pHRepaymentActivity, boolean z2, boolean z3, int i, Object obj) {
if ((i & 1) != 0) {
z2 = false;
}
pHRepaymentActivity.c1(z2, z3);
}
public static final void e1(PHRepaymentActivity pHRepaymentActivity, boolean z2) {
pHRepaymentActivity.dismissLoadingDialog();
pHRepaymentActivity.f239u = false;
((ActivityRepaymentBinding) pHRepaymentActivity.o).m.setRefreshing(false);
if (z2) {
pHRepaymentActivity.Q();
}
}
private final void f1(BigDecimal bigDecimal, List<String> list) {
this.apiHelper.a().K(new RepayRequest(bigDecimal, list, this.f238t.selectedRepayCouponId)).w(AndroidSchedulers.a()).K(Schedulers.b()).j(new Action() {
public final void run() {
PHRepaymentActivity.g1(PHRepaymentActivity.this);
}
}).a(new PHRepaymentActivity$sendRepaymentRequest$2(this));
}
public static final void g1(PHRepaymentActivity pHRepaymentActivity) {
pHRepaymentActivity.s = false;
}
private final void h1(List<? extends InstalmentListResponse.Instalment> list) {
int i = 0;
for (Object obj : list) {
int i2 = i + 1;
if (i < 0) {
CollectionsKt.t();
}
InstalmentListResponse.Instalment instalment = (InstalmentListResponse.Instalment) obj;
if (i == 0 || instalment.needSelectDefault()) {
instalment.isSelected = true;
}
i = i2;
}
}
public final void i1() {
((ActivityRepaymentBinding) this.o).l.setVisibility(8);
((ActivityRepaymentBinding) this.o).e.setVisibility(8);
((ActivityRepaymentBinding) this.o).g.setVisibility(0);
}
private final void j1(String str) {
TrackingUtil.j(this, str, CommonExtensionKt.e(MapsKt.g(new Pair[]{TuplesKt.a("uid", this.userSession.c().getTraceId())})));
}
private final void k1() {
List<InstalmentListResponse.Instalment> m;
Button button = ((ActivityRepaymentBinding) this.o).b;
RepaymentAdapter repaymentAdapter = this.q;
boolean z2 = false;
if (repaymentAdapter != null && (m = repaymentAdapter.m()) != null) {
List<InstalmentListResponse.Instalment> list = m;
if (!(list instanceof Collection) || !list.isEmpty()) {
Iterator<T> it = list.iterator();
while (true) {
if (!it.hasNext()) {
break;
} else if (((InstalmentListResponse.Instalment) it.next()).isSelected) {
z2 = true;
break;
}
}
}
}
button.setEnabled(z2);
}
private final void l1(final List<? extends InstalmentListResponse.Instalment> list, Long l) {
ArrayList arrayList = new ArrayList();
for (Object obj : list) {
if (((InstalmentListResponse.Instalment) obj).isSelected) {
arrayList.add(obj);
}
}
if (arrayList.isEmpty()) {
ThirdPartTrackLib.d(this, "select_instalments_empty", new TrackEventParamsConfigurator() {
@Override
public final void a(Map map) {
PHRepaymentActivity.m1(PHRepaymentActivity.this, list, map);
}
});
return;
}
IApiRoutes a = this.apiHelper.a();
BigDecimal valueOf = BigDecimal.valueOf(0L);
Intrinsics.checkNotNullExpressionValue(valueOf, "valueOf(...)");
Iterator it = arrayList.iterator();
while (it.hasNext()) {
BigDecimal bigDecimal = ((InstalmentListResponse.Instalment) it.next()).owedAmount;
Intrinsics.checkNotNullExpressionValue(bigDecimal, "owedAmount");
valueOf = valueOf.add(bigDecimal);
Intrinsics.checkNotNullExpressionValue(valueOf, "add(...)");
}
ArrayList arrayList2 = new ArrayList(CollectionsKt.u(arrayList, 10));
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
arrayList2.add(((InstalmentListResponse.Instalment) it2.next()).instalmentId);
}
a.t(new RepayExtraInfoRequest(valueOf, arrayList2, l)).w(AndroidSchedulers.a()).K(Schedulers.b()).j(new Action() {
public final void run() {
PHRepaymentActivity.n1(PHRepaymentActivity.this);
}
}).a(new PHRepaymentActivity$updateRepayExactInfo$5(this));
}
public static final void m1(PHRepaymentActivity pHRepaymentActivity, List list, Map map) {
Intrinsics.checkNotNullParameter(map, "it");
map.put("data_list_json_string", pHRepaymentActivity.gson.t(list));
}
public static final void n1(PHRepaymentActivity pHRepaymentActivity) {
pHRepaymentActivity.dismissLoadingDialog();
}
@JvmStatic
public static final void start(@NotNull Context context) {
Companion.a(context);
}
public static final CharSequence x0(InstalmentListResponse.Instalment instalment) {
String str = instalment.instalmentId;
Intrinsics.checkNotNullExpressionValue(str, "instalmentId");
return str;
}
private final void z0() {
RepaymentAdapter repaymentAdapter;
List<InstalmentListResponse.Instalment> m;
if (this.s || (repaymentAdapter = this.q) == null || (m = repaymentAdapter.m()) == null || m.isEmpty()) {
return;
}
RepayExtraInfoResponse.RepayExtraInfo repayExtraInfo = this.f238t;
BigDecimal bigDecimal = repayExtraInfo.amountBeforeDiscount;
if (bigDecimal == null && (bigDecimal = repayExtraInfo.amount) == null) {
bigDecimal = D0();
}
if (bigDecimal.compareTo(BigDecimal.ZERO) > 0) {
businessTransaction("UserRepayment").a("step", "clickRepaymentBtn");
List<InstalmentListResponse.Instalment> list = m;
ArrayList arrayList = new ArrayList(CollectionsKt.u(list, 10));
Iterator<T> it = list.iterator();
while (it.hasNext()) {
arrayList.add(((InstalmentListResponse.Instalment) it.next()).instalmentId);
}
f1(bigDecimal, arrayList);
ThirdPartTrackLib.d(this, "post_b7_d110_click", new TrackEventParamsConfigurator() {
@Override
public final void a(Map map) {
PHRepaymentActivity.A0(PHRepaymentActivity.this, map);
}
});
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public final void handleAuthFinishEvent(@Nullable AuthFinishEvent authFinishEvent) {
sendFetchUserInfoRequest();
}
protected void j() {
super.j();
c1(true, false);
sendFetchUserInfoRequest();
sendFetchOnLineServiceRequest(OnLineServicePageName.REPAYMENT_LIST_PAGE, new PHBaseActivity.IOnlineServiceUICallback() {
@Override
public final void a(String str, String str2) {
PHRepaymentActivity.E0(PHRepaymentActivity.this, str, str2);
}
});
}
protected void o() {
super.o();
V0();
G0();
((ActivityRepaymentBinding) this.o).m.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
public final void onRefresh() {
PHRepaymentActivity.Z0(PHRepaymentActivity.this);
}
});
((ActivityRepaymentBinding) this.o).f170u.getPaint().setFlags(((ActivityRepaymentBinding) this.o).f170u.getPaint().getFlags() | 16);
}
@Override
protected void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
businessTransaction("UserRepayment");
EventBus.c().o(this);
ThirdPartTrackLib.g(this, "user_repayment_enter", null, 4, null);
}
@Override
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
Intrinsics.checkNotNullParameter(menu, "menu");
getMenuInflater().inflate(R.menu.repayment_menu, menu);
this.r = menu.findItem(R.id.menu_item_select_all);
SpannableString spannableString = new SpannableString(CommonExtensionKt.g(R.string.select_all, new Object[0]));
spannableString.setSpan(new ForegroundColorSpan(CommonExtensionKt.a(R.color.c_neutral_1)), 0, spannableString.length(), 33);
MenuItem menuItem = this.r;
if (menuItem == null) {
return true;
}
menuItem.setTitle(spannableString);
return true;
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.c().q(this);
this.p.c();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public final void onEventRepaymentSucceedEvent(@Nullable RepaymentSucceedEvent repaymentSucceedEvent) {
EventBus.c().k(new EventSwitchHomePage(0));
finish();
}
@SensorsDataInstrumented
public boolean onOptionsItemSelected(@NotNull MenuItem menuItem) {
Intrinsics.checkNotNullParameter(menuItem, "item");
if (menuItem.getItemId() == 2131362382) {
RepaymentAdapter repaymentAdapter = this.q;
if (repaymentAdapter != null) {
repaymentAdapter.r();
}
k1();
ThirdPartTrackLib.d(this, "post_b7_d124_click", new TrackEventParamsConfigurator() {
@Override
public final void a(Map map) {
PHRepaymentActivity.a1(PHRepaymentActivity.this, map);
}
});
}
boolean onOptionsItemSelected = super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
AutoTrackHelper.trackViewOnClick(this, menuItem);
SensorsDataAutoTrackHelper.trackMenuItem(this, menuItem);
return onOptionsItemSelected;
}
protected void onResume() {
super.onResume();
this.f238t = C0();
d1(this, false, true, 1, null);
}
@Override
@NotNull
public ActivityRepaymentBinding bindingInflater() {
ActivityRepaymentBinding c = ActivityRepaymentBinding.c(getLayoutInflater());
Intrinsics.checkNotNullExpressionValue(c, "inflate(...)");
return c;
}
}