正在查看: Biko v2.0.23 应用的 WalletActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 WalletActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.payment;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.activity.ComponentActivity;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import app.callpe.App;
import app.callpe.adapters.RechargeAdapter;
import app.callpe.common.utils.Constants;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.extensions.NumberExtKt;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.TopUpModel;
import app.callpe.databinding.ActivityDepositBinding;
import app.callpe.ui.call.RtcScreenHandler;
import app.callpe.ui.chat.ChatActivity;
import app.callpe.ui.dialog.WithdrawGameBalanceDialogFragment;
import app.callpe.ui.home.AccountViewModel;
import app.callpe.ui.home.BaseActivity;
import app.callpe.ui.home.UserAccountFragment;
import com.google.gson.Gson;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
import java.util.Iterator;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import timber.log.Timber;
@Metadata(d1 = {"\u0000j\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u0014\u001a\u00020\u0015H\u0002J\u0010\u0010\u0016\u001a\u00020\u00022\u0006\u0010\u0017\u001a\u00020\u0018H\u0016J\b\u0010\u0019\u001a\u00020\u001aH\u0002J\b\u0010\u001b\u001a\u00020\u001cH\u0002J\b\u0010\u001d\u001a\u00020\u001aH\u0002J\u0012\u0010\u001e\u001a\u00020\u001a2\b\u0010\u001f\u001a\u0004\u0018\u00010 H\u0014J\u0010\u0010!\u001a\u00020\u00072\u0006\u0010\"\u001a\u00020#H\u0016J\b\u0010$\u001a\u00020\u001aH\u0014J\u0010\u0010%\u001a\u00020\u001a2\u0006\u0010&\u001a\u00020 H\u0014J\b\u0010'\u001a\u00020\u001aH\u0002J\u0010\u0010(\u001a\u00020\u001a2\u0006\u0010)\u001a\u00020*H\u0002J\b\u0010+\u001a\u00020\u001aH\u0002J\b\u0010,\u001a\u00020\u001aH\u0002J\b\u0010-\u001a\u00020\u001aH\u0002R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\b\u001a\u0010\u0012\f\u0012\n \u000b*\u0004\u0018\u00010\n0\n0\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\rX\u0082.¢\u0006\u0002\n\u0000R\u001b\u0010\u000e\u001a\u00020\u000f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0012\u0010\u0013\u001a\u0004\b\u0010\u0010\u0011¨\u0006."}, d2 = {"Lapp/callpe/ui/payment/WalletActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityDepositBinding;", "()V", "adapter", "Lapp/callpe/adapters/RechargeAdapter;", "forGames", "", "launcher", "Landroidx/activity/result/ActivityResultLauncher;", "Landroid/content/Intent;", "kotlin.jvm.PlatformType", "toolbar", "Landroidx/appcompat/widget/Toolbar;", "viewModel", "Lapp/callpe/ui/home/AccountViewModel;", "getViewModel", "()Lapp/callpe/ui/home/AccountViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "getContext", "Landroid/content/Context;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initViews", "", "observeEvent", "Lkotlinx/coroutines/Job;", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onOptionsItemSelected", "item", "Landroid/view/MenuItem;", "onResume", "onSaveInstanceState", "outState", "refresh", "setBalance", "data", "Lapp/callpe/data/model/Metadata;", "setUpToolbar", "setupRv", "swipeRefresh", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class WalletActivity extends BaseActivity<ActivityDepositBinding> {
private RechargeAdapter adapter;
private boolean forGames;
private ActivityResultLauncher<Intent> launcher;
private Toolbar toolbar;
private final Lazy viewModel;
public WalletActivity() {
final ComponentActivity componentActivity = (ComponentActivity) this;
final Function0 function0 = null;
this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(AccountViewModel.class), new Function0<ViewModelStore>() {
{
super(0);
}
public final ViewModelStore m2163invoke() {
return componentActivity.getViewModelStore();
}
}, new Function0<ViewModelProvider.Factory>() {
{
super(0);
}
public final ViewModelProvider.Factory m2162invoke() {
return componentActivity.getDefaultViewModelProviderFactory();
}
}, new Function0<CreationExtras>() {
{
super(0);
}
public final CreationExtras m2164invoke() {
CreationExtras creationExtras;
Function0 function02 = function0;
return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
}
});
ActivityResultLauncher<Intent> registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
WalletActivity.launcher$lambda$0(WalletActivity.this, (ActivityResult) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul… }\n }\n }");
this.launcher = registerForActivityResult;
}
@Override
public ActivityDepositBinding inflateLayout(LayoutInflater layoutInflater) {
Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
ActivityDepositBinding inflate = ActivityDepositBinding.inflate(layoutInflater);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
return inflate;
}
public final AccountViewModel getViewModel() {
return (AccountViewModel) this.viewModel.getValue();
}
public static final void launcher$lambda$0(WalletActivity walletActivity, ActivityResult activityResult) {
Intrinsics.checkNotNullParameter(walletActivity, "this$0");
Intrinsics.checkNotNullParameter(activityResult, "result");
if (activityResult.getResultCode() == -1) {
UserAccountFragment.INSTANCE.setRefresh(true);
ChatActivity.refresh = true;
Context context = (Context) walletActivity;
SharedPref.setBoolean(context, PrefKeys.FIRST_RECHARGE_DONE, true);
ActivityExtKt.toast((Activity) walletActivity, "Recharge successfully done");
if (walletActivity.getIntent().getBooleanExtra("video_call_screen", false)) {
if (App.Companion.isVideoCallScreen()) {
Context applicationContext = walletActivity.getApplicationContext();
Intrinsics.checkNotNullExpressionValue(applicationContext, "applicationContext");
walletActivity.startActivity(RtcScreenHandler.getRtcScreenIntent(applicationContext, RtcScreenHandler.getRtcScreenType$default(null, 1, null)));
LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent(Constants.ENABLE_POPUP));
walletActivity.finish();
return;
}
return;
}
walletActivity.refresh();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
boolean z = false;
setWindowFlag((Activity) this, 67108864, false);
getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100053));
if (savedInstanceState != null) {
z = savedInstanceState.getBoolean(Constants.FOR_GAMES);
} else {
Intent intent = getIntent();
if (intent != null && intent.getBooleanExtra(Constants.FOR_GAMES, false)) {
z = true;
}
}
this.forGames = z;
initViews();
setUpToolbar();
setupRv();
swipeRefresh();
observeEvent();
onClicks();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
Intrinsics.checkNotNullParameter(outState, "outState");
outState.putBoolean(Constants.FOR_GAMES, this.forGames);
super.onSaveInstanceState(outState);
}
private final void setupRv() {
((ActivityDepositBinding) getBinding()).rv.setLayoutManager(new GridLayoutManager((Context) this, 3));
this.adapter = new RechargeAdapter(null, new RechargeAdapter.ItemClickListener() {
@Override
public void onItemClick(TopUpModel host) {
boolean z;
ActivityResultLauncher activityResultLauncher;
Intrinsics.checkNotNullParameter(host, "host");
Intent intent = new Intent((Context) WalletActivity.this, (Class<?>) PaymentDetailsActivity.class);
WalletActivity walletActivity = WalletActivity.this;
intent.putExtra("topUpId", host.getId());
intent.putExtra("plan", new Gson().toJson(host));
z = walletActivity.forGames;
intent.putExtra(Constants.FOR_GAMES, z);
activityResultLauncher = walletActivity.launcher;
activityResultLauncher.launch(intent);
}
}, this.forGames, 1, null);
((ActivityDepositBinding) getBinding()).rv.setAdapter(this.adapter);
}
private final void setUpToolbar() {
try {
Toolbar toolbar = this.toolbar;
if (toolbar == null) {
Intrinsics.throwUninitializedPropertyAccessException("toolbar");
toolbar = null;
}
setSupportActionBar(toolbar);
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setDisplayHomeAsUpEnabled(true);
}
} catch (Exception e) {
Timber.e(e, "setUpToolbar: Error ", new Object[0]);
}
}
private final void swipeRefresh() {
getBinding().swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
public final void onRefresh() {
WalletActivity.swipeRefresh$lambda$1(WalletActivity.this);
}
});
}
public static final void swipeRefresh$lambda$1(WalletActivity walletActivity) {
Intrinsics.checkNotNullParameter(walletActivity, "this$0");
walletActivity.getBinding().swipeRefresh.setRefreshing(false);
walletActivity.refresh();
}
public final void refresh() {
RechargeAdapter rechargeAdapter = this.adapter;
if (rechargeAdapter != null) {
rechargeAdapter.clear();
}
if (this.forGames) {
getViewModel().getGameTopUpPlans();
} else {
AccountViewModel.getTopUpPlans$default(getViewModel(), false, 1, null);
}
AccountViewModel.getUserDetails$default(getViewModel(), false, true, 1, null);
}
private final void onClicks() {
getBinding().continueBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalletActivity.onClicks$lambda$4(WalletActivity.this, view);
}
});
getBinding().withdrawBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalletActivity.onClicks$lambda$5(WalletActivity.this, view);
}
});
}
public static final void onClicks$lambda$4(WalletActivity walletActivity, View view) {
ArrayList<TopUpModel> topUpList;
Intrinsics.checkNotNullParameter(walletActivity, "this$0");
RechargeAdapter rechargeAdapter = walletActivity.adapter;
TopUpModel topUpModel = null;
if (rechargeAdapter != null && (topUpList = rechargeAdapter.getTopUpList()) != null) {
Iterator<T> it = topUpList.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Object next = it.next();
if (((TopUpModel) next).getIsSelected()) {
topUpModel = next;
break;
}
}
topUpModel = topUpModel;
}
if (topUpModel != null) {
Intent intent = new Intent((Context) walletActivity, (Class<?>) PaymentDetailsActivity.class);
intent.putExtra("topUpId", topUpModel.getId());
intent.putExtra("plan", new Gson().toJson(topUpModel));
intent.putExtra(Constants.FOR_GAMES, walletActivity.forGames);
walletActivity.launcher.launch(intent);
return;
}
Activity activity = (Activity) walletActivity;
String string = walletActivity.getString(2131952448);
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.please_select_a_valid_plan)");
ActivityExtKt.toast(activity, string);
}
public static final void onClicks$lambda$5(final WalletActivity walletActivity, View view) {
Intrinsics.checkNotNullParameter(walletActivity, "this$0");
try {
new WithdrawGameBalanceDialogFragment(walletActivity.getViewModel().getGameBalance(), new Function1<Double, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke(((Number) obj).doubleValue());
return Unit.INSTANCE;
}
public final void invoke(double d) {
AccountViewModel viewModel;
viewModel = WalletActivity.this.getViewModel();
viewModel.purchaseTalkTime(d);
}
}).show(walletActivity.getSupportFragmentManager(), "WithdrawDialogFragment");
} catch (Exception e) {
Timber.e(e);
}
}
private final void initViews() {
Toolbar toolbar = getBinding().toolbar;
Intrinsics.checkNotNullExpressionValue(toolbar, "binding.toolbar");
this.toolbar = toolbar;
if (this.forGames) {
getBinding().title.setText("Game wallet");
getBinding().talktimeTxt1.setText("Game Balance");
getBinding().talktimeTxt2.setText("Add to game wallet");
LinearLayout linearLayout = getBinding().withdrawParent;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.withdrawParent");
linearLayout.setVisibility(0);
TextView textView = getBinding().withdrawBtn;
Intrinsics.checkNotNullExpressionValue(textView, "binding.withdrawBtn");
textView.setVisibility(0);
}
}
private final Job observeEvent() {
return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new WalletActivity$observeEvent$1(this, null), 3, (Object) null);
}
public final void setBalance(app.callpe.data.model.Metadata data) {
if (this.forGames) {
getBinding().balance.setText(NumberExtKt.formatByNumberDecimalRupee(data.getGameBalance().getBalance(), true));
getBinding().withdrawableBalance.setText(NumberExtKt.formatByNumberDecimalRupee(Math.max(data.getGameBalance().getNetWinning(), 0.0d), true));
} else {
getBinding().balance.setText(NumberExtKt.formatByNumberDecimalRupee$default(data.getBalance().getBalance(), false, 1, null));
}
}
private final Context getContext() {
return (Context) this;
}
protected void onResume() {
super.onResume();
refresh();
}
public boolean onOptionsItemSelected(MenuItem item) {
Intrinsics.checkNotNullParameter(item, "item");
if (item.getItemId() != 16908332) {
return true;
}
finish();
return true;
}
}