导航菜单

页面标题

页面副标题

Biko v2.0.23 - MyCallRateActivity.java 源代码

正在查看: Biko v2.0.23 应用的 MyCallRateActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package app.callpe.ui.misc;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.ComponentActivity;
import androidx.appcompat.app.ActionBar;
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.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import app.callpe.adapters.StreamerLevelUpdateAdapter;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.extensions.NumberExtKt;
import app.callpe.common.utils.extensions.ViewExtKt;
import app.callpe.common.utils.helper_functions.DialogHelper;
import app.callpe.data.model.LevelDetails;
import app.callpe.data.model.User;
import app.callpe.databinding.ActivityMyCallRateBinding;
import app.callpe.databinding.ChangeCallRatePopupBinding;
import app.callpe.databinding.ChangeLevelBottomSheetBinding;
import app.callpe.ui.home.AccountViewModel;
import app.callpe.ui.home.BaseActivity;
import app.callpe.ui.home.StreamerAccountFragment;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.card.MaterialCardView;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
import java.util.Iterator;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
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\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0001/B\u0005¢\u0006\u0002\u0010\u0003J(\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u00152\u0016\u0010\u0016\u001a\u0012\u0012\u0004\u0012\u00020\b0\u0007j\b\u0012\u0004\u0012\u00020\b`\tH\u0002J\u0010\u0010\u0017\u001a\u00020\u00022\u0006\u0010\u0018\u001a\u00020\u0019H\u0016J\b\u0010\u001a\u001a\u00020\u001bH\u0002J\b\u0010\u001c\u001a\u00020\u0013H\u0002J\b\u0010\u001d\u001a\u00020\u0013H\u0002J\u0012\u0010\u001e\u001a\u00020\u00132\b\u0010\u001f\u001a\u0004\u0018\u00010 H\u0014J\u0010\u0010!\u001a\u00020\"2\u0006\u0010#\u001a\u00020$H\u0016J \u0010%\u001a\u00020\u00132\u0016\u0010\u0006\u001a\u0012\u0012\u0004\u0012\u00020\b0\u0007j\b\u0012\u0004\u0012\u00020\b`\tH\u0002J(\u0010&\u001a\u00020\u00132\u0016\u0010'\u001a\u0012\u0012\u0004\u0012\u00020\b0\u0007j\b\u0012\u0004\u0012\u00020\b`\t2\u0006\u0010(\u001a\u00020)H\u0002J\u0010\u0010*\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0015H\u0002J \u0010+\u001a\u00020\u00132\u0016\u0010'\u001a\u0012\u0012\u0004\u0012\u00020\b0\u0007j\b\u0012\u0004\u0012\u00020\b`\tH\u0002J\u0010\u0010,\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0015H\u0002J\b\u0010-\u001a\u00020\u0013H\u0002J\b\u0010.\u001a\u00020\u0013H\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082.¢\u0006\u0002\n\u0000R\u001e\u0010\u0006\u001a\u0012\u0012\u0004\u0012\u00020\b0\u0007j\b\u0012\u0004\u0012\u00020\b`\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\f\u001a\u00020\r8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0010\u0010\u0011\u001a\u0004\b\u000e\u0010\u000f¨\u00060"}, d2 = {"Lapp/callpe/ui/misc/MyCallRateActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityMyCallRateBinding;", "()V", "alertDialog", "Landroid/app/Dialog;", "levelList", "Ljava/util/ArrayList;", "Lapp/callpe/data/model/LevelDetails;", "Lkotlin/collections/ArrayList;", "tabType", "Lapp/callpe/ui/misc/MyCallRateActivity$LEVEL_TAB;", "viewModel", "Lapp/callpe/ui/home/AccountViewModel;", "getViewModel", "()Lapp/callpe/ui/home/AccountViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "filterLevelList", "", "user", "Lapp/callpe/data/model/User;", "levels", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "observeEvent", "Lkotlinx/coroutines/Job;", "onChipClick", "onClick", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onOptionsItemSelected", "", "item", "Landroid/view/MenuItem;", "openBottomSheet", "setBaseRateDetails", "levelData", "metadata", "Lapp/callpe/data/model/Metadata;", "setLevel", "setLevelDetails", "setProfileValues", "setUpToolbar", "updateCallRateDialog", "LEVEL_TAB", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class MyCallRateActivity extends BaseActivity<ActivityMyCallRateBinding> {
    private Dialog alertDialog;

    private final Lazy viewModel;
    private LEVEL_TAB tabType = LEVEL_TAB.BASE_RATE;
    private final ArrayList<LevelDetails> levelList = new ArrayList<>();

    @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/misc/MyCallRateActivity$LEVEL_TAB;", "", "(Ljava/lang/String;I)V", "LEVEL", "BASE_RATE", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public enum LEVEL_TAB {
        LEVEL,
        BASE_RATE
    }

    public static final void updateCallRateDialog$lambda$7$lambda$6() {
    }

    public MyCallRateActivity() {
        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 m1947invoke() {
                return componentActivity.getViewModelStore();
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            public final ViewModelProvider.Factory m1946invoke() {
                return componentActivity.getDefaultViewModelProviderFactory();
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m1948invoke() {
                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);
        setWindowFlag((Activity) this, 67108864, false);
        getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100053));
        setContentView(((ActivityMyCallRateBinding) getBinding()).getRoot());
        setUpToolbar();
        observeEvent();
        AccountViewModel.getUserDetails$default(getViewModel(), false, false, 3, null);
        onClick();
        onChipClick();
    }

    private final void setUpToolbar() {
        try {
            setSupportActionBar(getBinding().toolbar);
            ActionBar supportActionBar = getSupportActionBar();
            if (supportActionBar != null) {
                supportActionBar.setDisplayHomeAsUpEnabled(true);
            }
        } catch (Exception e) {
            Timber.e(e, "setUpToolbar: Error ", new Object[0]);
        }
    }

    private final void onClick() {
        getBinding().changeCallRateBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MyCallRateActivity.onClick$lambda$0(MyCallRateActivity.this, view);
            }
        });
        getBinding().changeLevelRateBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MyCallRateActivity.onClick$lambda$1(MyCallRateActivity.this, view);
            }
        });
    }

    public static final void onClick$lambda$0(MyCallRateActivity myCallRateActivity, View view) {
        Intrinsics.checkNotNullParameter(myCallRateActivity, "this$0");
        myCallRateActivity.openBottomSheet(myCallRateActivity.levelList);
    }

    public static final void onClick$lambda$1(MyCallRateActivity myCallRateActivity, View view) {
        Intrinsics.checkNotNullParameter(myCallRateActivity, "this$0");
        myCallRateActivity.openBottomSheet(myCallRateActivity.levelList);
    }

    private final void onChipClick() {
        getBinding().chipLevels.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MyCallRateActivity.onChipClick$lambda$2(MyCallRateActivity.this, view);
            }
        });
        getBinding().chipBaseRate.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MyCallRateActivity.onChipClick$lambda$3(MyCallRateActivity.this, view);
            }
        });
    }

    public static final void onChipClick$lambda$2(MyCallRateActivity myCallRateActivity, View view) {
        Intrinsics.checkNotNullParameter(myCallRateActivity, "this$0");
        if (myCallRateActivity.tabType == LEVEL_TAB.LEVEL) {
            return;
        }
        myCallRateActivity.tabType = LEVEL_TAB.LEVEL;
        myCallRateActivity.getBinding().chipLevels.setChecked(true);
        AccountViewModel.getUserDetails$default(myCallRateActivity.getViewModel(), false, false, 3, null);
    }

    public static final void onChipClick$lambda$3(MyCallRateActivity myCallRateActivity, View view) {
        Intrinsics.checkNotNullParameter(myCallRateActivity, "this$0");
        if (myCallRateActivity.tabType == LEVEL_TAB.BASE_RATE) {
            return;
        }
        myCallRateActivity.tabType = LEVEL_TAB.BASE_RATE;
        myCallRateActivity.getBinding().chipBaseRate.setChecked(true);
        AccountViewModel.getUserDetails$default(myCallRateActivity.getViewModel(), false, false, 3, null);
    }

    private final Job observeEvent() {
        return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new MyCallRateActivity$observeEvent$1(this, null), 3, (Object) null);
    }

    public final void setLevel(User user) {
        LevelDetails levelDetails = user.getLevelDetails();
        getBinding().userLevel.setText(levelDetails != null ? levelDetails.getName() : null);
    }

    public final void setProfileValues(User user) {
        getBinding().userCallRate.setText(NumberExtKt.formatByNumberDecimalAndRemoveTrailingZeros(user.getRate() * BaseActivity.INSTANCE.getRupeeToBean()) + '/' + getString(2131951652));
    }

    public final void setLevelDetails(ArrayList<LevelDetails> levelData) {
        LinearLayout linearLayout = ((ActivityMyCallRateBinding) getBinding()).levelHeaderParent;
        Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.levelHeaderParent");
        linearLayout.setVisibility(0);
        LinearLayout linearLayout2 = ((ActivityMyCallRateBinding) getBinding()).baseRateHeaderParent;
        Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.baseRateHeaderParent");
        linearLayout2.setVisibility(8);
        TableLayout tableLayout = ((ActivityMyCallRateBinding) getBinding()).tableLayout;
        Intrinsics.checkNotNullExpressionValue(tableLayout, "binding.tableLayout");
        LayoutInflater from = LayoutInflater.from((Context) this);
        tableLayout.removeAllViews();
        Iterator<LevelDetails> it = levelData.iterator();
        while (it.hasNext()) {
            LevelDetails next = it.next();
            View inflate = from.inflate(2131559088, (ViewGroup) tableLayout, false);
            Intrinsics.checkNotNull(inflate, "null cannot be cast to non-null type android.widget.TableLayout");
            TableLayout tableLayout2 = (TableLayout) inflate;
            TextView textView = (TextView) tableLayout2.findViewById(2131363432);
            TextView textView2 = (TextView) tableLayout2.findViewById(2131363435);
            String str = NumberExtKt.formatByNumberDecimalAndRemoveTrailingZeros(next.getStreamerRate() * BaseActivity.INSTANCE.getRupeeToBean()) + '/' + getString(2131951652);
            textView.setText(next.getName());
            textView2.setText(str);
            tableLayout.addView(tableLayout2);
        }
    }

    public final void setBaseRateDetails(ArrayList<LevelDetails> levelData, app.callpe.data.model.Metadata metadata) {
        TableLayout tableLayout;
        TextView textView;
        TextView textView2;
        float f;
        boolean z;
        TextView textView3;
        Object obj = this;
        LinearLayout linearLayout = getBinding().levelHeaderParent;
        Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.levelHeaderParent");
        linearLayout.setVisibility(8);
        LinearLayout linearLayout2 = getBinding().baseRateHeaderParent;
        Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.baseRateHeaderParent");
        boolean z2 = false;
        linearLayout2.setVisibility(0);
        TableLayout tableLayout2 = getBinding().tableLayout;
        Intrinsics.checkNotNullExpressionValue(tableLayout2, "binding.tableLayout");
        Context context = (Context) obj;
        LayoutInflater from = LayoutInflater.from(context);
        tableLayout2.removeAllViews();
        Float conversionRate = metadata.getUser().getConversionRate();
        float floatValue = conversionRate != null ? conversionRate.floatValue() : 0.0f;
        final float conversionCallRateBuffer = floatValue + metadata.getConversionCallRateBuffer();
        final float conversionForAllUnlock = metadata.getConversionForAllUnlock();
        Iterator<LevelDetails> it = levelData.iterator();
        while (it.hasNext()) {
            LevelDetails next = it.next();
            View inflate = from.inflate(2131559089, tableLayout2, z2);
            Intrinsics.checkNotNull(inflate, "null cannot be cast to non-null type android.widget.TableLayout");
            TableLayout tableLayout3 = (TableLayout) inflate;
            TextView textView4 = (TextView) tableLayout3.findViewById(2131365451);
            TextView textView5 = (TextView) tableLayout3.findViewById(2131363432);
            TextView textView6 = (TextView) tableLayout3.findViewById(2131363435);
            ImageView imageView = (ImageView) tableLayout3.findViewById(2131363160);
            MaterialCardView findViewById = tableLayout3.findViewById(2131362314);
            TableLayout tableLayout4 = tableLayout2;
            final double streamerRate = next.getStreamerRate();
            LayoutInflater layoutInflater = from;
            Timber.i("conversionCallRateBuffer " + conversionCallRateBuffer + " ----conversionForAllUnlock " + conversionForAllUnlock + " ---- callRate " + streamerRate + ' ', new Object[0]);
            if (conversionForAllUnlock > floatValue && streamerRate > ((double) conversionCallRateBuffer)) {
                ColorStateList valueOf = ColorStateList.valueOf(ContextCompat.getColor(context, 2131100956));
                Intrinsics.checkNotNullExpressionValue(valueOf, "valueOf(\n               …      )\n                )");
                imageView.setImageTintList(valueOf);
                textView6.setTextColor(ContextCompat.getColor(context, 2131100040));
                textView4.setTextColor(ContextCompat.getColor(context, 2131100040));
                findViewById.setCardBackgroundColor(ContextCompat.getColor(context, 2131100839));
                textView5.setTextColor(ContextCompat.getColor(context, 2131101148));
                final float f2 = floatValue;
                textView = textView6;
                textView2 = textView4;
                tableLayout = tableLayout3;
                f = floatValue;
                z = false;
                textView3 = textView5;
                tableLayout.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        MyCallRateActivity.setBaseRateDetails$lambda$4(MyCallRateActivity.this, f2, streamerRate, conversionCallRateBuffer, conversionForAllUnlock, view);
                    }
                });
            } else {
                tableLayout = tableLayout3;
                textView = textView6;
                textView2 = textView4;
                f = floatValue;
                z = false;
                textView3 = textView5;
                ColorStateList valueOf2 = ColorStateList.valueOf(ContextCompat.getColor(context, 2131100019));
                Intrinsics.checkNotNullExpressionValue(valueOf2, "valueOf(\n               …      )\n                )");
                imageView.setImageTintList(valueOf2);
                imageView.setImageResource(2131231741);
            }
            String str = NumberExtKt.formatByNumberDecimalAndRemoveTrailingZeros(next.getStreamerRate() * BaseActivity.INSTANCE.getRupeeToBean()) + '/' + getString(2131951652);
            textView3.setText(next.getName());
            textView2.setText(String.valueOf(next.getWeeklyEarning()));
            textView.setText(str);
            tableLayout4.addView(tableLayout);
            tableLayout2 = tableLayout4;
            obj = this;
            from = layoutInflater;
            floatValue = f;
            z2 = z;
        }
    }

    public static final void setBaseRateDetails$lambda$4(MyCallRateActivity myCallRateActivity, float f, double d, float f2, float f3, View view) {
        Intrinsics.checkNotNullParameter(myCallRateActivity, "this$0");
        ActivityExtKt.toast((Activity) myCallRateActivity, "You should have minimum conversion of " + NumberExtKt.formatByNumber1Decimal(Math.min(f + (((float) d) - f2), f3)) + " to unlock.");
    }

    private final void updateCallRateDialog() {
        LevelDetails levelDetails;
        this.alertDialog = new Dialog((Context) this);
        final ChangeCallRatePopupBinding inflate = ChangeCallRatePopupBinding.inflate(getLayoutInflater());
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        Dialog dialog = this.alertDialog;
        Dialog dialog2 = null;
        if (dialog == null) {
            Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
            dialog = null;
        }
        dialog.setContentView(inflate.getRoot());
        Dialog dialog3 = this.alertDialog;
        if (dialog3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
            dialog3 = null;
        }
        Window window = dialog3.getWindow();
        if (window != null) {
            window.setLayout(-1, -2);
        }
        Dialog dialog4 = this.alertDialog;
        if (dialog4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
            dialog4 = null;
        }
        dialog4.setCancelable(false);
        StringBuilder sb = new StringBuilder();
        User user = getViewModel().getUser();
        sb.append((user == null || (levelDetails = user.getLevelDetails()) == null) ? null : NumberExtKt.formatByNumberRupee$default(levelDetails.getStreamerRate(), false, 1, (Object) null));
        sb.append('/');
        sb.append(getString(2131951652));
        inflate.callRate.setText(sb.toString());
        inflate.closeBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MyCallRateActivity.updateCallRateDialog$lambda$5(MyCallRateActivity.this, view);
            }
        });
        inflate.submitBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MyCallRateActivity.updateCallRateDialog$lambda$7(ChangeCallRatePopupBinding.this, this, view);
            }
        });
        Dialog dialog5 = this.alertDialog;
        if (dialog5 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
            dialog5 = null;
        }
        Window window2 = dialog5.getWindow();
        if (window2 != null) {
            window2.clearFlags(131080);
        }
        Dialog dialog6 = this.alertDialog;
        if (dialog6 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
            dialog6 = null;
        }
        Window window3 = dialog6.getWindow();
        if (window3 != null) {
            window3.setSoftInputMode(4);
        }
        inflate.newCharges.requestFocus();
        View view = inflate.newCharges;
        Intrinsics.checkNotNullExpressionValue(view, "binding.newCharges");
        ViewExtKt.showSoftKeyboard(view);
        Dialog dialog7 = this.alertDialog;
        if (dialog7 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
        } else {
            dialog2 = dialog7;
        }
        dialog2.show();
    }

    public static final void updateCallRateDialog$lambda$5(MyCallRateActivity myCallRateActivity, View view) {
        Intrinsics.checkNotNullParameter(myCallRateActivity, "this$0");
        Dialog dialog = myCallRateActivity.alertDialog;
        if (dialog == null) {
            Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
            dialog = null;
        }
        dialog.dismiss();
    }

    public static final void updateCallRateDialog$lambda$7(ChangeCallRatePopupBinding changeCallRatePopupBinding, MyCallRateActivity myCallRateActivity, View view) {
        Intrinsics.checkNotNullParameter(changeCallRatePopupBinding, "$binding");
        Intrinsics.checkNotNullParameter(myCallRateActivity, "this$0");
        try {
            String valueOf = String.valueOf(changeCallRatePopupBinding.newCharges.getText());
            if (valueOf.length() == 0) {
                String string = myCallRateActivity.getString(2131951767);
                Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.call_rate_required)");
                ActivityExtKt.toast((Activity) myCallRateActivity, string);
            } else {
                if (Integer.parseInt(valueOf) < 5) {
                    DialogHelper.showReasonDialog((Context) myCallRateActivity, "", myCallRateActivity.getString(2131951766), new DialogHelper.ConfirmationListener() {
                        @Override
                        public final void onPositiveClick() {
                            MyCallRateActivity.updateCallRateDialog$lambda$7$lambda$6();
                        }
                    });
                    return;
                }
                myCallRateActivity.getViewModel().updateRate(valueOf);
                StreamerAccountFragment.INSTANCE.setRefreshScreen(true);
                Dialog dialog = myCallRateActivity.alertDialog;
                if (dialog == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
                    dialog = null;
                }
                dialog.dismiss();
            }
        } catch (Exception unused) {
            Toast.makeText((Context) myCallRateActivity, "invalid input", 0).show();
        }
    }

    private final void openBottomSheet(ArrayList<LevelDetails> levelList) {
        if (levelList.isEmpty()) {
            return;
        }
        ChangeLevelBottomSheetBinding inflate = ChangeLevelBottomSheetBinding.inflate(getLayoutInflater());
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        RecyclerView recyclerView = inflate.rv;
        Intrinsics.checkNotNullExpressionValue(recyclerView, "bottomSheetView.rv");
        Context context = (Context) this;
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
        BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(context, 2132017165);
        bottomSheetDialog.setContentView(inflate.getRoot());
        recyclerView.setAdapter(new StreamerLevelUpdateAdapter(levelList, new MyCallRateActivity$openBottomSheet$adapter$1(this, "Are you sure you want to change your call rate?", bottomSheetDialog)));
        bottomSheetDialog.show();
    }

    public final void filterLevelList(User user, ArrayList<LevelDetails> levels) {
        Object obj;
        ArrayList<LevelDetails> arrayList = levels;
        Iterator<T> it = arrayList.iterator();
        while (true) {
            if (!it.hasNext()) {
                obj = null;
                break;
            }
            obj = it.next();
            long id = ((LevelDetails) obj).getId();
            Long maxLevelId = user.getMaxLevelId();
            if (maxLevelId != null && id == maxLevelId.longValue()) {
                break;
            }
        }
        LevelDetails levelDetails = (LevelDetails) obj;
        for (LevelDetails levelDetails2 : arrayList) {
            Long levelId = user.getLevelId();
            long id2 = levelDetails2.getId();
            if (levelId != null && levelId.longValue() == id2) {
                levelDetails2.setCurrent(true);
            }
        }
        if (levelDetails != null) {
            ArrayList arrayList2 = new ArrayList();
            for (Object obj2 : arrayList) {
                if (levelDetails.getStreamerRate() >= ((LevelDetails) obj2).getStreamerRate()) {
                    arrayList2.add(obj2);
                }
            }
            this.levelList.clear();
            this.levelList.addAll(arrayList2);
        }
        View view = getBinding().changeCallRateBtn;
        Intrinsics.checkNotNullExpressionValue(view, "binding.changeCallRateBtn");
        view.setVisibility(this.levelList.isEmpty() ^ true ? 0 : 8);
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        Intrinsics.checkNotNullParameter(item, "item");
        if (item.getItemId() != 16908332) {
            return true;
        }
        finish();
        return true;
    }

    @Override
    public ActivityMyCallRateBinding inflateLayout(LayoutInflater layoutInflater) {
        Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
        ActivityMyCallRateBinding inflate = ActivityMyCallRateBinding.inflate(layoutInflater);
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        return inflate;
    }
}