正在查看: Rilo v2.0.21 应用的 LudoGameBottomSheet.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 LudoGameBottomSheet.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.user.games.bottomsheet;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.OnBackPressedDispatcher;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentViewModelLazyKt;
import androidx.lifecycle.HasDefaultViewModelProviderFactory;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.lifecycle.viewmodel.CreationExtras;
import app.callpe.common.agora.LiveStreamCloseEvent;
import app.callpe.common.utils.RxBus;
import app.callpe.common.utils.extensions.FragmentExtKt;
import app.callpe.common.utils.extensions.NumberExtKt;
import app.callpe.common.utils.extensions.ViewExtKt;
import app.callpe.common.utils.helper_functions.Utils;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.LoginResponse;
import app.callpe.data.model.LudoGameModel;
import app.callpe.data.model.LudoGameRequestModel;
import app.callpe.databinding.LudoGameBottomSheetBinding;
import app.callpe.databinding.LudoGameMainBinding;
import app.callpe.databinding.LudoGameMatchmakingBinding;
import app.callpe.ui.dialog.RechargeDialog;
import app.callpe.ui.user.games.GameViewModel;
import app.callpe.ui.user.games.bottomsheet.GameRulesInfoSheet;
import app.callpe.ui.user.games.bottomsheet.LudoGameBottomSheet;
import com.bumptech.glide.Glide;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.chip.Chip;
import com.google.gson.Gson;
import com.vdx.sud.SudGameActivity;
import com.vdx.sud.service.LudoGameService;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CancellationException;
import javax.inject.Inject;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
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 kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CompletableJob;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.SupervisorKt;
import timber.log.Timber;
@Metadata(d1 = {"\u0000Ð\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0006\n\u0002\u0010\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010 \n\u0002\b\u0006\n\u0002\u0010\t\n\u0002\b\u0006\b\u0007\u0018\u00002\u00020\u0001:\u0004qrstB%\b\u0016\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\u0012\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00070\u0005¢\u0006\u0002\u0010\bB\u0005¢\u0006\u0002\u0010\tJ\b\u0010G\u001a\u00020\u0007H\u0002J\b\u0010H\u001a\u00020\u0007H\u0016J\b\u0010I\u001a\u00020\u0007H\u0002J\b\u0010J\u001a\u00020\u0007H\u0002J\u0010\u0010K\u001a\u00020\u00072\u0006\u0010L\u001a\u00020MH\u0002J\u0010\u0010N\u001a\u00020\u00072\u0006\u0010O\u001a\u00020PH\u0002J\b\u0010Q\u001a\u00020\u0007H\u0002J\b\u0010R\u001a\u00020SH\u0002J\b\u0010T\u001a\u00020\u0007H\u0002J\u0012\u0010U\u001a\u00020V2\b\u0010W\u001a\u0004\u0018\u00010XH\u0016J$\u0010Y\u001a\u00020Z2\u0006\u0010[\u001a\u00020\\2\b\u0010]\u001a\u0004\u0018\u00010^2\b\u0010W\u001a\u0004\u0018\u00010XH\u0016J\b\u0010_\u001a\u00020\u0007H\u0016J\u0010\u0010`\u001a\u00020\u00072\u0006\u0010a\u001a\u00020bH\u0016J\u001a\u0010c\u001a\u00020\u00072\u0006\u0010d\u001a\u00020Z2\b\u0010W\u001a\u0004\u0018\u00010XH\u0016J\b\u0010e\u001a\u00020\u0007H\u0002J\u0016\u0010f\u001a\u00020\u00072\f\u0010g\u001a\b\u0012\u0004\u0012\u00020:0hH\u0002J\b\u0010i\u001a\u00020\u0007H\u0002J\b\u0010j\u001a\u00020\u0007H\u0002J\u0010\u0010k\u001a\u00020\u00072\u0006\u0010\u0002\u001a\u00020\u0003H\u0002J(\u0010l\u001a\u00020\u00072\u0006\u0010m\u001a\u00020:2\u0006\u0010n\u001a\u00020o2\u0006\u00109\u001a\u00020:2\u0006\u0010p\u001a\u00020:H\u0002R\u0012\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0082\u000e¢\u0006\u0004\n\u0002\u0010\nR\u000e\u0010\u000b\u001a\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\rX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0010X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u0011\u001a\u00020\u0012X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0013\u0010\u0014\"\u0004\b\u0015\u0010\u0016R\u0010\u0010\u0017\u001a\u0004\u0018\u00010\u0018X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0019\u001a\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u001a\u001a\u0004\u0018\u00010\u001bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001c\u0010\u001d\"\u0004\b\u001e\u0010\u001fR\u000e\u0010 \u001a\u00020!X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\"\u001a\u0004\u0018\u00010#X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b$\u0010%\"\u0004\b&\u0010'R\u0010\u0010(\u001a\u0004\u0018\u00010)X\u0082\u000e¢\u0006\u0002\n\u0000R\u001e\u0010*\u001a\u0004\u0018\u00010\u0003X\u0086\u000e¢\u0006\u0010\n\u0002\u0010\n\u001a\u0004\b+\u0010,\"\u0004\b-\u0010.R\u0010\u0010/\u001a\u0004\u0018\u000100X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u0004\u001a\u0010\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u001e\u00101\u001a\u0002028\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b3\u00104\"\u0004\b5\u00106R\u000e\u00107\u001a\u000208X\u0082\u000e¢\u0006\u0002\n\u0000R$\u00109\u001a\u00020:8\u0006@\u0006X\u0087.¢\u0006\u0014\n\u0000\u0012\u0004\b;\u0010\t\u001a\u0004\b<\u0010=\"\u0004\b>\u0010?R\u001b\u0010@\u001a\u00020A8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bD\u0010E\u001a\u0004\bB\u0010CR\u000e\u0010F\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006u"}, d2 = {"Lapp/callpe/ui/user/games/bottomsheet/LudoGameBottomSheet;", "Lcom/google/android/material/bottomsheet/BottomSheetDialogFragment;", "balance", "", "onSuccess", "Lkotlin/Function1;", "", "", "(Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;)V", "()V", "Ljava/lang/Integer;", "betAmount", "binding", "Lapp/callpe/databinding/LudoGameBottomSheetBinding;", "currentSelectedButton", "currentStatus", "Lapp/callpe/ui/user/games/bottomsheet/LudoGameBottomSheet$GameRequestStatus;", "fromLiveStream", "", "getFromLiveStream", "()Z", "setFromLiveStream", "(Z)V", "gameRuleInfoSheet", "Lapp/callpe/ui/user/games/bottomsheet/GameRulesInfoSheet;", "gameSelectionButton", "getResponse", "Lapp/callpe/data/model/LoginResponse;", "getGetResponse", "()Lapp/callpe/data/model/LoginResponse;", "setGetResponse", "(Lapp/callpe/data/model/LoginResponse;)V", "job", "Lkotlinx/coroutines/CompletableJob;", "listener", "Lapp/callpe/ui/user/games/bottomsheet/LudoGameBottomSheet$BottomSheetDialogListener;", "getListener", "()Lapp/callpe/ui/user/games/bottomsheet/LudoGameBottomSheet$BottomSheetDialogListener;", "setListener", "(Lapp/callpe/ui/user/games/bottomsheet/LudoGameBottomSheet$BottomSheetDialogListener;)V", "ludoGameService", "Lcom/vdx/sud/service/LudoGameService;", "ludoHouseCutInPercent", "getLudoHouseCutInPercent", "()Ljava/lang/Integer;", "setLudoHouseCutInPercent", "(Ljava/lang/Integer;)V", "mServiceIntent", "Landroid/content/Intent;", "rxBus", "Lapp/callpe/common/utils/RxBus;", "getRxBus", "()Lapp/callpe/common/utils/RxBus;", "setRxBus", "(Lapp/callpe/common/utils/RxBus;)V", "scope", "Lkotlinx/coroutines/CoroutineScope;", "userId", "", "getUserId$annotations", "getUserId", "()Ljava/lang/String;", "setUserId", "(Ljava/lang/String;)V", "viewModel", "Lapp/callpe/ui/user/games/GameViewModel;", "getViewModel", "()Lapp/callpe/ui/user/games/GameViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "winAmount", "calculateWinAmount", "dismiss", "dismissFragmentSafely", "fetchLatestBalance", "handleGameSuccess", "ludoGameModel", "Lapp/callpe/data/model/LudoGameModel;", "handleLudoRequestStatus", "requestModel", "Lapp/callpe/data/model/LudoGameRequestModel;", "handleSelectionButtonClicks", "observeEvent", "Lkotlinx/coroutines/Job;", "onClicks", "onCreateDialog", "Landroid/app/Dialog;", "savedInstanceState", "Landroid/os/Bundle;", "onCreateView", "Landroid/view/View;", "inflater", "Landroid/view/LayoutInflater;", "container", "Landroid/view/ViewGroup;", "onDestroy", "onDismiss", "dialog", "Landroid/content/DialogInterface;", "onViewCreated", "view", "openRulesBottomSheet", "setUpBetList", "bets", "", "starServiceFunc", "stopServiceFunc", "updateBalance", "updateServiceFunc", "gameRoomId", "gameId", "", "sessionToken", "BottomSheetDialogListener", "GameMode", "GameRequestStatus", "GameType", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class LudoGameBottomSheet extends Hilt_LudoGameBottomSheet {
private Integer balance;
private int betAmount;
private LudoGameBottomSheetBinding binding;
private int currentSelectedButton;
private GameRequestStatus currentStatus;
private boolean fromLiveStream;
private GameRulesInfoSheet gameRuleInfoSheet;
private int gameSelectionButton;
private LoginResponse getResponse;
private CompletableJob job;
private BottomSheetDialogListener listener;
private LudoGameService ludoGameService;
private Integer ludoHouseCutInPercent;
private Intent mServiceIntent;
private Function1<? super Double, Unit> onSuccess;
@Inject
public RxBus rxBus;
private CoroutineScope scope;
@Inject
public String userId;
private final Lazy viewModel;
private double winAmount;
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\bf\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H&¨\u0006\u0004"}, d2 = {"Lapp/callpe/ui/user/games/bottomsheet/LudoGameBottomSheet$BottomSheetDialogListener;", "", "onBottomSheetDismissed", "", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public interface BottomSheetDialogListener {
void onBottomSheetDismissed();
}
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0004\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004¨\u0006\u0005"}, d2 = {"Lapp/callpe/ui/user/games/bottomsheet/LudoGameBottomSheet$GameMode;", "", "(Ljava/lang/String;I)V", "ONE_VS_ONE", "PLAYER_4", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum GameMode {
ONE_VS_ONE,
PLAYER_4
}
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0007\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005j\u0002\b\u0006j\u0002\b\u0007¨\u0006\b"}, d2 = {"Lapp/callpe/ui/user/games/bottomsheet/LudoGameBottomSheet$GameRequestStatus;", "", "(Ljava/lang/String;I)V", "PENDING", "IN_PROGRESS", "CANCELLED", "MATCHED", "NO_STATUS", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum GameRequestStatus {
PENDING,
IN_PROGRESS,
CANCELLED,
MATCHED,
NO_STATUS
}
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0004\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004¨\u0006\u0005"}, d2 = {"Lapp/callpe/ui/user/games/bottomsheet/LudoGameBottomSheet$GameType;", "", "(Ljava/lang/String;I)V", "QUICK", "CLASSIC", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum GameType {
QUICK,
CLASSIC
}
public static void getUserId$annotations() {
}
public LudoGameBottomSheet() {
final Fragment fragment = (Fragment) this;
final Function0<Fragment> function0 = new Function0<Fragment>() {
{
super(0);
}
public final Fragment m2355invoke() {
return fragment;
}
};
final Lazy lazy = LazyKt.lazy(LazyThreadSafetyMode.NONE, new Function0<ViewModelStoreOwner>() {
{
super(0);
}
public final ViewModelStoreOwner m2356invoke() {
return (ViewModelStoreOwner) function0.invoke();
}
});
final Function0 function02 = null;
this.viewModel = FragmentViewModelLazyKt.createViewModelLazy(fragment, Reflection.getOrCreateKotlinClass(GameViewModel.class), new Function0<ViewModelStore>() {
{
super(0);
}
public final ViewModelStore m2357invoke() {
ViewModelStore viewModelStore = FragmentViewModelLazyKt.access$viewModels$lambda-1(lazy).getViewModelStore();
Intrinsics.checkNotNullExpressionValue(viewModelStore, "owner.viewModelStore");
return viewModelStore;
}
}, new Function0<CreationExtras>() {
{
super(0);
}
public final CreationExtras m2358invoke() {
CreationExtras creationExtras;
Function0 function03 = function02;
if (function03 != null && (creationExtras = (CreationExtras) function03.invoke()) != null) {
return creationExtras;
}
HasDefaultViewModelProviderFactory hasDefaultViewModelProviderFactory = FragmentViewModelLazyKt.access$viewModels$lambda-1(lazy);
HasDefaultViewModelProviderFactory hasDefaultViewModelProviderFactory2 = hasDefaultViewModelProviderFactory instanceof HasDefaultViewModelProviderFactory ? hasDefaultViewModelProviderFactory : null;
CreationExtras defaultViewModelCreationExtras = hasDefaultViewModelProviderFactory2 != null ? hasDefaultViewModelProviderFactory2.getDefaultViewModelCreationExtras() : null;
return defaultViewModelCreationExtras == null ? CreationExtras.Empty.INSTANCE : defaultViewModelCreationExtras;
}
}, new Function0<ViewModelProvider.Factory>() {
{
super(0);
}
public final ViewModelProvider.Factory m2359invoke() {
ViewModelProvider.Factory defaultViewModelProviderFactory;
HasDefaultViewModelProviderFactory hasDefaultViewModelProviderFactory = FragmentViewModelLazyKt.access$viewModels$lambda-1(lazy);
HasDefaultViewModelProviderFactory hasDefaultViewModelProviderFactory2 = hasDefaultViewModelProviderFactory instanceof HasDefaultViewModelProviderFactory ? hasDefaultViewModelProviderFactory : null;
if (hasDefaultViewModelProviderFactory2 == null || (defaultViewModelProviderFactory = hasDefaultViewModelProviderFactory2.getDefaultViewModelProviderFactory()) == null) {
defaultViewModelProviderFactory = fragment.getDefaultViewModelProviderFactory();
}
Intrinsics.checkNotNullExpressionValue(defaultViewModelProviderFactory, "(owner as? HasDefaultVie…tViewModelProviderFactory");
return defaultViewModelProviderFactory;
}
});
this.job = SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null);
this.scope = CoroutineScopeKt.CoroutineScope(Dispatchers.getMain().plus(this.job));
this.currentStatus = GameRequestStatus.NO_STATUS;
this.currentSelectedButton = 1;
this.gameSelectionButton = 1;
}
public final BottomSheetDialogListener getListener() {
return this.listener;
}
public final void setListener(BottomSheetDialogListener bottomSheetDialogListener) {
this.listener = bottomSheetDialogListener;
}
public final GameViewModel getViewModel() {
return (GameViewModel) this.viewModel.getValue();
}
public final Integer getLudoHouseCutInPercent() {
return this.ludoHouseCutInPercent;
}
public final void setLudoHouseCutInPercent(Integer num) {
this.ludoHouseCutInPercent = num;
}
public final String getUserId() {
String str = this.userId;
if (str != null) {
return str;
}
Intrinsics.throwUninitializedPropertyAccessException("userId");
return null;
}
public final void setUserId(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.userId = str;
}
public final RxBus getRxBus() {
RxBus rxBus = this.rxBus;
if (rxBus != null) {
return rxBus;
}
Intrinsics.throwUninitializedPropertyAccessException("rxBus");
return null;
}
public final void setRxBus(RxBus rxBus) {
Intrinsics.checkNotNullParameter(rxBus, "<set-?>");
this.rxBus = rxBus;
}
public final boolean getFromLiveStream() {
return this.fromLiveStream;
}
public final void setFromLiveStream(boolean z) {
this.fromLiveStream = z;
}
public LudoGameBottomSheet(Integer num, Function1<? super Double, Unit> function1) {
this();
Intrinsics.checkNotNullParameter(function1, "onSuccess");
this.balance = num;
this.onSuccess = function1;
}
public void onDismiss(DialogInterface dialog) {
Intrinsics.checkNotNullParameter(dialog, "dialog");
if (this.currentStatus != GameRequestStatus.NO_STATUS && this.currentStatus != GameRequestStatus.CANCELLED) {
FragmentExtKt.toast((Fragment) this, "Please cancel matchmaking!");
return;
}
super.onDismiss(dialog);
BottomSheetDialogListener bottomSheetDialogListener = this.listener;
if (bottomSheetDialogListener != null) {
bottomSheetDialogListener.onBottomSheetDismissed();
}
}
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog bottomSheetDialog = new BottomSheetDialog(requireContext(), 2132018085);
bottomSheetDialog.setCanceledOnTouchOutside(false);
return bottomSheetDialog;
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Intrinsics.checkNotNullParameter(inflater, "inflater");
LudoGameBottomSheetBinding inflate = LudoGameBottomSheetBinding.inflate(inflater, container, false);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(inflater, container, false)");
this.binding = inflate;
if (inflate == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
inflate = null;
}
FrameLayout root = inflate.getRoot();
Intrinsics.checkNotNullExpressionValue(root, "binding.root");
return root;
}
public void onViewCreated(View view, Bundle savedInstanceState) {
OnBackPressedDispatcher onBackPressedDispatcher;
Intrinsics.checkNotNullParameter(view, "view");
super.onViewCreated(view, savedInstanceState);
onClicks();
observeEvent();
fetchLatestBalance();
FragmentActivity activity = getActivity();
if (activity == null || (onBackPressedDispatcher = activity.getOnBackPressedDispatcher()) == null) {
return;
}
LifecycleOwner viewLifecycleOwner = getViewLifecycleOwner();
Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "viewLifecycleOwner");
onBackPressedDispatcher.addCallback(viewLifecycleOwner, new OnBackPressedCallback() {
{
super(true);
}
public void handleOnBackPressed() {
LudoGameBottomSheet.GameRequestStatus gameRequestStatus;
LudoGameBottomSheet.GameRequestStatus gameRequestStatus2;
FragmentExtKt.toast(LudoGameBottomSheet.this, "called");
gameRequestStatus = LudoGameBottomSheet.this.currentStatus;
if (gameRequestStatus != LudoGameBottomSheet.GameRequestStatus.NO_STATUS) {
gameRequestStatus2 = LudoGameBottomSheet.this.currentStatus;
if (gameRequestStatus2 != LudoGameBottomSheet.GameRequestStatus.CANCELLED) {
FragmentExtKt.toast(LudoGameBottomSheet.this, "Please cancel matchmaking!");
return;
}
}
LudoGameBottomSheet.this.dismiss();
}
});
}
public final LoginResponse getGetResponse() {
return this.getResponse;
}
public final void setGetResponse(LoginResponse loginResponse) {
this.getResponse = loginResponse;
}
private final void fetchLatestBalance() {
ArrayList arrayListOf;
List split$default;
getViewModel().getOnGoingGame();
getViewModel().getUserWalletBalance();
this.getResponse = (LoginResponse) new Gson().fromJson(SharedPref.getString(requireContext(), PrefKeys.LOGIN_RESPONSE), LoginResponse.class);
String string = SharedPref.getString(requireContext(), PrefKeys.LUDO_BET_AMOUNTS);
if (string == null || (split$default = StringsKt.split$default(string, new String[]{","}, false, 0, 6, (Object) null)) == null || (arrayListOf = CollectionsKt.toList(split$default)) == null) {
arrayListOf = CollectionsKt.arrayListOf(new String[]{"10", "20", "30"});
}
this.ludoHouseCutInPercent = SharedPref.getInt(requireContext(), PrefKeys.HOUSE_CUT);
setUpBetList(arrayListOf);
}
private final Job observeEvent() {
return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new LudoGameBottomSheet$observeEvent$1(this, null), 3, (Object) null);
}
public final void handleGameSuccess(LudoGameModel ludoGameModel) {
String string = SharedPref.getString(getContext(), PrefKeys.AUTH_TOKEN);
SudGameActivity.start(requireContext(), ludoGameModel.getGameRoomId(), 1468180338417074177L, getUserId(), string);
String gameRoomId = ludoGameModel.getGameRoomId();
String userId = getUserId();
Intrinsics.checkNotNullExpressionValue(string, "sessionToken");
updateServiceFunc(gameRoomId, 1468180338417074177L, userId, string);
Job.DefaultImpls.cancel$default(this.job, (CancellationException) null, 1, (Object) null);
dismissFragmentSafely();
if (this.fromLiveStream) {
getRxBus().send(new LiveStreamCloseEvent(false));
}
}
public final void handleLudoRequestStatus(LudoGameRequestModel requestModel) {
if (Intrinsics.areEqual(this.currentStatus.name(), requestModel.getStatus())) {
}
String status = requestModel.getStatus();
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = null;
switch (status.hashCode()) {
case -1031784143:
if (status.equals("CANCELLED")) {
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = this.binding;
if (ludoGameBottomSheetBinding2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding2 = null;
}
FrameLayout root = ludoGameBottomSheetBinding2.ludoGameMainParent.getRoot();
Intrinsics.checkNotNullExpressionValue(root, "binding.ludoGameMainParent.root");
root.setVisibility(0);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding3 = this.binding;
if (ludoGameBottomSheetBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding3 = null;
}
FrameLayout root2 = ludoGameBottomSheetBinding3.ludoGameMatchmakingParent.getRoot();
Intrinsics.checkNotNullExpressionValue(root2, "binding.ludoGameMatchmakingParent.root");
root2.setVisibility(8);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding4 = this.binding;
if (ludoGameBottomSheetBinding4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding4 = null;
}
ProgressBar progressBar = ludoGameBottomSheetBinding4.ludoGameMainParent.spinProgress;
Intrinsics.checkNotNullExpressionValue(progressBar, "binding.ludoGameMainParent.spinProgress");
progressBar.setVisibility(8);
setCancelable(true);
this.currentStatus = GameRequestStatus.CANCELLED;
CoroutineScopeKt.cancel$default(this.scope, (CancellationException) null, 1, (Object) null);
this.job = SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null);
this.scope = CoroutineScopeKt.CoroutineScope(Dispatchers.getMain().plus(this.job));
stopServiceFunc();
break;
}
break;
case -604548089:
if (status.equals("IN_PROGRESS")) {
this.currentStatus = GameRequestStatus.IN_PROGRESS;
LudoGameBottomSheetBinding ludoGameBottomSheetBinding5 = this.binding;
if (ludoGameBottomSheetBinding5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding5 = null;
}
FrameLayout root3 = ludoGameBottomSheetBinding5.ludoGameMainParent.getRoot();
Intrinsics.checkNotNullExpressionValue(root3, "binding.ludoGameMainParent.root");
root3.setVisibility(8);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding6 = this.binding;
if (ludoGameBottomSheetBinding6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
ludoGameBottomSheetBinding = ludoGameBottomSheetBinding6;
}
FrameLayout root4 = ludoGameBottomSheetBinding.ludoGameMatchmakingParent.getRoot();
Intrinsics.checkNotNullExpressionValue(root4, "binding.ludoGameMatchmakingParent.root");
root4.setVisibility(0);
setCancelable(false);
break;
}
break;
case 35394935:
if (status.equals("PENDING")) {
this.currentStatus = GameRequestStatus.PENDING;
setCancelable(false);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding7 = this.binding;
if (ludoGameBottomSheetBinding7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding7 = null;
}
FrameLayout root5 = ludoGameBottomSheetBinding7.ludoGameMainParent.getRoot();
Intrinsics.checkNotNullExpressionValue(root5, "binding.ludoGameMainParent.root");
root5.setVisibility(8);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding8 = this.binding;
if (ludoGameBottomSheetBinding8 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding8 = null;
}
FrameLayout root6 = ludoGameBottomSheetBinding8.ludoGameMatchmakingParent.getRoot();
Intrinsics.checkNotNullExpressionValue(root6, "binding.ludoGameMatchmakingParent.root");
root6.setVisibility(0);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding9 = this.binding;
if (ludoGameBottomSheetBinding9 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding9 = null;
}
LudoGameMatchmakingBinding ludoGameMatchmakingBinding = ludoGameBottomSheetBinding9.ludoGameMatchmakingParent;
LoginResponse loginResponse = this.getResponse;
if (loginResponse != null) {
Glide.with(requireContext()).load(loginResponse.getAvatar()).error(2131230881).into(ludoGameMatchmakingBinding.profileImageSmall);
ludoGameMatchmakingBinding.currentPlayerName.setText(loginResponse.getName());
}
if (Intrinsics.areEqual(requestModel.getGameMode(), "ONE_VS_ONE")) {
FrameLayout frameLayout = ludoGameMatchmakingBinding.player4ParentLayout;
Intrinsics.checkNotNullExpressionValue(frameLayout, "player4ParentLayout");
frameLayout.setVisibility(8);
FrameLayout frameLayout2 = ludoGameMatchmakingBinding.singlePlayerParentLayout;
Intrinsics.checkNotNullExpressionValue(frameLayout2, "singlePlayerParentLayout");
frameLayout2.setVisibility(0);
} else {
FrameLayout frameLayout3 = ludoGameMatchmakingBinding.player4ParentLayout;
Intrinsics.checkNotNullExpressionValue(frameLayout3, "player4ParentLayout");
frameLayout3.setVisibility(0);
FrameLayout frameLayout4 = ludoGameMatchmakingBinding.singlePlayerParentLayout;
Intrinsics.checkNotNullExpressionValue(frameLayout4, "singlePlayerParentLayout");
frameLayout4.setVisibility(8);
}
ludoGameMatchmakingBinding.winAmountTv.setText(StringsKt.replace$default(StringsKt.replace$default("Bet Amount: {bet_amount}\nWin Amount: {win_amount}", "{bet_amount}", NumberExtKt.formatByNumberRupee$default((Number) Integer.valueOf(this.betAmount), false, 1, (Object) null), false, 4, (Object) null), "{win_amount}", NumberExtKt.formatByNumberRupee$default(this.winAmount, false, 1, (Object) null), false, 4, (Object) null));
break;
}
break;
case 1558844676:
if (status.equals("MATCHED")) {
FragmentExtKt.toast((Fragment) this, "Match found");
this.currentStatus = GameRequestStatus.MATCHED;
GameViewModel viewModel = getViewModel();
Long gameId = requestModel.getGameId();
viewModel.getLudoGame(gameId != null ? gameId.longValue() : -1L);
CoroutineScopeKt.cancel$default(this.scope, (CancellationException) null, 1, (Object) null);
this.job = SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null);
this.scope = CoroutineScopeKt.CoroutineScope(Dispatchers.getMain().plus(this.job));
setCancelable(true);
break;
}
break;
}
}
public final void updateBalance(int balance) {
getViewModel().setBalance(Double.valueOf(balance));
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = this.binding;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
ludoGameBottomSheetBinding.ludoGameMainParent.tvLudoMybalance.setText(NumberExtKt.formatByNumberRupee$default((Number) Integer.valueOf(balance), false, 1, (Object) null));
}
private final void openRulesBottomSheet() {
try {
if (this.currentStatus != GameRequestStatus.NO_STATUS && this.currentStatus != GameRequestStatus.CANCELLED) {
FragmentExtKt.toast((Fragment) this, "Cancel matchmaking to view rules.");
return;
}
GameRulesInfoSheet newInstance = GameRulesInfoSheet.INSTANCE.newInstance("LUDO_GAME");
this.gameRuleInfoSheet = newInstance;
if (newInstance != null) {
newInstance.setListener(new GameRulesInfoSheet.BottomSheetDialogListener() {
@Override
public void onBottomSheetDismissed() {
}
});
}
GameRulesInfoSheet gameRulesInfoSheet = this.gameRuleInfoSheet;
if (gameRulesInfoSheet != null) {
gameRulesInfoSheet.show(getChildFragmentManager(), "gameRulesSheet");
}
} catch (Exception e) {
Timber.e(e);
}
}
private final void onClicks() {
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = this.binding;
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = null;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
LudoGameMainBinding ludoGameMainBinding = ludoGameBottomSheetBinding.ludoGameMainParent;
ludoGameMainBinding.tvLudoMybalance.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoGameBottomSheet.onClicks$lambda$4$lambda$2(LudoGameBottomSheet.this, view);
}
});
ludoGameMainBinding.play.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoGameBottomSheet.onClicks$lambda$4$lambda$3(LudoGameBottomSheet.this, view);
}
});
LudoGameBottomSheetBinding ludoGameBottomSheetBinding3 = this.binding;
if (ludoGameBottomSheetBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding3 = null;
}
ludoGameBottomSheetBinding3.ludoGameMatchmakingParent.cancelBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoGameBottomSheet.onClicks$lambda$6$lambda$5(LudoGameBottomSheet.this, view);
}
});
LudoGameBottomSheetBinding ludoGameBottomSheetBinding4 = this.binding;
if (ludoGameBottomSheetBinding4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding4 = null;
}
ludoGameBottomSheetBinding4.ivLudoClose.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoGameBottomSheet.onClicks$lambda$7(LudoGameBottomSheet.this, view);
}
});
LudoGameBottomSheetBinding ludoGameBottomSheetBinding5 = this.binding;
if (ludoGameBottomSheetBinding5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
ludoGameBottomSheetBinding2 = ludoGameBottomSheetBinding5;
}
ludoGameBottomSheetBinding2.ivLudoRule.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoGameBottomSheet.onClicks$lambda$8(LudoGameBottomSheet.this, view);
}
});
handleSelectionButtonClicks();
}
public static final void onClicks$lambda$4$lambda$2(LudoGameBottomSheet ludoGameBottomSheet, View view) {
RechargeDialog rechargeDialog;
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
try {
rechargeDialog = new RechargeDialog(null, null, null, "Recharge now and enjoy the game!", null, new Function0<Unit>() {
public final void m2360invoke() {
}
public Object invoke() {
m2360invoke();
return Unit.INSTANCE;
}
}, new Function0<Unit>() {
public final void m2361invoke() {
}
public Object invoke() {
m2361invoke();
return Unit.INSTANCE;
}
});
rechargeDialog.setCancelable(true);
} catch (Exception unused) {
FragmentExtKt.toast((Fragment) ludoGameBottomSheet, ludoGameBottomSheet.getString(2131951993));
}
if (!rechargeDialog.isAdded() && !rechargeDialog.isVisible()) {
rechargeDialog.show(ludoGameBottomSheet.getParentFragmentManager(), "RechargeDialog");
ludoGameBottomSheet.dismissFragmentSafely();
}
}
public static final void onClicks$lambda$4$lambda$3(LudoGameBottomSheet ludoGameBottomSheet, View view) {
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
ludoGameBottomSheet.setCancelable(true);
if (ludoGameBottomSheet.currentSelectedButton == 0) {
FragmentExtKt.toast((Fragment) ludoGameBottomSheet, "Please select game mode");
return;
}
if (ludoGameBottomSheet.gameSelectionButton == 0) {
FragmentExtKt.toast((Fragment) ludoGameBottomSheet, "Please select game type");
return;
}
if (ludoGameBottomSheet.betAmount == 0) {
FragmentExtKt.toast((Fragment) ludoGameBottomSheet, "Bet amount required");
return;
}
ludoGameBottomSheet.currentStatus = GameRequestStatus.NO_STATUS;
ludoGameBottomSheet.getViewModel().initiateMatchmaking(ludoGameBottomSheet.betAmount, ludoGameBottomSheet.currentSelectedButton == 1 ? "ONE_VS_ONE" : "PLAYER_4", ludoGameBottomSheet.gameSelectionButton == 1 ? "QUICK" : "CLASSIC");
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
View view2 = ludoGameBottomSheetBinding.ludoGameMainParent.play;
Intrinsics.checkNotNullExpressionValue(view2, "binding.ludoGameMainParent.play");
ViewExtKt.showOrInvisible(view2, false);
}
public static final void onClicks$lambda$6$lambda$5(LudoGameBottomSheet ludoGameBottomSheet, View view) {
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
ludoGameBottomSheet.getViewModel().cancelMatch();
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = ludoGameBottomSheet.binding;
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = null;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
View view2 = ludoGameBottomSheetBinding.ludoGameMatchmakingParent.cancelBtn;
Intrinsics.checkNotNullExpressionValue(view2, "binding.ludoGameMatchmakingParent.cancelBtn");
ViewExtKt.showOrInvisible(view2, false);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding3 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
ludoGameBottomSheetBinding2 = ludoGameBottomSheetBinding3;
}
ProgressBar progressBar = ludoGameBottomSheetBinding2.ludoGameMatchmakingParent.spinProgress;
Intrinsics.checkNotNullExpressionValue(progressBar, "binding.ludoGameMatchmakingParent.spinProgress");
progressBar.setVisibility(0);
}
public static final void onClicks$lambda$7(LudoGameBottomSheet ludoGameBottomSheet, View view) {
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
if (ludoGameBottomSheet.currentStatus != GameRequestStatus.NO_STATUS && ludoGameBottomSheet.currentStatus != GameRequestStatus.CANCELLED) {
FragmentExtKt.toast((Fragment) ludoGameBottomSheet, "Please cancel matchmaking!");
} else {
ludoGameBottomSheet.dismissFragmentSafely();
}
}
public static final void onClicks$lambda$8(LudoGameBottomSheet ludoGameBottomSheet, View view) {
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
ludoGameBottomSheet.openRulesBottomSheet();
}
private final void handleSelectionButtonClicks() {
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = this.binding;
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = null;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
ludoGameBottomSheetBinding.ludoGameMainParent.firstBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoGameBottomSheet.handleSelectionButtonClicks$lambda$9(LudoGameBottomSheet.this, view);
}
});
LudoGameBottomSheetBinding ludoGameBottomSheetBinding3 = this.binding;
if (ludoGameBottomSheetBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding3 = null;
}
ludoGameBottomSheetBinding3.ludoGameMainParent.secondBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoGameBottomSheet.handleSelectionButtonClicks$lambda$10(LudoGameBottomSheet.this, view);
}
});
LudoGameBottomSheetBinding ludoGameBottomSheetBinding4 = this.binding;
if (ludoGameBottomSheetBinding4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding4 = null;
}
ludoGameBottomSheetBinding4.ludoGameMainParent.quickBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoGameBottomSheet.handleSelectionButtonClicks$lambda$11(LudoGameBottomSheet.this, view);
}
});
LudoGameBottomSheetBinding ludoGameBottomSheetBinding5 = this.binding;
if (ludoGameBottomSheetBinding5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
ludoGameBottomSheetBinding2 = ludoGameBottomSheetBinding5;
}
ludoGameBottomSheetBinding2.ludoGameMainParent.classicBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoGameBottomSheet.handleSelectionButtonClicks$lambda$12(LudoGameBottomSheet.this, view);
}
});
}
public static final void handleSelectionButtonClicks$lambda$9(LudoGameBottomSheet ludoGameBottomSheet, View view) {
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = ludoGameBottomSheet.binding;
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = null;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
ludoGameBottomSheetBinding.ludoGameMainParent.firstBtn.setStrokeColor(ContextCompat.getColor(ludoGameBottomSheet.requireContext(), 2131101157));
LudoGameBottomSheetBinding ludoGameBottomSheetBinding3 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding3 = null;
}
ludoGameBottomSheetBinding3.ludoGameMainParent.firstBtn.setStrokeWidth(12);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding4 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding4 = null;
}
ludoGameBottomSheetBinding4.ludoGameMainParent.secondBtn.setStrokeWidth(1);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding5 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding5 = null;
}
ImageView imageView = ludoGameBottomSheetBinding5.ludoGameMainParent.firstBtnCheck;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.ludoGameMainParent.firstBtnCheck");
imageView.setVisibility(0);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding6 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
ludoGameBottomSheetBinding2 = ludoGameBottomSheetBinding6;
}
ImageView imageView2 = ludoGameBottomSheetBinding2.ludoGameMainParent.secondBtnCheck;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.ludoGameMainParent.secondBtnCheck");
imageView2.setVisibility(8);
ludoGameBottomSheet.currentSelectedButton = 1;
ludoGameBottomSheet.calculateWinAmount();
}
public static final void handleSelectionButtonClicks$lambda$10(LudoGameBottomSheet ludoGameBottomSheet, View view) {
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = ludoGameBottomSheet.binding;
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = null;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
ludoGameBottomSheetBinding.ludoGameMainParent.secondBtn.setStrokeColor(ContextCompat.getColor(ludoGameBottomSheet.requireContext(), 2131101157));
LudoGameBottomSheetBinding ludoGameBottomSheetBinding3 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding3 = null;
}
ludoGameBottomSheetBinding3.ludoGameMainParent.secondBtn.setStrokeWidth(12);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding4 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding4 = null;
}
ludoGameBottomSheetBinding4.ludoGameMainParent.firstBtn.setStrokeWidth(1);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding5 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding5 = null;
}
ImageView imageView = ludoGameBottomSheetBinding5.ludoGameMainParent.firstBtnCheck;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.ludoGameMainParent.firstBtnCheck");
imageView.setVisibility(8);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding6 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
ludoGameBottomSheetBinding2 = ludoGameBottomSheetBinding6;
}
ImageView imageView2 = ludoGameBottomSheetBinding2.ludoGameMainParent.secondBtnCheck;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.ludoGameMainParent.secondBtnCheck");
imageView2.setVisibility(0);
ludoGameBottomSheet.currentSelectedButton = 2;
ludoGameBottomSheet.calculateWinAmount();
}
public static final void handleSelectionButtonClicks$lambda$11(LudoGameBottomSheet ludoGameBottomSheet, View view) {
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = ludoGameBottomSheet.binding;
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = null;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
ludoGameBottomSheetBinding.ludoGameMainParent.quickBtn.setStrokeColor(ContextCompat.getColor(ludoGameBottomSheet.requireContext(), 2131101157));
LudoGameBottomSheetBinding ludoGameBottomSheetBinding3 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding3 = null;
}
ludoGameBottomSheetBinding3.ludoGameMainParent.quickBtn.setStrokeWidth(12);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding4 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding4 = null;
}
ludoGameBottomSheetBinding4.ludoGameMainParent.classicBtn.setStrokeWidth(1);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding5 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding5 = null;
}
ImageView imageView = ludoGameBottomSheetBinding5.ludoGameMainParent.quickBtnCheck;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.ludoGameMainParent.quickBtnCheck");
imageView.setVisibility(0);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding6 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
ludoGameBottomSheetBinding2 = ludoGameBottomSheetBinding6;
}
ImageView imageView2 = ludoGameBottomSheetBinding2.ludoGameMainParent.classicBtnCheck;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.ludoGameMainParent.classicBtnCheck");
imageView2.setVisibility(8);
ludoGameBottomSheet.gameSelectionButton = 1;
}
public static final void handleSelectionButtonClicks$lambda$12(LudoGameBottomSheet ludoGameBottomSheet, View view) {
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = ludoGameBottomSheet.binding;
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = null;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
ludoGameBottomSheetBinding.ludoGameMainParent.classicBtn.setStrokeColor(ContextCompat.getColor(ludoGameBottomSheet.requireContext(), 2131101157));
LudoGameBottomSheetBinding ludoGameBottomSheetBinding3 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding3 = null;
}
ludoGameBottomSheetBinding3.ludoGameMainParent.classicBtn.setStrokeWidth(12);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding4 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding4 = null;
}
ludoGameBottomSheetBinding4.ludoGameMainParent.quickBtn.setStrokeWidth(1);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding5 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding5 = null;
}
ImageView imageView = ludoGameBottomSheetBinding5.ludoGameMainParent.quickBtnCheck;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.ludoGameMainParent.quickBtnCheck");
imageView.setVisibility(8);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding6 = ludoGameBottomSheet.binding;
if (ludoGameBottomSheetBinding6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
ludoGameBottomSheetBinding2 = ludoGameBottomSheetBinding6;
}
ImageView imageView2 = ludoGameBottomSheetBinding2.ludoGameMainParent.classicBtnCheck;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.ludoGameMainParent.classicBtnCheck");
imageView2.setVisibility(0);
ludoGameBottomSheet.gameSelectionButton = 2;
}
private final void setUpBetList(List<String> bets) {
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = this.binding;
if (ludoGameBottomSheetBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding = null;
}
ludoGameBottomSheetBinding.ludoGameMainParent.betAmountList.removeAllViews();
for (String str : bets) {
View inflate = getLayoutInflater().inflate(2131558774, (ViewGroup) null, false);
Intrinsics.checkNotNull(inflate, "null cannot be cast to non-null type com.google.android.material.chip.Chip");
final View view = (Chip) inflate;
view.setText(NumberExtKt.formatByNumberRupee$default((Number) Integer.valueOf(Integer.parseInt(str)), false, 1, (Object) null));
view.setId(str.hashCode());
view.setTypeface(Typeface.DEFAULT_BOLD);
int applyDimension = (int) TypedValue.applyDimension(1, 14.0f, getResources().getDisplayMetrics());
view.setPadding(applyDimension, 0, applyDimension, 0);
view.setClickable(true);
view.setBackgroundColor(ContextCompat.getColor(requireContext(), 2131101146));
view.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
LudoGameBottomSheet.setUpBetList$lambda$13(view, this, compoundButton, z);
}
});
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = this.binding;
if (ludoGameBottomSheetBinding2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding2 = null;
}
ludoGameBottomSheetBinding2.ludoGameMainParent.betAmountList.addView(view);
}
}
public static final void setUpBetList$lambda$13(Chip chip, LudoGameBottomSheet ludoGameBottomSheet, CompoundButton compoundButton, boolean z) {
Intrinsics.checkNotNullParameter(chip, "$mChip");
Intrinsics.checkNotNullParameter(ludoGameBottomSheet, "this$0");
if (z) {
chip.setChipBackgroundColorResource(2131099815);
chip.setTextColor(-1);
chip.setCloseIconTintResource(2131101146);
chip.setCloseIconVisible(false);
ludoGameBottomSheet.betAmount = Integer.parseInt(StringsKt.replace$default(StringsKt.trim(chip.getText().toString()).toString(), "₹", "", false, 4, (Object) null));
ludoGameBottomSheet.calculateWinAmount();
return;
}
chip.setTextColor(-16777216);
chip.setChipBackgroundColorResource(2131101146);
chip.setCloseIconVisible(false);
}
private final void calculateWinAmount() {
int i;
int i2;
double d;
int intValue;
int i3 = this.currentSelectedButton;
if (i3 == 0 || (i = this.betAmount) == 0) {
return;
}
if (i3 == 1) {
i2 = i * 2;
d = i2;
Integer num = this.ludoHouseCutInPercent;
if (num != null) {
intValue = num.intValue();
}
intValue = 0;
} else {
i2 = i * 4;
d = i2;
Integer num2 = this.ludoHouseCutInPercent;
if (num2 != null) {
intValue = num2.intValue();
}
intValue = 0;
}
this.winAmount = d - ((i2 * intValue) / 100.0d);
StringBuilder sb = new StringBuilder();
sb.append("Win amount: ");
LudoGameBottomSheetBinding ludoGameBottomSheetBinding = null;
sb.append(NumberExtKt.formatByNumberRupee$default(this.winAmount, false, 1, (Object) null));
String sb2 = sb.toString();
LudoGameBottomSheetBinding ludoGameBottomSheetBinding2 = this.binding;
if (ludoGameBottomSheetBinding2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
ludoGameBottomSheetBinding2 = null;
}
ludoGameBottomSheetBinding2.ludoGameMainParent.winAmountTv.setText(sb2);
LudoGameBottomSheetBinding ludoGameBottomSheetBinding3 = this.binding;
if (ludoGameBottomSheetBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
ludoGameBottomSheetBinding = ludoGameBottomSheetBinding3;
}
TextView textView = ludoGameBottomSheetBinding.ludoGameMainParent.winAmountTv;
Intrinsics.checkNotNullExpressionValue(textView, "binding.ludoGameMainParent.winAmountTv");
textView.setVisibility(0);
}
private final void dismissFragmentSafely() {
if (!isAdded() || isRemoving()) {
return;
}
try {
dismiss();
} catch (Exception e) {
Timber.e(e);
}
}
public void dismiss() {
if (this.currentStatus != GameRequestStatus.NO_STATUS && this.currentStatus != GameRequestStatus.CANCELLED) {
FragmentExtKt.toast((Fragment) this, "Please cancel matchmaking!");
} else {
super.dismiss();
}
}
public void onDestroy() {
super.onDestroy();
CoroutineScopeKt.cancel$default(this.scope, (CancellationException) null, 1, (Object) null);
}
public final void starServiceFunc() {
try {
LudoGameService ludoGameService = new LudoGameService();
this.ludoGameService = ludoGameService;
this.mServiceIntent = new Intent(requireContext(), ludoGameService.getClass());
if (!Utils.isMyServiceRunning(ludoGameService.getClass(), requireActivity())) {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.startService(this.mServiceIntent);
}
Timber.d("Service started successfully", new Object[0]);
return;
}
Timber.d("Service is already running", new Object[0]);
} catch (Exception e) {
Timber.e(e);
}
}
private final void updateServiceFunc(String gameRoomId, long gameId, String userId, String sessionToken) {
try {
LudoGameService ludoGameService = new LudoGameService();
this.ludoGameService = ludoGameService;
Intent intent = new Intent(requireContext(), ludoGameService.getClass());
this.mServiceIntent = intent;
intent.putExtra("gameId", gameId);
Intent intent2 = this.mServiceIntent;
if (intent2 != null) {
intent2.putExtra("gameRoomId", gameRoomId);
}
Intent intent3 = this.mServiceIntent;
if (intent3 != null) {
intent3.putExtra("userId", userId);
}
Intent intent4 = this.mServiceIntent;
if (intent4 != null) {
intent4.putExtra("sessionToken", sessionToken);
}
Intent intent5 = this.mServiceIntent;
if (intent5 != null) {
intent5.putExtra("showNotification", true);
}
FragmentActivity activity = getActivity();
if (activity != null) {
activity.startService(this.mServiceIntent);
}
Timber.d("Service started successfully", new Object[0]);
} catch (Exception e) {
Timber.e(e);
}
}
public final void stopServiceFunc() {
LudoGameService ludoGameService = this.ludoGameService;
if (ludoGameService != null) {
this.mServiceIntent = new Intent(requireActivity(), ludoGameService.getClass());
if (Utils.isMyServiceRunning(ludoGameService.getClass(), requireActivity())) {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.stopService(this.mServiceIntent);
}
Timber.d("Service stopped!!", new Object[0]);
return;
}
Timber.d("Service is already stopped!!", new Object[0]);
}
}
}