正在查看: Rilo v2.0.21 应用的 WalletTxnLogActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 WalletTxnLogActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.home;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import androidx.activity.ComponentActivity;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.menu.MenuBuilder;
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.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import app.callpe.adapters.GameTransactionLogAdapter;
import app.callpe.adapters.WalletLogAdapter;
import app.callpe.common.utils.Constants;
import app.callpe.common.utils.custom.CustomLinearLayoutManager;
import app.callpe.common.utils.extensions.NumberExtKt;
import app.callpe.common.utils.helper_functions.DialogHelper;
import app.callpe.common.utils.listeners.PaginationListener;
import app.callpe.data.model.GameData;
import app.callpe.data.model.GameTransactionLogModel;
import app.callpe.data.model.WalletLogModel;
import app.callpe.databinding.ActivityWalletLogBinding;
import app.callpe.ui.dialog.WithdrawGameBalanceDialogFragment;
import app.callpe.ui.login.LoginActivity;
import app.callpe.ui.payment.WalletActivity;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
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 = {"\u0000r\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\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\u0003\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0006\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u0012\u001a\u00020\u0013H\u0002J\u0010\u0010\u0014\u001a\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u0016H\u0016J\b\u0010\u0017\u001a\u00020\u0018H\u0002J\b\u0010\u0019\u001a\u00020\u001aH\u0002J\b\u0010\u001b\u001a\u00020\u0018H\u0002J\u0012\u0010\u001c\u001a\u00020\u00182\b\u0010\u001d\u001a\u0004\u0018\u00010\u001eH\u0014J\u0012\u0010\u001f\u001a\u00020\u00052\b\u0010 \u001a\u0004\u0018\u00010!H\u0017J\b\u0010\"\u001a\u00020\u0018H\u0014J\u0010\u0010#\u001a\u00020\u00052\u0006\u0010$\u001a\u00020%H\u0016J\u0010\u0010&\u001a\u00020\u00052\u0006\u0010 \u001a\u00020!H\u0016J\u0010\u0010'\u001a\u00020\u00182\u0006\u0010(\u001a\u00020\u001eH\u0014J\b\u0010)\u001a\u00020\u0018H\u0002J\b\u0010*\u001a\u00020\u0018H\u0002J\b\u0010+\u001a\u00020\u0018H\u0002J\u0016\u0010,\u001a\u00020\u00182\u0006\u0010-\u001a\u00020.2\u0006\u0010/\u001a\u000200J\b\u00101\u001a\u00020\u0018H\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082.¢\u0006\u0002\n\u0000R\u001b\u0010\n\u001a\u00020\u000b8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u000e\u0010\u000f\u001a\u0004\b\f\u0010\rR\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0011X\u0082\u000e¢\u0006\u0002\n\u0000¨\u00062"}, d2 = {"Lapp/callpe/ui/home/WalletTxnLogActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityWalletLogBinding;", "()V", "forGames", "", "gameTransactionLogAdapter", "Lapp/callpe/adapters/GameTransactionLogAdapter;", "toolbar", "Landroidx/appcompat/widget/Toolbar;", "viewModel", "Lapp/callpe/ui/home/AccountViewModel;", "getViewModel", "()Lapp/callpe/ui/home/AccountViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "walletLogAdapter", "Lapp/callpe/adapters/WalletLogAdapter;", "getContext", "Landroid/content/Context;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initViews", "", "observeEvent", "Lkotlinx/coroutines/Job;", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onCreateOptionsMenu", "menu", "Landroid/view/Menu;", "onDestroy", "onOptionsItemSelected", "item", "Landroid/view/MenuItem;", "onPrepareOptionsMenu", "onSaveInstanceState", "outState", "refresh", "setUpToolbar", "setupRv", "showGameAmountDetails", "amount", "", "data", "Lapp/callpe/data/model/GameData;", "swipeRefresh", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class WalletTxnLogActivity extends BaseActivity<ActivityWalletLogBinding> {
private boolean forGames;
private GameTransactionLogAdapter gameTransactionLogAdapter;
private Toolbar toolbar;
private final Lazy viewModel;
private WalletLogAdapter walletLogAdapter;
public WalletTxnLogActivity() {
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 m1490invoke() {
return componentActivity.getViewModelStore();
}
}, new Function0<ViewModelProvider.Factory>() {
{
super(0);
}
public final ViewModelProvider.Factory m1489invoke() {
return componentActivity.getDefaultViewModelProviderFactory();
}
}, new Function0<CreationExtras>() {
{
super(0);
}
public final CreationExtras m1491invoke() {
CreationExtras creationExtras;
Function0 function02 = function0;
return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
}
});
}
public final AccountViewModel getViewModel() {
return (AccountViewModel) this.viewModel.getValue();
}
@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();
refresh();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
Intrinsics.checkNotNullParameter(outState, "outState");
outState.putBoolean(Constants.FOR_GAMES, this.forGames);
super.onSaveInstanceState(outState);
}
private final void setupRv() {
int i = 1;
ArrayList arrayList = null;
if (this.forGames) {
final RecyclerView.LayoutManager customLinearLayoutManager = new CustomLinearLayoutManager((Context) this);
((ActivityWalletLogBinding) getBinding()).rv.setLayoutManager(customLinearLayoutManager);
this.gameTransactionLogAdapter = new GameTransactionLogAdapter(null, new GameTransactionLogAdapter.ItemClickListener() {
@Override
public void onItemClick(GameTransactionLogModel model) {
Intrinsics.checkNotNullParameter(model, "model");
if (model.getData() == null) {
return;
}
WalletTxnLogActivity walletTxnLogActivity = WalletTxnLogActivity.this;
double amount = model.getAmount();
GameData data = model.getData();
Intrinsics.checkNotNull(data);
walletTxnLogActivity.showGameAmountDetails(amount, data);
}
}, 1, null);
((ActivityWalletLogBinding) getBinding()).rv.setAdapter(this.gameTransactionLogAdapter);
((ActivityWalletLogBinding) getBinding()).rv.addOnScrollListener(new PaginationListener(customLinearLayoutManager, this) {
final WalletTxnLogActivity this$0;
@Override
public void isScrolled(int dx, int dy) {
}
{
super(customLinearLayoutManager, 20);
this.this$0 = this;
}
@Override
protected void loadMoreItems() {
AccountViewModel viewModel;
AccountViewModel viewModel2;
viewModel = this.this$0.getViewModel();
viewModel.setLoading(true);
viewModel2 = this.this$0.getViewModel();
viewModel2.getGameTransactionLogs();
}
@Override
public boolean isLastPage() {
AccountViewModel viewModel;
viewModel = this.this$0.getViewModel();
return viewModel.getIsLastPage();
}
@Override
public boolean isLoading() {
AccountViewModel viewModel;
viewModel = this.this$0.getViewModel();
return viewModel.getIsLoading();
}
});
return;
}
View view = ((ActivityWalletLogBinding) getBinding()).depositBtn;
Intrinsics.checkNotNullExpressionValue(view, "binding.depositBtn");
view.setVisibility(!BaseActivity.INSTANCE.isStreamer() && !BaseActivity.isAgent ? 0 : 8);
final RecyclerView.LayoutManager customLinearLayoutManager2 = new CustomLinearLayoutManager((Context) this);
((ActivityWalletLogBinding) getBinding()).rv.setLayoutManager(customLinearLayoutManager2);
this.walletLogAdapter = new WalletLogAdapter(arrayList, new WalletLogAdapter.ItemClickListener() {
@Override
public void onItemClick(WalletLogModel model) {
Intrinsics.checkNotNullParameter(model, "model");
}
}, i, arrayList);
((ActivityWalletLogBinding) getBinding()).rv.setAdapter(this.walletLogAdapter);
((ActivityWalletLogBinding) getBinding()).rv.addOnScrollListener(new PaginationListener(customLinearLayoutManager2, this) {
final WalletTxnLogActivity this$0;
@Override
public void isScrolled(int dx, int dy) {
}
{
super(customLinearLayoutManager2, 20);
this.this$0 = this;
}
@Override
protected void loadMoreItems() {
AccountViewModel viewModel;
AccountViewModel viewModel2;
viewModel = this.this$0.getViewModel();
viewModel.setLoading(true);
viewModel2 = this.this$0.getViewModel();
viewModel2.getWalletLogs();
}
@Override
public boolean isLastPage() {
AccountViewModel viewModel;
viewModel = this.this$0.getViewModel();
return viewModel.getIsLastPage();
}
@Override
public boolean isLoading() {
AccountViewModel viewModel;
viewModel = this.this$0.getViewModel();
return viewModel.getIsLoading();
}
});
}
public final void showGameAmountDetails(double amount, GameData data) {
String str;
Intrinsics.checkNotNullParameter(data, "data");
if (((int) data.getPromotional()) >= 0) {
str = NumberExtKt.formatByNumber2DecimalRupee$default(data.getPromotional(), false, 1, null);
} else {
str = "-₹" + NumberExtKt.formatByNumber2Decimal(Math.abs(data.getPromotional()));
}
String str2 = ("Taxable Amount: " + NumberExtKt.formatByNumber2DecimalRupee$default(data.getTaxableAmount(), false, 1, null)) + '\n' + ("28% GST: " + NumberExtKt.formatByNumber2DecimalRupee$default(data.getTaxes(), false, 1, null)) + '\n' + ("Total Amount Paid: " + NumberExtKt.formatByNumberRupee$default((Number) Integer.valueOf((int) (data.getTaxableAmount() + data.getTaxes())), false, 1, (Object) null)) + '\n' + ("Promo: " + str) + '\n' + ("You Got: " + NumberExtKt.formatByNumberRupee$default((Number) Integer.valueOf((int) amount), false, 1, (Object) null));
AlertDialog.Builder builder = new AlertDialog.Builder((Context) this);
builder.setTitle("Deposit details");
builder.setMessage(str2);
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
AlertDialog create = builder.create();
Intrinsics.checkNotNullExpressionValue(create, "alertDialogBuilder.create()");
create.show();
}
private final void setUpToolbar() {
throw new UnsupportedOperationException("Method not decompiled: app.callpe.ui.home.WalletTxnLogActivity.setUpToolbar():void");
}
private final void swipeRefresh() {
getBinding().swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
public final void onRefresh() {
WalletTxnLogActivity.swipeRefresh$lambda$2(WalletTxnLogActivity.this);
}
});
}
public static final void swipeRefresh$lambda$2(WalletTxnLogActivity walletTxnLogActivity) {
Intrinsics.checkNotNullParameter(walletTxnLogActivity, "this$0");
walletTxnLogActivity.getBinding().swipeRefresh.setRefreshing(false);
walletTxnLogActivity.refresh();
}
public final void refresh() {
getViewModel().setLastPage(false);
getViewModel().setLoading(false);
getViewModel().setFromId(-1L);
getViewModel().getWallLogList().clear();
getViewModel().getGameTransactionLogList().clear();
WalletLogAdapter walletLogAdapter = this.walletLogAdapter;
if (walletLogAdapter != null) {
walletLogAdapter.clear();
}
GameTransactionLogAdapter gameTransactionLogAdapter = this.gameTransactionLogAdapter;
if (gameTransactionLogAdapter != null) {
gameTransactionLogAdapter.clear();
}
getViewModel().getWalletLogs();
getViewModel().getUserWalletBalance();
}
private final void onClicks() {
getBinding().balanceParent.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalletTxnLogActivity.onClicks$lambda$5(WalletTxnLogActivity.this, view);
}
});
getBinding().depositBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalletTxnLogActivity.onClicks$lambda$8(WalletTxnLogActivity.this, view);
}
});
getBinding().withdrawBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalletTxnLogActivity.onClicks$lambda$9(WalletTxnLogActivity.this, view);
}
});
}
public static final void onClicks$lambda$5(WalletTxnLogActivity walletTxnLogActivity, View view) {
Intrinsics.checkNotNullParameter(walletTxnLogActivity, "this$0");
if (LoginActivity.INSTANCE.isVitok()) {
return;
}
if (walletTxnLogActivity.forGames) {
Intent intent = new Intent((Context) walletTxnLogActivity, (Class<?>) WalletActivity.class);
intent.putExtra(Constants.FOR_GAMES, true);
walletTxnLogActivity.startActivity(intent);
return;
}
walletTxnLogActivity.startActivity(new Intent((Context) walletTxnLogActivity, (Class<?>) WalletActivity.class));
}
public static final void onClicks$lambda$8(WalletTxnLogActivity walletTxnLogActivity, View view) {
Intrinsics.checkNotNullParameter(walletTxnLogActivity, "this$0");
if (walletTxnLogActivity.forGames) {
Intent intent = new Intent((Context) walletTxnLogActivity, (Class<?>) WalletActivity.class);
intent.putExtra(Constants.FOR_GAMES, true);
walletTxnLogActivity.startActivity(intent);
return;
}
walletTxnLogActivity.startActivity(new Intent((Context) walletTxnLogActivity, (Class<?>) WalletActivity.class));
}
public static final void onClicks$lambda$9(final WalletTxnLogActivity walletTxnLogActivity, View view) {
Intrinsics.checkNotNullParameter(walletTxnLogActivity, "this$0");
try {
new WithdrawGameBalanceDialogFragment(walletTxnLogActivity.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 = WalletTxnLogActivity.this.getViewModel();
viewModel.purchaseTalkTime(d);
}
}).show(walletTxnLogActivity.getSupportFragmentManager(), "WithdrawDialogFragment");
} catch (Exception e) {
Timber.e(e);
}
}
private final void initViews() {
Toolbar toolbar = getBinding().toolbar;
Intrinsics.checkNotNullExpressionValue(toolbar, "binding.toolbar");
this.toolbar = toolbar;
ImageView imageView = getBinding().beanIcon;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.beanIcon");
imageView.setVisibility(LoginActivity.INSTANCE.isVitok() ? 0 : 8);
if (LoginActivity.INSTANCE.isVitok()) {
return;
}
if (this.forGames) {
ImageView imageView2 = getBinding().gameIcon;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.gameIcon");
imageView2.setVisibility(0);
ImageView imageView3 = getBinding().callIcon;
Intrinsics.checkNotNullExpressionValue(imageView3, "binding.callIcon");
imageView3.setVisibility(8);
getBinding().title.setText("Game Transactions");
getBinding().depositBtn.setText("Add game balance");
View view = getBinding().withdrawBtn;
Intrinsics.checkNotNullExpressionValue(view, "binding.withdrawBtn");
view.setVisibility(0);
return;
}
ImageView imageView4 = getBinding().gameIcon;
Intrinsics.checkNotNullExpressionValue(imageView4, "binding.gameIcon");
imageView4.setVisibility(8);
ImageView imageView5 = getBinding().callIcon;
Intrinsics.checkNotNullExpressionValue(imageView5, "binding.callIcon");
imageView5.setVisibility(0);
}
private final Job observeEvent() {
return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new WalletTxnLogActivity$observeEvent$1(this, null), 3, (Object) null);
}
private final Context getContext() {
return (Context) this;
}
protected void onDestroy() {
super.onDestroy();
}
public boolean onPrepareOptionsMenu(Menu menu) {
Intrinsics.checkNotNullParameter(menu, "menu");
menu.findItem(2131363975).setVisible(BaseActivity.isUser);
return super.onPrepareOptionsMenu(menu);
}
public boolean onCreateOptionsMenu(Menu menu) {
if (menu instanceof MenuBuilder) {
((MenuBuilder) menu).setOptionalIconsVisible(true);
}
MenuInflater menuInflater = getMenuInflater();
Intrinsics.checkNotNullExpressionValue(menuInflater, "menuInflater");
menuInflater.inflate(2131689487, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
Intrinsics.checkNotNullParameter(item, "item");
int itemId = item.getItemId();
if (itemId == 16908332) {
finish();
} else if (itemId == 2131363975) {
DialogHelper.showReasonDialog((Context) this, getString(2131953083), "This will delete all the transaction logs. Do you want to continue?", true, new DialogHelper.Listener() {
@Override
public void onNegativeClick() {
}
@Override
public void onPositiveClick() {
boolean z;
AccountViewModel viewModel;
AccountViewModel viewModel2;
z = WalletTxnLogActivity.this.forGames;
if (z) {
viewModel2 = WalletTxnLogActivity.this.getViewModel();
viewModel2.deleteGameTransactionLogs();
} else {
viewModel = WalletTxnLogActivity.this.getViewModel();
viewModel.deleteTransactionLogs();
}
}
});
}
return true;
}
@Override
public ActivityWalletLogBinding inflateLayout(LayoutInflater layoutInflater) {
Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
ActivityWalletLogBinding inflate = ActivityWalletLogBinding.inflate(layoutInflater);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
return inflate;
}
}