正在查看: Easycash v3.75.13 应用的 TopUpActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Easycash v3.75.13 应用的 TopUpActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.fintopia.lender.module.topup;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import butterknife.BindView;
import butterknife.OnClick;
import com.fintopia.lender.R;
import com.fintopia.lender.module.baseui.LenderCommonActivity;
import com.fintopia.lender.module.events.EventTopUpSuccess;
import com.fintopia.lender.module.launch.AppGeneralConfigUtils;
import com.fintopia.lender.module.launch.model.LenderConfigKey;
import com.fintopia.lender.module.lend.LenderRechargeActivity;
import com.fintopia.lender.module.lend.model.OrderInitInfo;
import com.fintopia.lender.module.network.ILenderApiRoutes;
import com.fintopia.lender.module.traderecord.model.DebtProductType;
import com.fintopia.lender.module.utils.SensorTrackEvent;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.framework.lifecycle.m;
import com.lingyue.idnbaselib.model.IdnObserver;
import com.lingyue.idnbaselib.model.response.BooleanResponse;
import com.lingyue.idnbaselib.utils.DevUtil;
import com.lingyue.idnbaselib.utils.EcFormatUtil;
import com.lingyue.idnbaselib.utils.ThirdPartEventUtils;
import com.lingyue.idnbaselib.widget.editTextBridge.MoneyAmountEditText;
import com.lingyue.idnbaselib.widget.keyboard.MoneyKeyboard;
import com.lingyue.supertoolkit.widgets.BaseUtils;
import io.reactivex.disposables.Disposable;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.HashMap;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONObject;
public class TopUpActivity extends LenderCommonActivity {
public static final String PARAM_MOBILE = "mobile";
public static final String PARAM_TOP_UP_MONEY = "topUpMoney";
private static final BigDecimal z = new BigDecimal(100000);
@BindView(4716)
Button btnTopUp;
@BindView(4828)
CardView cvCurrentBalance;
@BindView(4887)
MoneyAmountEditText etMoney;
@BindView(5629)
TextView tvCurrentBalance;
@BindView(5742)
TextView tvMoneyTip;
@BindView(5845)
TextView tvRp;
private BigDecimal f186u;
private BigDecimal f187v;
private String f188w;
private OrderInitInfo f189x;
private MoneyKeyboard y;
private void Q() {
this.etMoney.setAfterTextChangedListener(new MoneyAmountEditText.AfterTextChangedListener() {
public final void a(BigDecimal bigDecimal) {
TopUpActivity.this.V(bigDecimal);
}
});
BigDecimal bigDecimal = this.f186u;
if (bigDecimal != null) {
this.etMoney.setText(bigDecimal.toString());
}
}
private void R() {
showLoadingDialog();
AppGeneralConfigUtils.o().v(this, LenderConfigKey.topUpMinAmount, new AppGeneralConfigUtils.Callback() {
@Override
public final void b(HashMap hashMap) {
TopUpActivity.this.T(hashMap);
}
});
}
public boolean S() {
return AppGeneralConfigUtils.o().f("app_config.is_ojk_demo_user", Boolean.FALSE).booleanValue();
}
public void T(HashMap hashMap) {
dismissLoadingDialog();
String str = (String) hashMap.get(LenderConfigKey.topUpMinAmount);
if (TextUtils.isEmpty(str)) {
this.f187v = AppGeneralConfigUtils.o().e(LenderConfigKey.topUpMinAmount, z);
} else {
this.f187v = new BigDecimal(str);
}
Q();
}
private void U(SensorTrackEvent sensorTrackEvent) {
try {
JSONObject a = sensorTrackEvent.a();
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 V(BigDecimal bigDecimal) {
if (this.etMoney.h()) {
this.tvMoneyTip.setVisibility(8);
this.btnTopUp.setEnabled(false);
} else if (bigDecimal.compareTo(this.f187v) >= 0) {
this.tvMoneyTip.setVisibility(4);
this.btnTopUp.setEnabled(true);
} else {
this.tvMoneyTip.setVisibility(0);
this.tvMoneyTip.setText(MessageFormat.format(getString(R.string.lender_top_up_amount_error_hint), this.f187v));
this.btnTopUp.setEnabled(false);
}
}
private void W(String str) {
showLoadingDialog();
((ILenderApiRoutes) this.apiHelper.a()).j0(str).a(new IdnObserver<BooleanResponse>(this) {
public void onSuccess(BooleanResponse booleanResponse) {
TopUpActivity.this.dismissLoadingDialog();
if (!TopUpActivity.this.S() || TopUpActivity.this.f189x == null) {
LenderRechargeActivity.startRechargeActivity(TopUpActivity.this.u(), TopUpActivity.this.etMoney.getMoneyNoFormatBigDecimal().toString(), true);
} else {
LenderRechargeActivity.startRechargeActivityForOjk(TopUpActivity.this.u(), TopUpActivity.this.etMoney.getMoneyNoFormatBigDecimal().toString(), TopUpActivity.this.f189x);
}
}
});
}
public static void startTopUpActivity(Activity activity, BigDecimal bigDecimal) {
Intent intent = new Intent(activity, (Class<?>) TopUpActivity.class);
intent.putExtra(PARAM_TOP_UP_MONEY, bigDecimal);
activity.startActivity(intent);
}
public static void startTopUpActivityForOjk(Activity activity, BigDecimal bigDecimal, OrderInitInfo orderInitInfo) {
Intent intent = new Intent(activity, (Class<?>) TopUpActivity.class);
intent.putExtra(PARAM_TOP_UP_MONEY, bigDecimal);
intent.putExtra("orderInitInfo", orderInitInfo);
activity.startActivity(intent);
}
@Override
@SuppressLint({"ClickableViewAccessibility"})
protected void A() {
super.A();
this.y = new MoneyKeyboard(this);
}
@Override
protected void G(@NonNull Bundle bundle) {
super.G(bundle);
bundle.putSerializable(PARAM_TOP_UP_MONEY, this.f186u);
bundle.putSerializable("orderInitInfo", this.f189x);
bundle.putString(PARAM_MOBILE, this.f188w);
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
this.y.j(motionEvent);
return super.dispatchTouchEvent(motionEvent);
}
@Override
public int getLayoutID() {
return R.layout.lender_activity_topup;
}
public void onBackPressed() {
if (this.y.s()) {
return;
}
U(SensorTrackEvent.LENDER_TOPUP_CLICK_BACK);
super/*androidx.activity.ComponentActivity*/.onBackPressed();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventTopUpSuccess(EventTopUpSuccess eventTopUpSuccess) {
finish();
}
@Override
protected void onResume() {
super.onResume();
this.y.h(this.etMoney, new int[]{R.id.btn_topup});
this.etMoney.requestFocus();
U(SensorTrackEvent.LENDER_TOPUP_RESUME);
}
@Override
public void openCustomerService() {
super.openCustomerService();
U(SensorTrackEvent.LENDER_TOPUP_CLICK_CUSTOMER);
}
@Override
public Disposable runOnActiveEvent(Runnable runnable) {
return m.a(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnCreated(@NonNull Runnable runnable) {
return m.b(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnDestroy(@NonNull Runnable runnable) {
return m.c(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
return m.d(this, lifecycleEvent, runnable);
}
@Override
public Disposable runOnEvents(@NonNull LifecycleEvent[] lifecycleEventArr, @Nullable Runnable runnable) {
return m.e(this, lifecycleEventArr, runnable);
}
@OnClick({4716})
public void topUp() {
if (BaseUtils.l()) {
return;
}
ThirdPartEventUtils.y(this, "lender_topup_btn_topup");
BigDecimal bigDecimal = this.f187v;
if (bigDecimal == null || bigDecimal.compareTo(z) < 0) {
this.f187v = z;
}
if (this.etMoney.h()) {
BaseUtils.s(this, getString(R.string.lender_please_fill_in_the_amount));
return;
}
BigDecimal moneyNoFormatBigDecimal = this.etMoney.getMoneyNoFormatBigDecimal();
this.f186u = moneyNoFormatBigDecimal;
if (moneyNoFormatBigDecimal.compareTo(this.f187v) < 0) {
BaseUtils.s(this, MessageFormat.format(getString(R.string.lender_top_up_amount_error_hint), this.f187v));
} else {
W(this.f186u.toString());
U(SensorTrackEvent.LENDER_TOPUP_CLICK_RECHARGE);
}
}
@Override
protected void w() {
super.w();
if (!S() || this.f189x == null) {
this.cvCurrentBalance.setVisibility(0);
this.btnTopUp.setText(R.string.lender_top_up);
this.etMoney.setEnabled(true);
TextView textView = this.tvRp;
int i = R.color.c_base_black;
textView.setTextColor(ContextCompat.getColor(this, i));
this.etMoney.setTextColor(ContextCompat.getColor(this, i));
this.tvCurrentBalance.setText(EcFormatUtil.i(this.userSession.b().e));
} else {
this.cvCurrentBalance.setVisibility(8);
this.btnTopUp.setText(R.string.lender_confirm_top_up);
this.etMoney.setEnabled(false);
TextView textView2 = this.tvRp;
int i2 = R.color.c_base_light_black;
textView2.setTextColor(ContextCompat.getColor(this, i2));
this.etMoney.setTextColor(ContextCompat.getColor(this, i2));
}
R();
}
@Override
protected void y(@NonNull Bundle bundle) {
super.y(bundle);
this.f186u = (BigDecimal) bundle.getSerializable(PARAM_TOP_UP_MONEY);
this.f189x = (OrderInitInfo) bundle.getSerializable("orderInitInfo");
String string = bundle.getString(PARAM_MOBILE);
this.f188w = string;
if (TextUtils.isEmpty(string)) {
this.f188w = this.userSession.b().b;
}
}
}