导航菜单

页面标题

页面副标题

Housing v14.7.8 - MainActivity.java 源代码

正在查看: Housing v14.7.8 应用的 MainActivity.java JAVA 源代码文件

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


package com.chuckerteam.chucker.internal.ui;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.SearchView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.b0;
import androidx.lifecycle.w0;
import androidx.lifecycle.x0;
import androidx.lifecycle.y0;
import androidx.lifecycle.z0;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.t;
import com.cashfree.pg.core.api.utils.AnalyticsUtil;
import com.chuckerteam.chucker.internal.support.a0;
import com.chuckerteam.chucker.internal.support.y;
import com.chuckerteam.chucker.internal.ui.MainActivity;
import com.chuckerteam.chucker.internal.ui.transaction.TransactionActivity;
import com.google.android.gms.actions.SearchIntents;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.snackbar.Snackbar;
import com.newrelic.agent.android.api.v2.TraceFieldInterface;
import java.util.List;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.enums.EnumEntries;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.jvm.internal.n0;
import kotlin.jvm.internal.r;
import kotlin.jvm.internal.s;
import kotlinx.coroutines.l0;
import org.jetbrains.annotations.NotNull;
import zp.j0;
import zp.q;

@Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0002\b\b\b\u0000\u0018\u0000 \u00172\u00020\u00012\u00020\u0002:\u0002\u0018\u0019B\u0007¢\u0006\u0004\b\u0003\u0010\u0004R\u001b\u0010\n\u001a\u00020\u00058BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0006\u0010\u0007\u001a\u0004\b\b\u0010\tR\u0016\u0010\f\u001a\u00020\u000b8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\f\u0010\rR\u0016\u0010\u000f\u001a\u00020\u000e8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u000f\u0010\u0010R\u001a\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00120\u00118\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0013\u0010\u0014R\u001a\u0010\u0015\u001a\b\u0012\u0004\u0012\u00020\u00120\u00118\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0015\u0010\u0014R\u001a\u0010\u0016\u001a\b\u0012\u0004\u0012\u00020\u00120\u00118\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0016\u0010\u0014¨\u0006\u001a"}, d2 = {"Lcom/chuckerteam/chucker/internal/ui/MainActivity;", "Lcom/chuckerteam/chucker/internal/ui/a;", "Landroidx/appcompat/widget/SearchView$m;", "<init>", "()V", "Lcom/chuckerteam/chucker/internal/ui/n;", "viewModel$delegate", "Lkotlin/Lazy;", "t", "()Lcom/chuckerteam/chucker/internal/ui/n;", "viewModel", "Lj5/a;", "mainBinding", "Lj5/a;", "Lcom/chuckerteam/chucker/internal/ui/transaction/j;", "transactionsAdapter", "Lcom/chuckerteam/chucker/internal/ui/transaction/j;", "Landroidx/activity/result/c;", "", "permissionRequest", "Landroidx/activity/result/c;", "saveTextToFile", "saveHarToFile", "Companion", "b", "a", "com.github.ChuckerTeam.Chucker.library"}, k = 1, mv = {2, 0, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nMainActivity.kt\nKotlin\n*S Kotlin\n*F\n+ 1 MainActivity.kt\ncom/chuckerteam/chucker/internal/ui/MainActivity\n+ 2 ActivityViewModelLazy.kt\nandroidx/activity/ActivityViewModelLazyKt\n+ 3 View.kt\nandroidx/core/view/ViewKt\n*L\n1#1,376:1\n75#2,13:377\n256#3,2:390\n*S KotlinDebug\n*F\n+ 1 MainActivity.kt\ncom/chuckerteam/chucker/internal/ui/MainActivity\n*L\n52#1:377,13\n114#1:390,2\n*E\n"})
public final class MainActivity extends a implements SearchView.m {

    @NotNull
    public static final Companion INSTANCE = new Companion(null);

    @NotNull
    private static final String EXPORT_HAR_FILE_NAME = "transactions.har";

    @NotNull
    private static final String EXPORT_TXT_FILE_NAME = "transactions.txt";
    private j5.a mainBinding;

    @NotNull
    private final androidx.activity.result.c<String> permissionRequest;

    @NotNull
    private final androidx.activity.result.c<String> saveHarToFile;

    @NotNull
    private final androidx.activity.result.c<String> saveTextToFile;
    private com.chuckerteam.chucker.internal.ui.transaction.j transactionsAdapter;

    @NotNull
    private final Lazy viewModel = new x0(n0.b(n.class), new f(this), new e(this), new g(null, this));

    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\b\u0086\u0003\u0018\u00002\u00020\u0001R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004R\u0014\u0010\u0005\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0005\u0010\u0004¨\u0006\u0006"}, d2 = {"Lcom/chuckerteam/chucker/internal/ui/MainActivity$a;", "", "", "EXPORT_TXT_FILE_NAME", "Ljava/lang/String;", "EXPORT_HAR_FILE_NAME", "com.github.ChuckerTeam.Chucker.library"}, k = 1, mv = {2, 0, 0}, xi = 48)
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
        }
    }

    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\u0010\u000e\n\u0002\b\u0007\b\u0082\u0081\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001R\u0017\u0010\u0003\u001a\u00020\u00028\u0006¢\u0006\f\n\u0004\b\u0003\u0010\u0004\u001a\u0004\b\u0005\u0010\u0006j\u0002\b\u0007j\u0002\b\b¨\u0006\t"}, d2 = {"Lcom/chuckerteam/chucker/internal/ui/MainActivity$b;", "", "", "mimeType", "Ljava/lang/String;", "getMimeType", "()Ljava/lang/String;", "TEXT", "HAR", "com.github.ChuckerTeam.Chucker.library"}, k = 1, mv = {2, 0, 0}, xi = 48)
    public static final class b {
        private static final EnumEntries $ENTRIES;
        private static final b[] $VALUES;
        public static final b HAR;
        public static final b TEXT;

        @NotNull
        private final String mimeType;

        static {
            b bVar = new b("TEXT", 0, "text/plain");
            TEXT = bVar;
            b bVar2 = new b("HAR", 1, "application/har+json");
            HAR = bVar2;
            b[] bVarArr = {bVar, bVar2};
            $VALUES = bVarArr;
            $ENTRIES = fq.a.a(bVarArr);
        }

        public b(String str, int i, String str2) {
            this.mimeType = str2;
        }

        @NotNull
        public static EnumEntries<b> getEntries() {
            return $ENTRIES;
        }

        public static b valueOf(String str) {
            return (b) Enum.valueOf(b.class, str);
        }

        public static b[] values() {
            return (b[]) $VALUES.clone();
        }

        @NotNull
        public final String getMimeType() {
            return this.mimeType;
        }
    }

    @Metadata(k = 3, mv = {2, 0, 0}, xi = 48)
    public class c {
        public static final int[] $EnumSwitchMapping$0;

        static {
            int[] iArr = new int[b.values().length];
            try {
                iArr[b.TEXT.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[b.HAR.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            $EnumSwitchMapping$0 = iArr;
        }
    }

    @Metadata(k = 3, mv = {2, 0, 0}, xi = 48)
    public static final class d implements b0, kotlin.jvm.internal.m {
        private final kq.l function;

        public d(com.chuckerteam.chucker.internal.ui.b bVar) {
            this.function = bVar;
        }

        public final void a(Object obj) {
            this.function.invoke(obj);
        }

        public final zp.h b() {
            return this.function;
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof b0) && (obj instanceof kotlin.jvm.internal.m)) {
                return r.f(b(), ((kotlin.jvm.internal.m) obj).b());
            }
            return false;
        }

        public final int hashCode() {
            return b().hashCode();
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0005\u001a\u00020\u0002\"\n\b\u0000\u0010\u0001\u0018\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Landroidx/lifecycle/v0;", "VM", "Landroidx/lifecycle/y0$c;", "invoke", "()Landroidx/lifecycle/y0$c;", "<anonymous>"}, k = 3, mv = {2, 0, 0})
    public static final class e extends s implements kq.a<y0.c> {
        final androidx.activity.h $this_viewModels;

        public e(androidx.activity.h hVar) {
            super(0);
            this.$this_viewModels = hVar;
        }

        @NotNull
        public final y0.c m10invoke() {
            return this.$this_viewModels.getDefaultViewModelProviderFactory();
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0005\u001a\u00020\u0002\"\n\b\u0000\u0010\u0001\u0018\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Landroidx/lifecycle/v0;", "VM", "Landroidx/lifecycle/z0;", "invoke", "()Landroidx/lifecycle/z0;", "<anonymous>"}, k = 3, mv = {2, 0, 0})
    public static final class f extends s implements kq.a<z0> {
        final androidx.activity.h $this_viewModels;

        public f(androidx.activity.h hVar) {
            super(0);
            this.$this_viewModels = hVar;
        }

        @NotNull
        public final z0 m11invoke() {
            return this.$this_viewModels.getViewModelStore();
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0005\u001a\u00020\u0002\"\n\b\u0000\u0010\u0001\u0018\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Landroidx/lifecycle/v0;", "VM", "Ln2/a;", "invoke", "()Ln2/a;", "<anonymous>"}, k = 3, mv = {2, 0, 0})
    public static final class g extends s implements kq.a<n2.a> {
        final kq.a $extrasProducer;
        final androidx.activity.h $this_viewModels;

        public g(kq.a aVar, androidx.activity.h hVar) {
            super(0);
            this.$extrasProducer = aVar;
            this.$this_viewModels = hVar;
        }

        @NotNull
        public final n2.a invoke() {
            n2.a aVar;
            kq.a aVar2 = this.$extrasProducer;
            return (aVar2 == null || (aVar = (n2.a) aVar2.invoke()) == null) ? this.$this_viewModels.getDefaultViewModelCreationExtras() : aVar;
        }
    }

    public MainActivity() {
        final int i = 2;
        this.permissionRequest = registerForActivityResult(new d.g(), new androidx.activity.result.b(this) {
            public final MainActivity b;

            {
                this.b = this;
            }

            public final void b(Object obj) {
                ?? r0 = this.b;
                switch (i) {
                    case 0:
                        MainActivity.Companion companion = MainActivity.INSTANCE;
                        r0.u((Uri) obj, MainActivity.b.TEXT);
                        break;
                    case 1:
                        MainActivity.Companion companion2 = MainActivity.INSTANCE;
                        r0.u((Uri) obj, MainActivity.b.HAR);
                        break;
                    default:
                        boolean booleanValue = ((Boolean) obj).booleanValue();
                        MainActivity.Companion companion3 = MainActivity.INSTANCE;
                        if (!booleanValue) {
                            String string = r0.getApplicationContext().getString(i5.h.chucker_notifications_permission_not_granted);
                            r.j(string, "getString(...)");
                            Toast.makeText(r0.getApplicationContext(), string, 1).show();
                            y.INSTANCE.error("Notification permission denied. Can't show transactions info", null);
                            break;
                        }
                        break;
                }
            }
        });
        final int i2 = 0;
        this.saveTextToFile = registerForActivityResult(new d.b(b.TEXT.getMimeType()), new androidx.activity.result.b(this) {
            public final MainActivity b;

            {
                this.b = this;
            }

            public final void b(Object obj) {
                ?? r0 = this.b;
                switch (i2) {
                    case 0:
                        MainActivity.Companion companion = MainActivity.INSTANCE;
                        r0.u((Uri) obj, MainActivity.b.TEXT);
                        break;
                    case 1:
                        MainActivity.Companion companion2 = MainActivity.INSTANCE;
                        r0.u((Uri) obj, MainActivity.b.HAR);
                        break;
                    default:
                        boolean booleanValue = ((Boolean) obj).booleanValue();
                        MainActivity.Companion companion3 = MainActivity.INSTANCE;
                        if (!booleanValue) {
                            String string = r0.getApplicationContext().getString(i5.h.chucker_notifications_permission_not_granted);
                            r.j(string, "getString(...)");
                            Toast.makeText(r0.getApplicationContext(), string, 1).show();
                            y.INSTANCE.error("Notification permission denied. Can't show transactions info", null);
                            break;
                        }
                        break;
                }
            }
        });
        final int i3 = 1;
        this.saveHarToFile = registerForActivityResult(new d.b(b.HAR.getMimeType()), new androidx.activity.result.b(this) {
            public final MainActivity b;

            {
                this.b = this;
            }

            public final void b(Object obj) {
                ?? r0 = this.b;
                switch (i3) {
                    case 0:
                        MainActivity.Companion companion = MainActivity.INSTANCE;
                        r0.u((Uri) obj, MainActivity.b.TEXT);
                        break;
                    case 1:
                        MainActivity.Companion companion2 = MainActivity.INSTANCE;
                        r0.u((Uri) obj, MainActivity.b.HAR);
                        break;
                    default:
                        boolean booleanValue = ((Boolean) obj).booleanValue();
                        MainActivity.Companion companion3 = MainActivity.INSTANCE;
                        if (!booleanValue) {
                            String string = r0.getApplicationContext().getString(i5.h.chucker_notifications_permission_not_granted);
                            r.j(string, "getString(...)");
                            Toast.makeText(r0.getApplicationContext(), string, 1).show();
                            y.INSTANCE.error("Notification permission denied. Can't show transactions info", null);
                            break;
                        }
                        break;
                }
            }
        });
    }

    public static j0 p(MainActivity mainActivity, List list) {
        com.chuckerteam.chucker.internal.ui.transaction.j jVar = mainActivity.transactionsAdapter;
        if (jVar == null) {
            r.o("transactionsAdapter");
            throw null;
        }
        jVar.z(list);
        j5.a aVar = mainActivity.mainBinding;
        if (aVar == null) {
            r.o("mainBinding");
            throw null;
        }
        Group group = aVar.tutorialGroup;
        r.j(group, "tutorialGroup");
        group.setVisibility(list.isEmpty() ? 0 : 8);
        return j0.INSTANCE;
    }

    public static j0 q(b bVar, MainActivity mainActivity) {
        int i = c.$EnumSwitchMapping$0[bVar.ordinal()];
        if (i == 1) {
            mainActivity.saveTextToFile.b(EXPORT_TXT_FILE_NAME);
        } else {
            if (i != 2) {
                throw new q();
            }
            mainActivity.saveHarToFile.b(EXPORT_HAR_FILE_NAME);
        }
        return j0.INSTANCE;
    }

    public static final java.lang.Object r(com.chuckerteam.chucker.internal.ui.MainActivity r6, com.chuckerteam.chucker.internal.ui.MainActivity.b r7, eq.d r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.chuckerteam.chucker.internal.ui.MainActivity.r(com.chuckerteam.chucker.internal.ui.MainActivity, com.chuckerteam.chucker.internal.ui.MainActivity$b, eq.d):java.lang.Object");
    }

    @Override
    public final void onCreate(Bundle bundle) {
        MaterialToolbar a;
        RecyclerView a2;
        Group a3;
        super.onCreate(bundle);
        ConstraintLayout inflate = getLayoutInflater().inflate(i5.e.chucker_activity_main, (ViewGroup) null, false);
        int i = i5.d.appBarLayout;
        AppBarLayout a4 = d4.a.a(i, inflate);
        if (a4 != null && (a = d4.a.a((i = i5.d.toolbar), inflate)) != null && (a2 = d4.a.a((i = i5.d.transactionsRecyclerView), inflate)) != null) {
            i = i5.d.tutorialDescription;
            TextView textView = (TextView) d4.a.a(i, inflate);
            if (textView != null && (a3 = d4.a.a((i = i5.d.tutorialGroup), inflate)) != null) {
                i = i5.d.tutorialLink;
                TextView textView2 = (TextView) d4.a.a(i, inflate);
                if (textView2 != null) {
                    i = i5.d.tutorialTitle;
                    TextView textView3 = (TextView) d4.a.a(i, inflate);
                    if (textView3 != null) {
                        this.mainBinding = new j5.a(inflate, a4, a, a2, textView, a3, textView2, textView3);
                        final int i2 = 0;
                        this.transactionsAdapter = new com.chuckerteam.chucker.internal.ui.transaction.j(this, new kq.l(this) {
                            public final MainActivity b;

                            {
                                this.b = this;
                            }

                            public final Object invoke(Object obj) {
                                ?? r0 = this.b;
                                switch (i2) {
                                    case 0:
                                        long longValue = ((Long) obj).longValue();
                                        MainActivity.Companion companion = MainActivity.INSTANCE;
                                        TransactionActivity.Companion.getClass();
                                        r.k((Object) r0, "context");
                                        Intent intent = new Intent((Context) r0, (Class<?>) TransactionActivity.class);
                                        intent.putExtra(AnalyticsUtil.TRANSACTION_ID, longValue);
                                        r0.startActivity(intent);
                                        return j0.INSTANCE;
                                    default:
                                        return MainActivity.p(r0, (List) obj);
                                }
                            }
                        });
                        j5.a aVar = this.mainBinding;
                        if (aVar == null) {
                            r.o("mainBinding");
                            throw null;
                        }
                        setContentView(aVar.a());
                        setSupportActionBar(aVar.toolbar);
                        MaterialToolbar materialToolbar = aVar.toolbar;
                        CharSequence loadLabel = getApplicationInfo().loadLabel(getPackageManager());
                        r.j(loadLabel, "loadLabel(...)");
                        materialToolbar.setSubtitle(loadLabel);
                        aVar.tutorialLink.setMovementMethod(LinkMovementMethod.getInstance());
                        RecyclerView recyclerView = aVar.transactionsRecyclerView;
                        recyclerView.setHasFixedSize(true);
                        recyclerView.j(new t(this, 1));
                        com.chuckerteam.chucker.internal.ui.transaction.j jVar = this.transactionsAdapter;
                        if (jVar == null) {
                            r.o("transactionsAdapter");
                            throw null;
                        }
                        recyclerView.setAdapter(jVar);
                        final int i3 = 1;
                        t().getTransactions().i(this, new d(new kq.l(this) {
                            public final MainActivity b;

                            {
                                this.b = this;
                            }

                            public final Object invoke(Object obj) {
                                ?? r0 = this.b;
                                switch (i3) {
                                    case 0:
                                        long longValue = ((Long) obj).longValue();
                                        MainActivity.Companion companion = MainActivity.INSTANCE;
                                        TransactionActivity.Companion.getClass();
                                        r.k((Object) r0, "context");
                                        Intent intent = new Intent((Context) r0, (Class<?>) TransactionActivity.class);
                                        intent.putExtra(AnalyticsUtil.TRANSACTION_ID, longValue);
                                        r0.startActivity(intent);
                                        return j0.INSTANCE;
                                    default:
                                        return MainActivity.p(r0, (List) obj);
                                }
                            }
                        }));
                        com.chuckerteam.chucker.api.b.INSTANCE.getClass();
                        if (!com.chuckerteam.chucker.api.b.b() || Build.VERSION.SDK_INT < 33 || ContextCompat.checkSelfPermission(this, "android.permission.POST_NOTIFICATIONS") == 0) {
                            return;
                        }
                        if (!shouldShowRequestPermissionRationale("android.permission.POST_NOTIFICATIONS")) {
                            this.permissionRequest.b("android.permission.POST_NOTIFICATIONS");
                            return;
                        }
                        j5.a aVar2 = this.mainBinding;
                        if (aVar2 == null) {
                            r.o("mainBinding");
                            throw null;
                        }
                        Snackbar D = Snackbar.D(aVar2.a(), getApplicationContext().getString(i5.h.chucker_notifications_permission_not_granted), 0);
                        D.E(getApplicationContext().getString(i5.h.chucker_change), new View.OnClickListener() {
                            @Override
                            public final void onClick(View view) {
                                MainActivity.Companion companion = MainActivity.INSTANCE;
                                Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
                                intent.addFlags(268435456);
                                TraceFieldInterface traceFieldInterface = MainActivity.this;
                                intent.setData(Uri.fromParts("package", traceFieldInterface.getPackageName(), null));
                                traceFieldInterface.startActivity(intent);
                            }
                        });
                        D.F();
                        return;
                    }
                }
            }
        }
        throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
    }

    public final boolean onCreateOptionsMenu(Menu menu) {
        r.k(menu, "menu");
        getMenuInflater().inflate(i5.f.chucker_transactions_list, menu);
        androidx.core.view.i.a(menu);
        SearchView actionView = menu.findItem(i5.d.search).getActionView();
        r.i(actionView, "null cannot be cast to non-null type androidx.appcompat.widget.SearchView");
        SearchView searchView = actionView;
        searchView.setOnQueryTextListener(this);
        searchView.setIconifiedByDefault(true);
        return super/*android.app.Activity*/.onCreateOptionsMenu(menu);
    }

    public final boolean onOptionsItemSelected(MenuItem menuItem) {
        r.k(menuItem, "item");
        int itemId = menuItem.getItemId();
        if (itemId == i5.d.clear) {
            String string = getString(i5.h.chucker_clear);
            r.j(string, "getString(...)");
            String string2 = getString(i5.h.chucker_clear_http_confirmation);
            r.j(string2, "getString(...)");
            final int i = 0;
            com.chuckerteam.chucker.internal.support.i.a(this, new s5.a(string, string2, getString(i5.h.chucker_clear), getString(i5.h.chucker_cancel)), new kq.a(this) {
                public final MainActivity b;

                {
                    this.b = this;
                }

                public final Object invoke() {
                    switch (i) {
                        case 0:
                            MainActivity.Companion companion = MainActivity.INSTANCE;
                            n t = this.b.t();
                            t.getClass();
                            kotlinx.coroutines.k.c(w0.a(t), (kotlin.coroutines.f) null, (l0) null, new m(null), 3);
                            a0.Companion.getClass();
                            a0.a.a();
                            break;
                        case 1:
                            MainActivity.Companion companion2 = MainActivity.INSTANCE;
                            h hVar = new h(null);
                            androidx.lifecycle.s sVar = this.b;
                            kotlinx.coroutines.k.c(androidx.lifecycle.t.a(sVar), (kotlin.coroutines.f) null, (l0) null, new g(sVar, sVar.getApplicationContext(), hVar, "transactions.txt", null), 3);
                            break;
                        default:
                            MainActivity.Companion companion3 = MainActivity.INSTANCE;
                            androidx.lifecycle.s sVar2 = this.b;
                            i iVar = new i(sVar2, null);
                            kotlinx.coroutines.k.c(androidx.lifecycle.t.a(sVar2), (kotlin.coroutines.f) null, (l0) null, new g(sVar2, sVar2.getApplicationContext(), iVar, "transactions.har", null), 3);
                            break;
                    }
                    return j0.INSTANCE;
                }
            });
            return true;
        }
        if (itemId == i5.d.share_text) {
            final int i2 = 1;
            com.chuckerteam.chucker.internal.support.i.a(this, s(i5.h.chucker_export_text_http_confirmation), new kq.a(this) {
                public final MainActivity b;

                {
                    this.b = this;
                }

                public final Object invoke() {
                    switch (i2) {
                        case 0:
                            MainActivity.Companion companion = MainActivity.INSTANCE;
                            n t = this.b.t();
                            t.getClass();
                            kotlinx.coroutines.k.c(w0.a(t), (kotlin.coroutines.f) null, (l0) null, new m(null), 3);
                            a0.Companion.getClass();
                            a0.a.a();
                            break;
                        case 1:
                            MainActivity.Companion companion2 = MainActivity.INSTANCE;
                            h hVar = new h(null);
                            androidx.lifecycle.s sVar = this.b;
                            kotlinx.coroutines.k.c(androidx.lifecycle.t.a(sVar), (kotlin.coroutines.f) null, (l0) null, new g(sVar, sVar.getApplicationContext(), hVar, "transactions.txt", null), 3);
                            break;
                        default:
                            MainActivity.Companion companion3 = MainActivity.INSTANCE;
                            androidx.lifecycle.s sVar2 = this.b;
                            i iVar = new i(sVar2, null);
                            kotlinx.coroutines.k.c(androidx.lifecycle.t.a(sVar2), (kotlin.coroutines.f) null, (l0) null, new g(sVar2, sVar2.getApplicationContext(), iVar, "transactions.har", null), 3);
                            break;
                    }
                    return j0.INSTANCE;
                }
            });
            return true;
        }
        if (itemId == i5.d.share_har) {
            final int i3 = 2;
            com.chuckerteam.chucker.internal.support.i.a(this, s(i5.h.chucker_export_har_http_confirmation), new kq.a(this) {
                public final MainActivity b;

                {
                    this.b = this;
                }

                public final Object invoke() {
                    switch (i3) {
                        case 0:
                            MainActivity.Companion companion = MainActivity.INSTANCE;
                            n t = this.b.t();
                            t.getClass();
                            kotlinx.coroutines.k.c(w0.a(t), (kotlin.coroutines.f) null, (l0) null, new m(null), 3);
                            a0.Companion.getClass();
                            a0.a.a();
                            break;
                        case 1:
                            MainActivity.Companion companion2 = MainActivity.INSTANCE;
                            h hVar = new h(null);
                            androidx.lifecycle.s sVar = this.b;
                            kotlinx.coroutines.k.c(androidx.lifecycle.t.a(sVar), (kotlin.coroutines.f) null, (l0) null, new g(sVar, sVar.getApplicationContext(), hVar, "transactions.txt", null), 3);
                            break;
                        default:
                            MainActivity.Companion companion3 = MainActivity.INSTANCE;
                            androidx.lifecycle.s sVar2 = this.b;
                            i iVar = new i(sVar2, null);
                            kotlinx.coroutines.k.c(androidx.lifecycle.t.a(sVar2), (kotlin.coroutines.f) null, (l0) null, new g(sVar2, sVar2.getApplicationContext(), iVar, "transactions.har", null), 3);
                            break;
                    }
                    return j0.INSTANCE;
                }
            });
            return true;
        }
        if (itemId == i5.d.save_text) {
            v(b.TEXT);
            return true;
        }
        if (itemId != i5.d.save_har) {
            return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
        }
        v(b.HAR);
        return true;
    }

    public final boolean onQueryTextChange(String str) {
        r.k(str, "newText");
        t().b(str);
        return true;
    }

    public final boolean onQueryTextSubmit(String str) {
        r.k(str, SearchIntents.EXTRA_QUERY);
        return true;
    }

    public final s5.a s(int i) {
        String string = getString(i5.h.chucker_export);
        r.j(string, "getString(...)");
        String string2 = getString(i);
        r.j(string2, "getString(...)");
        return new s5.a(string, string2, getString(i5.h.chucker_export), getString(i5.h.chucker_cancel));
    }

    public final n t() {
        return (n) this.viewModel.getValue();
    }

    public final void u(Uri uri, b bVar) {
        if (uri == null) {
            Toast.makeText(getApplicationContext(), i5.h.chucker_save_failed_to_open_document, 0).show();
        } else {
            kotlinx.coroutines.k.c(androidx.lifecycle.t.a(this), (kotlin.coroutines.f) null, (l0) null, new j(uri, this, bVar, null), 3);
        }
    }

    public final void v(final b bVar) {
        int i;
        int i2 = c.$EnumSwitchMapping$0[bVar.ordinal()];
        if (i2 == 1) {
            i = i5.h.chucker_save_text_http_confirmation;
        } else {
            if (i2 != 2) {
                throw new q();
            }
            i = i5.h.chucker_save_har_http_confirmation;
        }
        String string = getString(i5.h.chucker_save);
        r.j(string, "getString(...)");
        String string2 = getString(i);
        r.j(string2, "getString(...)");
        com.chuckerteam.chucker.internal.support.i.a(this, new s5.a(string, string2, getString(i5.h.chucker_save), getString(i5.h.chucker_cancel)), new kq.a() {
            public final Object invoke() {
                return MainActivity.q(MainActivity.b.this, this);
            }
        });
    }
}