导航菜单

页面标题

页面副标题

Uptodown App Store v6.80 - MainActivity.java 源代码

正在查看: Uptodown App Store v6.80 应用的 MainActivity.java JAVA 源代码文件

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


package com.uptodown.activities;

import J1.AbstractC0401x0;
import N1.k;
import S2.AbstractC0525o;
import W1.C0536h;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.ClickableSpan;
import android.text.style.StyleSpan;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SwitchCompat;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
import b2.C0555d;
import b2.C0560i;
import b2.C0561j;
import c2.C0589k;
import c2.C0591l;
import c2.C0599p;
import c2.F0;
import c2.M0;
import c2.N0;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import com.mbridge.msdk.playercommon.exoplayer2.source.ExtractorMediaSource;
import com.mbridge.msdk.playercommon.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.uptodown.UptodownApp;
import com.uptodown.activities.MainActivity;
import com.uptodown.activities.preferences.PreferencesActivity;
import com.uptodown.activities.preferences.a;
import com.uptodown.core.activities.InstallerActivity;
import com.uptodown.views.ScrollableTextView;
import com.uptodown.workers.DownloadApkWorker;
import com.uptodown.workers.GetUserDataWorker;
import d2.B1;
import d2.C0820h;
import d2.C0837m1;
import d2.C0837m1.RunnableC0839b;
import d2.C0837m1.RunnableC0841d;
import d2.C0898y1;
import d2.K1;
import d2.v2;
import f2.InterfaceC0930m;
import f2.InterfaceC0934q;
import g2.C0944E;
import g2.C0949J;
import g2.C0952c;
import g2.C0955f;
import g2.C0957h;
import g2.C0963n;
import g2.C0965p;
import g2.C0966q;
import g2.C0973y;
import g2.P;
import g2.S;
import h2.ResultReceiverC0980f;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.AbstractC1009g;
import o3.E0;
import u2.p;
import u2.u;
import u2.v;

public final class MainActivity extends AbstractC0401x0 {

    public static final C0732b f235H0 = new C0732b(null);

    private ResultReceiverC0980f f236A0;

    private final ActivityResultLauncher f238C0;

    private final ActivityResultLauncher f239D0;

    private final ActivityResultLauncher f240E0;

    private final m f241F0;

    private final ActivityResultLauncher f242G0;
    private RelativeLayout N;
    private int O;
    private boolean Q;
    private RelativeLayout R;
    private Toolbar S;
    private AppBarLayout T;
    private SwitchCompat U;
    private SwitchCompat V;
    private TabLayout W;
    private C0955f X;
    private ViewPager2 Y;
    private RelativeLayout Z;

    private RelativeLayout f243m0;

    private ProgressBar f244n0;

    private TabLayout f245o0;

    private B1 f246p0;

    private K1 f247q0;

    private C0898y1 f248r0;

    private v2 f249s0;

    private FrameLayout f253w0;

    private F0 f254x0;

    private FrameLayout f255y0;

    private int f256z0;
    private ArrayList P = new ArrayList();

    private ArrayList f250t0 = new ArrayList();

    private ArrayList f251u0 = new ArrayList();

    private long f252v0 = -1;

    private final j f237B0 = new j();

    public static final class A implements InterfaceC0934q {
        final C0591l a;
        final ArrayList b;
        final MainActivity c;

        A(C0591l c0591l, ArrayList arrayList, MainActivity mainActivity) {
            this.a = c0591l;
            this.b = arrayList;
            this.c = mainActivity;
        }

        @Override
        public void c(int i) {
        }

        @Override
        public void d(C0955f appInfo) {
            kotlin.jvm.internal.m.e(appInfo, "appInfo");
            this.a.d.setVisibility(8);
            this.b.add(appInfo);
            C0589k c = C0589k.c(this.c.getLayoutInflater());
            kotlin.jvm.internal.m.d(c, "inflate(...)");
            com.squareup.picasso.s.h().l(appInfo.G()).l(2131231321).n(UptodownApp.F.h0(this.c)).i(c.b);
            c.c.setTypeface(N1.k.g.x());
            c.c.setText(appInfo.M());
            this.a.c.addView(c.getRoot());
        }
    }

    public static final class B implements Animation.AnimationListener {
        final ImageView a;
        final Animation b;
        final ImageView c;

        B(ImageView imageView, Animation animation, ImageView imageView2) {
            this.a = imageView;
            this.b = animation;
            this.c = imageView2;
        }

        public static final void b(ImageView imageView, Animation animation, ImageView imageView2, Animation animation2) {
            imageView.startAnimation(animation);
            imageView2.startAnimation(animation2);
        }

        @Override
        public void onAnimationEnd(final Animation animation) {
            Handler handler = new Handler(Looper.getMainLooper());
            final ImageView imageView = this.a;
            final Animation animation2 = this.b;
            final ImageView imageView2 = this.c;
            handler.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    MainActivity.B.b(imageView, animation2, imageView2, animation);
                }
            }, 1500L);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }
    }

    public static final class C extends ClickableSpan {
        C() {
        }

        @Override
        public void onClick(View widget) {
            kotlin.jvm.internal.m.e(widget, "widget");
        }

        @Override
        public void updateDrawState(TextPaint ds) {
            kotlin.jvm.internal.m.e(ds, "ds");
            super.updateDrawState(ds);
            ds.setColor(ContextCompat.getColor(MainActivity.this, 2131100314));
            ds.setTypeface(N1.k.g.w());
            ds.setUnderlineText(false);
        }
    }

    public static final class D extends ClickableSpan {
        D() {
        }

        @Override
        public void onClick(View widget) {
            kotlin.jvm.internal.m.e(widget, "widget");
        }

        @Override
        public void updateDrawState(TextPaint ds) {
            kotlin.jvm.internal.m.e(ds, "ds");
            super.updateDrawState(ds);
            ds.setColor(ContextCompat.getColor(MainActivity.this, 2131100664));
            ds.setTypeface(N1.k.g.w());
            ds.setUnderlineText(false);
        }
    }

    static final class E extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;
        final String c;

        E(String str, V2.d dVar) {
            super(2, dVar);
            this.c = str;
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return MainActivity.this.new E(this.c, dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            W2.b.c();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            Fragment G5 = MainActivity.this.G5();
            if (G5 instanceof C0837m1) {
                ((C0837m1) G5).Z6(this.c);
            }
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((E) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    static final class F extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;
        final String c;

        F(String str, V2.d dVar) {
            super(2, dVar);
            this.c = str;
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return MainActivity.this.new F(this.c, dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            W2.b.c();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            Fragment G5 = MainActivity.this.G5();
            if (G5 instanceof C0837m1) {
                ((C0837m1) G5).a7(this.c);
            }
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((F) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    static final class G extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;
        final kotlin.jvm.internal.A c;
        final kotlin.jvm.internal.A d;

        static final class a extends kotlin.coroutines.jvm.internal.l implements d3.p {
            int a;
            final MainActivity b;
            final kotlin.jvm.internal.C c;
            final kotlin.jvm.internal.A d;
            final kotlin.jvm.internal.A e;

            a(MainActivity mainActivity, kotlin.jvm.internal.C c, kotlin.jvm.internal.A a, kotlin.jvm.internal.A a4, V2.d dVar) {
                super(2, dVar);
                this.b = mainActivity;
                this.c = c;
                this.d = a;
                this.e = a4;
            }

            @Override
            public final V2.d create(Object obj, V2.d dVar) {
                return new a(this.b, this.c, this.d, this.e, dVar);
            }

            @Override
            public final Object invokeSuspend(Object obj) {
                W2.b.c();
                if (this.a != 0) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
                this.b.d7((Drawable) this.c.a, this.d.a + this.e.a > 0);
                return R2.s.a;
            }

            @Override
            public final Object invoke(o3.J j, V2.d dVar) {
                return ((a) create(j, dVar)).invokeSuspend(R2.s.a);
            }
        }

        G(kotlin.jvm.internal.A a4, kotlin.jvm.internal.A a5, V2.d dVar) {
            super(2, dVar);
            this.c = a4;
            this.d = a5;
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return MainActivity.this.new G(this.c, this.d, dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            String c;
            Object c4 = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                if (MainActivity.this.getApplicationContext() != null) {
                    kotlin.jvm.internal.A a4 = this.c;
                    P.b bVar = g2.P.k;
                    Context applicationContext = MainActivity.this.getApplicationContext();
                    kotlin.jvm.internal.m.d(applicationContext, "getApplicationContext(...)");
                    a4.a = bVar.a(applicationContext);
                    v.a aVar = u2.v.v;
                    Context applicationContext2 = MainActivity.this.getApplicationContext();
                    kotlin.jvm.internal.m.d(applicationContext2, "getApplicationContext(...)");
                    u2.v a5 = aVar.a(applicationContext2);
                    a5.a();
                    ArrayList l02 = a5.l0();
                    a5.i();
                    Iterator it = l02.iterator();
                    kotlin.jvm.internal.m.d(it, "iterator(...)");
                    while (it.hasNext()) {
                        Object next = it.next();
                        kotlin.jvm.internal.m.d(next, "next(...)");
                        C0965p c0965p = (C0965p) next;
                        if (c0965p.k() == 0 && c0965p.f()) {
                            this.d.a++;
                        }
                    }
                    kotlin.jvm.internal.C c5 = new kotlin.jvm.internal.C();
                    S.b bVar2 = g2.S.m;
                    g2.S e = bVar2.e(MainActivity.this);
                    if (e != null && (c = e.c()) != null && c.length() != 0) {
                        try {
                            c5.a = new BitmapDrawable(MainActivity.this.getResources(), com.squareup.picasso.s.h().l(bVar2.c(e.a())).n(UptodownApp.F.h0(MainActivity.this)).g());
                        } catch (IOException unused) {
                        }
                    }
                    E0 c6 = o3.Y.c();
                    a aVar2 = new a(MainActivity.this, c5, this.d, this.c, null);
                    this.a = 1;
                    if (o3.g.g(c6, aVar2, this) == c4) {
                        return c4;
                    }
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((G) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    static final class H extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;

        H(V2.d dVar) {
            super(2, dVar);
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return MainActivity.this.new H(dVar);
        }

        @Override
        public final java.lang.Object invokeSuspend(java.lang.Object r6) {
            throw new UnsupportedOperationException("Method not decompiled: com.uptodown.activities.MainActivity.H.invokeSuspend(java.lang.Object):java.lang.Object");
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((H) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    static final class I extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;
        final int b;
        final MainActivity c;
        final C0965p d;

        I(int i, MainActivity mainActivity, C0965p c0965p, V2.d dVar) {
            super(2, dVar);
            this.b = i;
            this.c = mainActivity;
            this.d = c0965p;
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return new I(this.b, this.c, this.d, dVar);
        }

        @Override
        public final java.lang.Object invokeSuspend(java.lang.Object r5) {
            throw new UnsupportedOperationException("Method not decompiled: com.uptodown.activities.MainActivity.I.invokeSuspend(java.lang.Object):java.lang.Object");
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((I) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    public final class RunnableC0731a implements Runnable {
        public RunnableC0731a() {
        }

        @Override
        public void run() {
            LinearLayout linearLayout = (LinearLayout) MainActivity.this.findViewById(2131362552);
            if (linearLayout == null || linearLayout.getVisibility() != 0) {
                return;
            }
            MainActivity.this.U6();
        }
    }

    public static final class C0732b {
        public C0732b(AbstractC1009g abstractC1009g) {
            this();
        }

        private C0732b() {
        }
    }

    public final class RunnableC0733c implements Runnable {
        public RunnableC0733c() {
        }

        @Override
        public void run() {
            MainActivity.this.Y6();
        }
    }

    public final class RunnableC0734d implements Runnable {
        private final int a;
        private final String b;
        final MainActivity c;

        public RunnableC0734d(MainActivity mainActivity, int i, String packagename) {
            kotlin.jvm.internal.m.e(packagename, "packagename");
            this.c = mainActivity;
            this.a = i;
            this.b = packagename;
        }

        @Override
        public void run() {
            Fragment G5 = this.c.G5();
            if (G5 instanceof C0837m1) {
                this.c.runOnUiThread(new C0837m1.RunnableC0840c((C0837m1) G5, this.b, this.a));
            }
        }
    }

    public final class RunnableC0735e implements Runnable {
        private final int a;
        private final String b;

        public RunnableC0735e(int i, String str) {
            this.a = i;
            this.b = str;
        }

        @Override
        public void run() {
            g2.P p;
            if (this.b != null) {
                v.a aVar = u2.v.v;
                Context baseContext = MainActivity.this.getBaseContext();
                kotlin.jvm.internal.m.d(baseContext, "getBaseContext(...)");
                u2.v a = aVar.a(baseContext);
                a.a();
                p = a.C0(this.b);
                a.i();
            } else {
                p = null;
            }
            MainActivity.this.Q7(this.a, p);
        }
    }

    public static final class AnimationAnimationListenerC0736f implements Animation.AnimationListener {
        AnimationAnimationListenerC0736f() {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
            int C5 = MainActivity.this.C5();
            if (C5 < 0 || C5 >= MainActivity.this.P.size()) {
                ((g2.Y) MainActivity.this.P.get(MainActivity.this.O)).c().setVisibility(8);
                MainActivity.this.finish();
            } else {
                RelativeLayout relativeLayout = MainActivity.this.R;
                if (relativeLayout != null) {
                    relativeLayout.removeAllViews();
                }
                RelativeLayout c = ((g2.Y) MainActivity.this.P.get(C5)).c();
                RelativeLayout relativeLayout2 = MainActivity.this.R;
                if (relativeLayout2 != null) {
                    relativeLayout2.addView(c);
                }
                new y2.n(MainActivity.this).h(c, 2130772028);
            }
            MainActivity.this.Q = false;
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
        }

        @Override
        public void onAnimationStart(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
            MainActivity.this.Q = true;
        }
    }

    public static final class AnimationAnimationListenerC0737g implements Animation.AnimationListener {
        AnimationAnimationListenerC0737g() {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
            int H5 = MainActivity.this.H5();
            if (H5 < 0 || H5 >= MainActivity.this.P.size()) {
                MainActivity.this.S6();
                return;
            }
            MainActivity mainActivity = MainActivity.this;
            Object obj = mainActivity.P.get(H5);
            kotlin.jvm.internal.m.d(obj, "get(...)");
            mainActivity.f7((g2.Y) obj);
            if (((g2.Y) MainActivity.this.P.get(MainActivity.this.O)).a() == 2 && ((g2.Y) MainActivity.this.P.get(0)).a() == 1) {
                ((g2.Y) MainActivity.this.P.get(0)).c().removeAllViews();
                MainActivity.this.P.remove(0);
                MainActivity.this.O = 0;
            }
            MainActivity.this.Y7();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
        }

        @Override
        public void onAnimationStart(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
        }
    }

    public static final class AnimationAnimationListenerC0738h implements Animation.AnimationListener {
        AnimationAnimationListenerC0738h() {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
            FrameLayout frameLayout = MainActivity.this.f253w0;
            kotlin.jvm.internal.m.b(frameLayout);
            frameLayout.removeAllViews();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
        }

        @Override
        public void onAnimationStart(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
        }
    }

    static final class C0739i extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;

        static final class a extends kotlin.coroutines.jvm.internal.l implements d3.p {
            int a;
            final MainActivity b;
            final kotlin.jvm.internal.C c;

            a(MainActivity mainActivity, kotlin.jvm.internal.C c, V2.d dVar) {
                super(2, dVar);
                this.b = mainActivity;
                this.c = c;
            }

            @Override
            public final V2.d create(Object obj, V2.d dVar) {
                return new a(this.b, this.c, dVar);
            }

            @Override
            public final Object invokeSuspend(Object obj) {
                W2.b.c();
                if (this.a != 0) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
                TabLayout tabLayout = this.b.W;
                kotlin.jvm.internal.m.b(tabLayout);
                TabLayout.Tab newTab = tabLayout.newTab();
                kotlin.jvm.internal.m.d(newTab, "newTab(...)");
                View inflate = LayoutInflater.from(this.b).inflate(2131558553, (ViewGroup) this.b.S, false);
                kotlin.jvm.internal.m.c(inflate, "null cannot be cast to non-null type android.widget.TextView");
                TextView textView = (TextView) inflate;
                textView.setTypeface(N1.k.g.w());
                textView.setText(this.b.getString(2131952043));
                newTab.setCustomView(textView);
                newTab.setTag(kotlin.coroutines.jvm.internal.b.b(0));
                TabLayout tabLayout2 = this.b.W;
                kotlin.jvm.internal.m.b(tabLayout2);
                tabLayout2.addTab(newTab);
                Iterator it = ((ArrayList) this.c.a).iterator();
                kotlin.jvm.internal.m.d(it, "iterator(...)");
                while (it.hasNext()) {
                    Object next = it.next();
                    kotlin.jvm.internal.m.d(next, "next(...)");
                    C0957h c0957h = (C0957h) next;
                    TabLayout tabLayout3 = this.b.W;
                    kotlin.jvm.internal.m.b(tabLayout3);
                    TabLayout.Tab newTab2 = tabLayout3.newTab();
                    View inflate2 = LayoutInflater.from(this.b).inflate(2131558553, (ViewGroup) this.b.S, false);
                    kotlin.jvm.internal.m.c(inflate2, "null cannot be cast to non-null type android.widget.TextView");
                    TextView textView2 = (TextView) inflate2;
                    textView2.setTypeface(N1.k.g.x());
                    textView2.setText(c0957h.d());
                    newTab2.setCustomView(textView2);
                    newTab2.setTag(c0957h);
                    TabLayout tabLayout4 = this.b.W;
                    kotlin.jvm.internal.m.b(tabLayout4);
                    tabLayout4.addTab(newTab2);
                }
                return R2.s.a;
            }

            @Override
            public final Object invoke(o3.J j, V2.d dVar) {
                return ((a) create(j, dVar)).invokeSuspend(R2.s.a);
            }
        }

        public static final class b implements TabLayout.OnTabSelectedListener {
            final MainActivity a;

            b(MainActivity mainActivity) {
                this.a = mainActivity;
            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {
                kotlin.jvm.internal.m.e(tab, "tab");
            }

            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                kotlin.jvm.internal.m.e(tab, "tab");
                TabLayout tabLayout = this.a.W;
                kotlin.jvm.internal.m.b(tabLayout);
                View childAt = tabLayout.getChildAt(0);
                kotlin.jvm.internal.m.c(childAt, "null cannot be cast to non-null type android.view.ViewGroup");
                View findViewById = ((ViewGroup) childAt).getChildAt(tab.getPosition()).findViewById(2131363828);
                kotlin.jvm.internal.m.d(findViewById, "findViewById(...)");
                ((TextView) findViewById).setTypeface(N1.k.g.w());
                this.a.C7();
                if (kotlin.jvm.internal.m.a(tab.getTag(), 0)) {
                    this.a.d8();
                    return;
                }
                Object tag = tab.getTag();
                kotlin.jvm.internal.m.c(tag, "null cannot be cast to non-null type com.uptodown.models.Category");
                C0957h c0957h = (C0957h) tag;
                if (c0957h.b() != 523) {
                    this.a.f256z0 = tab.getPosition();
                }
                this.a.e8(c0957h);
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {
                kotlin.jvm.internal.m.e(tab, "tab");
                TabLayout tabLayout = this.a.W;
                kotlin.jvm.internal.m.b(tabLayout);
                View childAt = tabLayout.getChildAt(0);
                kotlin.jvm.internal.m.c(childAt, "null cannot be cast to non-null type android.view.ViewGroup");
                View findViewById = ((ViewGroup) childAt).getChildAt(tab.getPosition()).findViewById(2131363828);
                kotlin.jvm.internal.m.d(findViewById, "findViewById(...)");
                ((TextView) findViewById).setTypeface(N1.k.g.x());
            }
        }

        C0739i(V2.d dVar) {
            super(2, dVar);
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return MainActivity.this.new C0739i(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                kotlin.jvm.internal.C c4 = new kotlin.jvm.internal.C();
                c4.a = new ArrayList();
                u2.v a4 = u2.v.v.a(MainActivity.this);
                a4.a();
                g2.K B02 = a4.B0("categories");
                if (B02 == null || !B02.a()) {
                    C0949J o = new u2.O(MainActivity.this).o();
                    if (!o.b() && o.d() != null) {
                        C0957h.b bVar = C0957h.h;
                        String d = o.d();
                        kotlin.jvm.internal.m.b(d);
                        c4.a = C0957h.b.b(bVar, d, 0, 2, null);
                        String d4 = o.d();
                        kotlin.jvm.internal.m.b(d4);
                        g2.K k = new g2.K("categories", d4);
                        a4.O("categories");
                        a4.W0(k);
                    }
                } else {
                    c4.a = C0957h.b.b(C0957h.h, B02.b(), 0, 2, null);
                }
                a4.i();
                if (!((Collection) c4.a).isEmpty()) {
                    E0 c5 = o3.Y.c();
                    a aVar = new a(MainActivity.this, c4, null);
                    this.a = 1;
                    if (o3.g.g(c5, aVar, this) == c) {
                        return c;
                    }
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            TabLayout tabLayout = MainActivity.this.W;
            kotlin.jvm.internal.m.b(tabLayout);
            tabLayout.addOnTabSelectedListener((TabLayout.OnTabSelectedListener) new b(MainActivity.this));
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((C0739i) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    public static final class j implements InterfaceC0934q {
        j() {
        }

        @Override
        public void c(int i) {
        }

        @Override
        public void d(C0955f appInfo) {
            kotlin.jvm.internal.m.e(appInfo, "appInfo");
            if (MainActivity.this.U5()) {
                MainActivity.this.a3(appInfo);
            }
        }
    }

    public static final class k implements Animation.AnimationListener {
        k() {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
            FrameLayout frameLayout = MainActivity.this.f255y0;
            kotlin.jvm.internal.m.b(frameLayout);
            frameLayout.removeAllViews();
            MainActivity.this.f255y0 = null;
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
        }

        @Override
        public void onAnimationStart(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
        }
    }

    public static final class l implements H1.b {
        final RelativeLayout a;
        final LinearLayout b;
        final MainActivity c;

        l(RelativeLayout relativeLayout, LinearLayout linearLayout, MainActivity mainActivity) {
            this.a = relativeLayout;
            this.b = linearLayout;
            this.c = mainActivity;
        }

        @Override
        public void a(Exception exc) {
            int dimension = (int) this.c.getResources().getDimension(2131166019);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
            layoutParams.setMargins(dimension, (int) this.c.getResources().getDimension(2131166022), dimension, 0);
            this.a.setLayoutParams(layoutParams);
            this.a.setVisibility(0);
            this.b.setVisibility(0);
        }

        @Override
        public void onSuccess() {
            this.a.setVisibility(0);
            this.b.setVisibility(0);
        }
    }

    public static final class m extends OnBackPressedCallback {
        m() {
            super(true);
        }

        public void handleOnBackPressed() {
            y2.g l22 = MainActivity.this.l2();
            if (l22 == null || !l22.l(MainActivity.this)) {
                boolean popBackStackImmediate = MainActivity.this.getSupportFragmentManager().popBackStackImmediate();
                int backStackEntryCount = MainActivity.this.getSupportFragmentManager().getBackStackEntryCount();
                if (popBackStackImmediate && backStackEntryCount >= 0) {
                    if (MainActivity.this.G5() instanceof C0837m1) {
                        RelativeLayout I5 = MainActivity.this.I5();
                        if (I5 != null) {
                            I5.setVisibility(0);
                        }
                        Fragment G5 = MainActivity.this.G5();
                        kotlin.jvm.internal.m.c(G5, "null cannot be cast to non-null type com.uptodown.fragments.AppDetailsFragment");
                        ((C0837m1) G5).O2(MainActivity.this);
                        return;
                    }
                    RelativeLayout I52 = MainActivity.this.I5();
                    if (I52 != null) {
                        I52.setVisibility(8);
                    }
                    if (MainActivity.this.G5() == null || (MainActivity.this.G5() instanceof C0898y1) || (MainActivity.this.G5() instanceof B1)) {
                        TabLayout tabLayout = MainActivity.this.f245o0;
                        if (tabLayout == null || tabLayout.getSelectedTabPosition() != 2) {
                            MainActivity.this.C7();
                            return;
                        }
                        return;
                    }
                    return;
                }
                RelativeLayout I53 = MainActivity.this.I5();
                if (I53 != null) {
                    I53.setVisibility(8);
                }
                int size = MainActivity.this.f250t0.size();
                if (size <= 0) {
                    if (!MainActivity.this.U5()) {
                        MainActivity.this.finish();
                        return;
                    }
                    if (MainActivity.this.R != null) {
                        RelativeLayout relativeLayout = MainActivity.this.R;
                        kotlin.jvm.internal.m.b(relativeLayout);
                        if (relativeLayout.getVisibility() == 0) {
                            MainActivity.this.p5();
                            return;
                        }
                    }
                    ViewPager2 viewPager2 = MainActivity.this.Y;
                    if (viewPager2 == null || viewPager2.getCurrentItem() != 0) {
                        MainActivity.this.s5(0);
                        return;
                    } else {
                        MainActivity.this.finish();
                        return;
                    }
                }
                Fragment fragment = (Fragment) AbstractC0525o.P(MainActivity.this.f250t0);
                MainActivity.this.f250t0.remove(size - 1);
                if (fragment instanceof B1) {
                    B1 b12 = (B1) fragment;
                    if (b12.u() != null) {
                        C0957h u = b12.u();
                        kotlin.jvm.internal.m.b(u);
                        if (u.b() == 523) {
                            MainActivity.this.s5(1);
                            return;
                        }
                    }
                    MainActivity.this.d8();
                    return;
                }
                if (!MainActivity.this.U5()) {
                    MainActivity.this.finish();
                    return;
                }
                if (MainActivity.this.R != null) {
                    RelativeLayout relativeLayout2 = MainActivity.this.R;
                    kotlin.jvm.internal.m.b(relativeLayout2);
                    if (relativeLayout2.getVisibility() == 0) {
                        MainActivity.this.p5();
                        return;
                    }
                }
                ViewPager2 viewPager22 = MainActivity.this.Y;
                if (viewPager22 == null || viewPager22.getCurrentItem() != 0) {
                    MainActivity.this.s5(0);
                } else {
                    MainActivity.this.finish();
                }
            }
        }
    }

    static final class n extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;

        n(V2.d dVar) {
            super(2, dVar);
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return MainActivity.this.new n(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                MainActivity mainActivity = MainActivity.this;
                this.a = 1;
                if (mainActivity.D5(this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((n) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    public static final class o implements InterfaceC0930m {
        o() {
        }

        @Override
        public void a(long j, long j4, String str, long j5, boolean z) {
            MainActivity.this.J6(j, j4, str, j5);
        }

        @Override
        public void b() {
            ?? r02 = MainActivity.this;
            String string = r02.getString(2131951686);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            r02.r0(string);
        }
    }

    static final class p extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;
        final q c;

        p(q qVar, V2.d dVar) {
            super(2, dVar);
            this.c = qVar;
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return MainActivity.this.new p(this.c, dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                GetUserDataWorker.a aVar = GetUserDataWorker.b;
                AppCompatActivity appCompatActivity = MainActivity.this;
                f2.L l = this.c;
                this.a = 1;
                if (aVar.a(appCompatActivity, l, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((p) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    public static final class q implements f2.L {
        q() {
        }

        @Override
        public void a() {
            v2 v2Var = MainActivity.this.f249s0;
            if (v2Var != null) {
                v2Var.L0();
            }
            MainActivity.this.I7();
        }
    }

    public static final class r implements InterfaceC0934q {
        r() {
        }

        @Override
        public void c(int i) {
            MainActivity.this.f252v0 = -1L;
            ?? r3 = MainActivity.this;
            String string = r3.getString(2131951688);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            r3.r0(string);
        }

        @Override
        public void d(C0955f appInfo) {
            kotlin.jvm.internal.m.e(appInfo, "appInfo");
            MainActivity.this.a3(appInfo);
            MainActivity.this.f252v0 = -1L;
        }
    }

    public static final class s implements InterfaceC0934q {
        final long a;
        final long b;
        final String c;
        final MainActivity d;

        s(long j, long j4, String str, MainActivity mainActivity) {
            this.a = j;
            this.b = j4;
            this.c = str;
            this.d = mainActivity;
        }

        @Override
        public void c(int i) {
            this.d.f252v0 = -1L;
            ?? r3 = this.d;
            String string = r3.getString(2131951686);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            r3.r0(string);
        }

        @Override
        public void d(C0955f appInfo) {
            kotlin.jvm.internal.m.e(appInfo, "appInfo");
            if (appInfo.H0() && appInfo.E0()) {
                C0965p c0965p = new C0965p();
                c0965p.U(appInfo.e());
                c0965p.V(appInfo.M());
                appInfo.Q0(this.a);
                c0965p.d0(this.b);
                appInfo.Y0(this.c);
                c0965p.a0(appInfo.R());
                c0965p.c0(appInfo.D());
                C0966q c0966q = new C0966q();
                c0966q.m(this.a);
                c0966q.n(this.c);
                c0966q.q(0L);
                c0965p.o().add(c0966q);
                DownloadApkWorker.i.b(this.d, c0965p.R(this.d));
                this.d.a3(appInfo);
            }
            this.d.f252v0 = -1L;
        }
    }

    static final class t extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;

        t(V2.d dVar) {
            super(2, dVar);
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return MainActivity.this.new t(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            W2.b.c();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            Fragment G5 = MainActivity.this.G5();
            if (G5 instanceof C0837m1) {
                ((C0837m1) G5).U5();
            }
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((t) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    public static final class u implements Animation.AnimationListener {
        u() {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
            MainActivity.this.L5();
            MainActivity.this.R6();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
        }

        @Override
        public void onAnimationStart(Animation animation) {
            kotlin.jvm.internal.m.e(animation, "animation");
        }
    }

    static final class v extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;

        v(V2.d dVar) {
            super(2, dVar);
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return MainActivity.this.new v(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                MainActivity mainActivity = MainActivity.this;
                this.a = 1;
                if (mainActivity.D5(this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((v) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    public static final class w implements TabLayout.OnTabSelectedListener {
        w() {
        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {
            K1 k12;
            kotlin.jvm.internal.m.e(tab, "tab");
            if (tab.getPosition() == 0) {
                if (MainActivity.this.f248r0 != null) {
                    MainActivity.this.d8();
                    MainActivity.this.C7();
                    C0898y1 c0898y1 = MainActivity.this.f248r0;
                    kotlin.jvm.internal.m.b(c0898y1);
                    c0898y1.H();
                    return;
                }
                return;
            }
            if (tab.getPosition() != 1) {
                if (tab.getPosition() != 2 || (k12 = MainActivity.this.f247q0) == null) {
                    return;
                }
                k12.V();
                return;
            }
            if (MainActivity.this.f246p0 != null) {
                MainActivity.this.C7();
                B1 b12 = MainActivity.this.f246p0;
                kotlin.jvm.internal.m.b(b12);
                b12.y();
            }
        }

        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            kotlin.jvm.internal.m.e(tab, "tab");
            ViewPager2 viewPager2 = MainActivity.this.Y;
            kotlin.jvm.internal.m.b(viewPager2);
            viewPager2.setCurrentItem(tab.getPosition(), false);
            MainActivity.this.Q6();
            TabLayout tabLayout = MainActivity.this.W;
            if (tabLayout != null) {
                tabLayout.setVisibility(0);
            }
            MainActivity.this.C7();
            int position = tab.getPosition();
            if (position == 0) {
                TabLayout tabLayout2 = MainActivity.this.W;
                kotlin.jvm.internal.m.b(tabLayout2);
                if (tabLayout2.getSelectedTabPosition() == 0) {
                    MainActivity.this.d8();
                    return;
                }
                TabLayout tabLayout3 = MainActivity.this.W;
                kotlin.jvm.internal.m.b(tabLayout3);
                TabLayout tabLayout4 = MainActivity.this.W;
                kotlin.jvm.internal.m.b(tabLayout4);
                tabLayout3.selectTab(tabLayout4.getTabAt(MainActivity.this.f256z0));
                return;
            }
            if (position != 1) {
                if (position != 2) {
                    MainActivity.this.M5();
                    TabLayout tabLayout5 = MainActivity.this.W;
                    if (tabLayout5 != null) {
                        tabLayout5.setVisibility(8);
                        return;
                    }
                    return;
                }
                MainActivity.this.M5();
                TabLayout tabLayout6 = MainActivity.this.W;
                if (tabLayout6 != null) {
                    tabLayout6.setVisibility(8);
                    return;
                }
                return;
            }
            TabLayout tabLayout7 = MainActivity.this.W;
            kotlin.jvm.internal.m.b(tabLayout7);
            int tabCount = tabLayout7.getTabCount();
            int i = 0;
            for (int i4 = 0; i4 < tabCount; i4++) {
                TabLayout tabLayout8 = MainActivity.this.W;
                kotlin.jvm.internal.m.b(tabLayout8);
                TabLayout.Tab tabAt = tabLayout8.getTabAt(i4);
                kotlin.jvm.internal.m.b(tabAt);
                if (tabAt.getTag() instanceof C0957h) {
                    Object tag = tabAt.getTag();
                    kotlin.jvm.internal.m.c(tag, "null cannot be cast to non-null type com.uptodown.models.Category");
                    if (((C0957h) tag).b() == 523) {
                        i = i4;
                    }
                }
            }
            TabLayout tabLayout9 = MainActivity.this.W;
            kotlin.jvm.internal.m.b(tabLayout9);
            TabLayout tabLayout10 = MainActivity.this.W;
            kotlin.jvm.internal.m.b(tabLayout10);
            tabLayout9.selectTab(tabLayout10.getTabAt(i));
        }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {
            kotlin.jvm.internal.m.e(tab, "tab");
        }
    }

    public static final class x extends FragmentStateAdapter {
        x(FragmentManager fragmentManager, Lifecycle lifecycle) {
            super(fragmentManager, lifecycle);
        }

        public Fragment createFragment(int i) {
            if (i == 0) {
                MainActivity.this.f248r0 = new C0898y1();
                C0898y1 c0898y1 = MainActivity.this.f248r0;
                kotlin.jvm.internal.m.b(c0898y1);
                return c0898y1;
            }
            if (i == 1) {
                C0957h c0957h = new C0957h(0, null, null, 7, null);
                c0957h.t(523);
                c0957h.u(MainActivity.this.getString(2131952689));
                MainActivity.this.f246p0 = B1.m.a(c0957h);
                B1 b12 = MainActivity.this.f246p0;
                kotlin.jvm.internal.m.b(b12);
                return b12;
            }
            if (i != 2) {
                MainActivity.this.f249s0 = new v2();
                v2 v2Var = MainActivity.this.f249s0;
                kotlin.jvm.internal.m.b(v2Var);
                return v2Var;
            }
            C0957h c0957h2 = new C0957h(0, null, null, 7, null);
            c0957h2.t(-1);
            c0957h2.u(MainActivity.this.getString(2131952688));
            MainActivity.this.f247q0 = K1.i.a(c0957h2);
            K1 k12 = MainActivity.this.f247q0;
            kotlin.jvm.internal.m.b(k12);
            return k12;
        }

        public int getItemCount() {
            return 4;
        }
    }

    public static final class y implements InterfaceC0934q {
        final TextView a;
        final MainActivity b;
        final g2.P c;

        y(TextView textView, MainActivity mainActivity, g2.P p) {
            this.a = textView;
            this.b = mainActivity;
            this.c = p;
        }

        @Override
        public void c(int i) {
            this.a.setText(this.b.getResources().getString(2131952305, this.b.getResources().getString(N1.i.b) + " v." + this.c.k()));
        }

        @Override
        public void d(C0955f appInfo) {
            kotlin.jvm.internal.m.e(appInfo, "appInfo");
            String N = appInfo.N();
            if (N != null && N.length() != 0) {
                this.a.setText(appInfo.N());
                return;
            }
            this.a.setText(this.b.getResources().getString(2131952305, this.b.getResources().getString(N1.i.b) + " v." + this.c.k()));
        }
    }

    static final class z extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;
        final ArrayList b;
        final MainActivity c;

        z(ArrayList arrayList, MainActivity mainActivity, V2.d dVar) {
            super(2, dVar);
            this.b = arrayList;
            this.c = mainActivity;
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return new z(this.b, this.c, dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            W2.b.c();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            Iterator it = this.b.iterator();
            kotlin.jvm.internal.m.d(it, "iterator(...)");
            while (it.hasNext()) {
                Object next = it.next();
                kotlin.jvm.internal.m.d(next, "next(...)");
                UptodownApp.F.b0((C0955f) next, this.c);
            }
            return R2.s.a;
        }

        @Override
        public final Object invoke(o3.J j, V2.d dVar) {
            return ((z) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

    public MainActivity() {
        ActivityResultLauncher registerForActivityResult = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                MainActivity.B5(MainActivity.this, (ActivityResult) obj);
            }
        });
        kotlin.jvm.internal.m.d(registerForActivityResult, "registerForActivityResult(...)");
        this.f238C0 = registerForActivityResult;
        ActivityResultLauncher registerForActivityResult2 = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                MainActivity.g7(MainActivity.this, (ActivityResult) obj);
            }
        });
        kotlin.jvm.internal.m.d(registerForActivityResult2, "registerForActivityResult(...)");
        this.f239D0 = registerForActivityResult2;
        ActivityResultLauncher registerForActivityResult3 = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                MainActivity.A6(MainActivity.this, (ActivityResult) obj);
            }
        });
        kotlin.jvm.internal.m.d(registerForActivityResult3, "registerForActivityResult(...)");
        this.f240E0 = registerForActivityResult3;
        this.f241F0 = new m();
        ActivityResultLauncher registerForActivityResult4 = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                MainActivity.S5(MainActivity.this, (ActivityResult) obj);
            }
        });
        kotlin.jvm.internal.m.d(registerForActivityResult4, "registerForActivityResult(...)");
        this.f242G0 = registerForActivityResult4;
    }

    public static final void A6(MainActivity mainActivity, ActivityResult activityResult) {
        int resultCode = activityResult.getResultCode();
        if (resultCode == -1) {
            mainActivity.V7();
            return;
        }
        if (resultCode != 1) {
            return;
        }
        if (mainActivity.k3() != null) {
            if (mainActivity.R != null) {
                int size = mainActivity.P.size();
                int i = mainActivity.O;
                if (size > i && ((g2.Y) mainActivity.P.get(i)).a() == 5) {
                    mainActivity.q5();
                }
            }
            v2 v2Var = mainActivity.f249s0;
            if (v2Var != null) {
                v2Var.L0();
            }
        }
        mainActivity.V7();
    }

    public static final void A7(MainActivity mainActivity, View view) {
        mainActivity.startActivity(new Intent((Context) mainActivity, (Class<?>) LoginActivity.class), UptodownApp.F.a(mainActivity));
        mainActivity.w5();
    }

    public static final void B5(MainActivity mainActivity, ActivityResult activityResult) {
        if (activityResult.getResultCode() == -1) {
            mainActivity.L2();
        }
    }

    public static final void B6(View view) {
    }

    public static final void B7(MainActivity mainActivity, View view) {
        mainActivity.w5();
    }

    public final int C5() {
        int i = this.O;
        if (i <= 0 || i >= this.P.size()) {
            return -1;
        }
        int i4 = this.O - 1;
        this.O = i4;
        return i4;
    }

    public static final void C6(MainActivity mainActivity, View view) {
        B1 b12;
        if (UptodownApp.F.a0()) {
            mainActivity.s5(0);
            C0898y1 c0898y1 = mainActivity.f248r0;
            if (c0898y1 != null) {
                c0898y1.H();
            }
            TabLayout tabLayout = mainActivity.f245o0;
            Integer valueOf = tabLayout != null ? Integer.valueOf(tabLayout.getSelectedTabPosition()) : null;
            if (valueOf == null || valueOf.intValue() != 0) {
                if (valueOf == null || valueOf.intValue() != 1 || (b12 = mainActivity.f246p0) == null) {
                    return;
                }
                b12.y();
                return;
            }
            TabLayout tabLayout2 = mainActivity.W;
            if (tabLayout2 == null || tabLayout2.getSelectedTabPosition() != 0) {
                TabLayout tabLayout3 = mainActivity.W;
                kotlin.jvm.internal.m.b(tabLayout3);
                TabLayout tabLayout4 = mainActivity.W;
                kotlin.jvm.internal.m.b(tabLayout4);
                tabLayout3.selectTab(tabLayout4.getTabAt(0));
            }
        }
    }

    public final void C7() {
        AppBarLayout appBarLayout = this.T;
        kotlin.jvm.internal.m.b(appBarLayout);
        appBarLayout.setVisibility(0);
        AppBarLayout appBarLayout2 = this.T;
        kotlin.jvm.internal.m.b(appBarLayout2);
        appBarLayout2.setExpanded(true);
        TabLayout tabLayout = this.f245o0;
        kotlin.jvm.internal.m.b(tabLayout);
        int selectedTabPosition = tabLayout.getSelectedTabPosition();
        if (selectedTabPosition == 2 || selectedTabPosition == 3) {
            return;
        }
        TabLayout tabLayout2 = this.W;
        kotlin.jvm.internal.m.b(tabLayout2);
        tabLayout2.setVisibility(0);
    }

    public final Object D5(V2.d dVar) {
        Object g = o3.g.g(o3.Y.b(), new C0739i(null), dVar);
        return g == W2.b.c() ? g : R2.s.a;
    }

    public static final void D6(MainActivity mainActivity, View view) {
        mainActivity.startActivity(new Intent((Context) mainActivity, (Class<?>) SearchActivity.class), UptodownApp.F.a(mainActivity));
        mainActivity.P5();
    }

    private final void D7() {
        if (isFinishing()) {
            return;
        }
        M0 c = M0.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        TextView textView = c.f;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        float height = c.f.getHeight();
        int color = ContextCompat.getColor(this, 2131100666);
        int color2 = ContextCompat.getColor(this, 2131100665);
        TextPaint paint = c.f.getPaint();
        Float valueOf = paint != null ? Float.valueOf(paint.measureText(c.f.getText().toString())) : null;
        kotlin.jvm.internal.m.b(valueOf);
        LinearGradient linearGradient = new LinearGradient(0.0f, 0.0f, valueOf.floatValue(), height, new int[]{color, color2}, new float[]{0.0f, 1.0f}, Shader.TileMode.CLAMP);
        TextPaint paint2 = c.f.getPaint();
        if (paint2 != null) {
            paint2.setShader(linearGradient);
        }
        float dimension = getResources().getDimension(2131166338);
        int i = getResources().getDisplayMetrics().widthPixels;
        float dimension2 = getResources().getDimension(2131166019);
        float f = (i - dimension2) - dimension2;
        if (dimension > f) {
            int i4 = (int) f;
            c.d.setMaxWidth(i4);
            c.e.setMaxWidth(i4);
        }
        c.d.setTypeface(aVar.x());
        String obj = c.d.getText().toString();
        List<C0963n> e = C0963n.f.e(obj, "\\[xx](.*?)\\[/xx]");
        SpannableString spannableString = new SpannableString(new m3.j("\\[xx](.*?)\\[/xx]").f(obj, new d3.l() {
            @Override
            public final Object invoke(Object obj2) {
                CharSequence E7;
                E7 = MainActivity.E7((m3.h) obj2);
                return E7;
            }
        }));
        for (C0963n c0963n : e) {
            int L = m3.m.L(spannableString, c0963n.d(), 0, false, 6, null);
            int length = c0963n.d().length() + L;
            if (L >= 0) {
                spannableString.setSpan(new D(), L, length, 33);
            }
        }
        c.d.setText(spannableString);
        c.e.setTypeface(N1.k.g.w());
        c.b.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.F7(MainActivity.this, view);
            }
        });
        c.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.G7(MainActivity.this, view);
            }
        });
        Locale locale = Locale.getDefault();
        kotlin.jvm.internal.m.d(locale, "getDefault(...)");
        if (TextUtils.getLayoutDirectionFromLocale(locale) == 1) {
            c.c.setCropType(0);
        }
        c.c.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.H7(view);
            }
        });
        FrameLayout frameLayout = this.f255y0;
        kotlin.jvm.internal.m.b(frameLayout);
        frameLayout.addView(c.getRoot());
        y2.n nVar = new y2.n(this);
        RelativeLayout root = c.getRoot();
        kotlin.jvm.internal.m.d(root, "getRoot(...)");
        nVar.i(root, 2130772023);
        com.uptodown.activities.preferences.a.a.g1(this, System.currentTimeMillis());
    }

    public static final void E6(MainActivity mainActivity, View view) {
        mainActivity.Z2();
    }

    public static final CharSequence E7(m3.h it) {
        kotlin.jvm.internal.m.e(it, "it");
        return (CharSequence) it.a().get(1);
    }

    public static final void F6(final MainActivity mainActivity) {
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public final void run() {
                MainActivity.G6(MainActivity.this);
            }
        }, AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS);
    }

    public static final void F7(MainActivity mainActivity, View view) {
        mainActivity.O5();
    }

    public static final void G6(MainActivity mainActivity) {
        ProgressBar progressBar = (ProgressBar) mainActivity.findViewById(2131363040);
        if (progressBar != null) {
            progressBar.setVisibility(0);
        }
    }

    public static final void G7(MainActivity mainActivity, View view) {
        mainActivity.O5();
        mainActivity.Z2();
    }

    public final int H5() {
        int i = this.O;
        if (i < 0 || i >= this.P.size() - 1) {
            return -1;
        }
        int i4 = this.O + 1;
        this.O = i4;
        return i4;
    }

    public static final void H6(MainActivity mainActivity, ActivityResult activityResult) {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(mainActivity), o3.Y.b(), (o3.L) null, mainActivity.new p(mainActivity.new q(), null), 2, (Object) null);
    }

    public static final void H7(View view) {
    }

    public static final R2.s I6(MainActivity mainActivity, String packageName) {
        kotlin.jvm.internal.m.e(packageName, "packageName");
        C0898y1 c0898y1 = mainActivity.f248r0;
        if (c0898y1 != null) {
            kotlin.jvm.internal.m.b(c0898y1);
            if (c0898y1.isAdded()) {
                C0898y1 c0898y12 = mainActivity.f248r0;
                kotlin.jvm.internal.m.b(c0898y12);
                c0898y12.I(packageName);
            }
        }
        B1 b12 = mainActivity.f246p0;
        if (b12 != null) {
            kotlin.jvm.internal.m.b(b12);
            if (b12.isAdded()) {
                B1 b13 = mainActivity.f246p0;
                kotlin.jvm.internal.m.b(b13);
                b13.z(packageName);
            }
        }
        K1 k12 = mainActivity.f247q0;
        if (k12 != null) {
            kotlin.jvm.internal.m.b(k12);
            if (k12.isAdded()) {
                K1 k13 = mainActivity.f247q0;
                kotlin.jvm.internal.m.b(k13);
                k13.Z(packageName);
            }
        }
        ArrayList arrayList = mainActivity.f251u0;
        int size = arrayList.size();
        int i = 0;
        while (i < size) {
            Object obj = arrayList.get(i);
            i++;
            ((B1) obj).z(packageName);
        }
        return R2.s.a;
    }

    private final Bitmap J5(Bitmap bitmap, int i) {
        Bitmap createBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
        kotlin.jvm.internal.m.d(createBitmap, "createBitmap(...)");
        Canvas canvas = new Canvas(createBitmap);
        Paint paint = new Paint();
        Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
        RectF rectF = new RectF(rect);
        float f = i;
        paint.setAntiAlias(true);
        canvas.drawRoundRect(rectF, f, f, paint);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        canvas.drawBitmap(bitmap, rect, rect, paint);
        return createBitmap;
    }

    public final void J6(long j4, long j5, String str, long j6) {
        P5();
        if (j4 <= 0) {
            F2();
        } else if (this.f252v0 == -1) {
            this.f252v0 = j4;
            new C0560i(this, j4, new s(j5, j6, str, this), LifecycleOwnerKt.getLifecycleScope(this));
        }
    }

    public static final void J7(MainActivity mainActivity, View view) {
        AlertDialog k22 = mainActivity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    private final void K6() {
        this.f238C0.launch(new Intent((Context) this, (Class<?>) GdprPrivacySettings.class), UptodownApp.F.b(this));
    }

    private final void K7() {
        String F3 = com.uptodown.activities.preferences.a.a.F(this);
        if (F3 == null) {
            F3 = "https://uptodown-android.uptodown.com/android";
        }
        startActivity(new Intent("android.intent.action.VIEW", Uri.parse(F3)));
    }

    public final void L5() {
        RelativeLayout relativeLayout = this.N;
        if (relativeLayout != null) {
            if (relativeLayout != null) {
                relativeLayout.removeAllViews();
            }
            RelativeLayout relativeLayout2 = this.N;
            if (relativeLayout2 != null) {
                relativeLayout2.setVisibility(8);
            }
            this.N = null;
        }
    }

    private final void L6() {
        startActivity(new Intent((Context) this, (Class<?>) MyApps.class), UptodownApp.F.a(this));
    }

    private final Bitmap L7() {
        View rootView = getWindow().getDecorView().getRootView();
        Bitmap createBitmap = Bitmap.createBitmap(rootView.getWidth(), rootView.getHeight(), Bitmap.Config.ARGB_8888);
        kotlin.jvm.internal.m.d(createBitmap, "createBitmap(...)");
        rootView.draw(new Canvas(createBitmap));
        float applyDimension = TypedValue.applyDimension(1, 10.0f, getResources().getDisplayMetrics());
        Bitmap createScaledBitmap = Bitmap.createScaledBitmap(createBitmap, rootView.getWidth() / 2, rootView.getHeight() / 2, true);
        kotlin.jvm.internal.m.d(createScaledBitmap, "createScaledBitmap(...)");
        return J5(createScaledBitmap, (int) applyDimension);
    }

    public final void M5() {
        AppBarLayout appBarLayout = this.T;
        kotlin.jvm.internal.m.b(appBarLayout);
        appBarLayout.setVisibility(0);
        AppBarLayout appBarLayout2 = this.T;
        kotlin.jvm.internal.m.b(appBarLayout2);
        appBarLayout2.setExpanded(false);
        TabLayout tabLayout = this.W;
        kotlin.jvm.internal.m.b(tabLayout);
        tabLayout.setVisibility(8);
    }

    private final void M6() {
        startActivity(new Intent((Context) this, (Class<?>) MyDownloads.class), UptodownApp.F.a(this));
    }

    private final void N5() {
        AppBarLayout appBarLayout = this.T;
        kotlin.jvm.internal.m.b(appBarLayout);
        appBarLayout.setVisibility(8);
        TabLayout tabLayout = this.W;
        kotlin.jvm.internal.m.b(tabLayout);
        tabLayout.setVisibility(8);
    }

    private final void N6() {
        String string = getString(2131952691);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        String string2 = getString(2131952794);
        kotlin.jvm.internal.m.d(string2, "getString(...)");
        new u2.p().p(this, string2, string);
    }

    private final void O5() {
        FrameLayout frameLayout = this.f255y0;
        if (frameLayout != null) {
            kotlin.jvm.internal.m.b(frameLayout);
            if (frameLayout.getChildCount() != 0) {
                y2.n nVar = new y2.n(this);
                FrameLayout frameLayout2 = this.f255y0;
                kotlin.jvm.internal.m.b(frameLayout2);
                nVar.g(frameLayout2, 2130772024, new k());
            }
        }
    }

    private final void O6() {
        this.f239D0.launch(new Intent((Context) this, (Class<?>) PreferencesActivity.class), UptodownApp.F.b(this));
    }

    private final void P5() {
        w5();
        O5();
    }

    private final void P6() {
        startActivity(new Intent((Context) this, (Class<?>) Updates.class), UptodownApp.F.a(this));
    }

    public final void P7(int i, C0965p c0965p) {
        Fragment G5 = G5();
        if (G5 instanceof C0837m1) {
            runOnUiThread(((C0837m1) G5).new RunnableC0841d(i, c0965p));
        } else if (G5 instanceof v2) {
            ((v2) G5).M0();
        }
    }

    private final void Q5() {
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        String b = c0191a.b(this);
        if (b != null) {
            C0955f c0955f = new C0955f();
            c0955f.O0(Long.parseLong(b));
            a3(c0955f);
            c0191a.n0(this, null);
            return;
        }
        if (c0191a.h0(this)) {
            return;
        }
        c0191a.b1(this, System.currentTimeMillis());
        RelativeLayout relativeLayout = this.R;
        kotlin.jvm.internal.m.b(relativeLayout);
        relativeLayout.setVisibility(0);
        RelativeLayout relativeLayout2 = this.R;
        kotlin.jvm.internal.m.b(relativeLayout2);
        relativeLayout2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.R5(view);
            }
        });
        if (S()) {
            O1();
        } else {
            m0();
        }
        if (c0191a.i0(1, this) && c0191a.P(this)) {
            a6();
            if (!c0191a.i0(4, this)) {
                n6();
            }
            if (!c0191a.i0(5, this)) {
                if (g2.S.m.e(this) != null) {
                    c0191a.m1(this, 5);
                } else {
                    i6();
                }
            }
        } else {
            u6();
        }
        this.O = 0;
        Object obj = this.P.get(0);
        kotlin.jvm.internal.m.d(obj, "get(...)");
        f7((g2.Y) obj);
    }

    public static final void R5(View view) {
    }

    public final void R6() {
        if (Z5()) {
            return;
        }
        v5();
        I7();
    }

    public static final void S5(MainActivity mainActivity, ActivityResult activityResult) {
        Bundle extras;
        if (activityResult.getResultCode() == 10) {
            Intent data = activityResult.getData();
            String string = (data == null || (extras = data.getExtras()) == null) ? null : extras.getString("realPath");
            if (string == null || string.length() == 0) {
                return;
            }
            AbstractC0740a.z2(mainActivity, new File(string), null, 2, null);
        }
    }

    public final void S6() {
        if (Z5()) {
            Iterator it = this.P.iterator();
            kotlin.jvm.internal.m.d(it, "iterator(...)");
            while (it.hasNext()) {
                Object next = it.next();
                kotlin.jvm.internal.m.d(next, "next(...)");
                ((g2.Y) next).c().removeAllViews();
            }
            RelativeLayout relativeLayout = this.R;
            if (relativeLayout != null) {
                relativeLayout.setVisibility(8);
            }
            RelativeLayout relativeLayout2 = this.R;
            if (relativeLayout2 != null) {
                relativeLayout2.removeAllViews();
            }
            this.R = null;
            a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
            boolean i0 = c0191a.i0(4, this);
            boolean i02 = c0191a.i0(5, this);
            if (i0 && i02) {
                c0191a.l1(this, true);
            }
            R6();
        }
    }

    public final Object S7(V2.d dVar) {
        Object g = o3.g.g(o3.Y.b(), new G(new kotlin.jvm.internal.A(), new kotlin.jvm.internal.A(), null), dVar);
        return g == W2.b.c() ? g : R2.s.a;
    }

    private final boolean T5() {
        TextView textView = (TextView) findViewById(2131364241);
        return textView != null && textView.getVisibility() == 0;
    }

    public final boolean U5() {
        return (T5() || X5()) ? false : true;
    }

    private final void V6() {
        if (this.N != null) {
            y2.n nVar = new y2.n(this);
            RelativeLayout relativeLayout = this.N;
            kotlin.jvm.internal.m.b(relativeLayout);
            nVar.g(relativeLayout, 2130771998, new u());
        }
    }

    private final boolean W5() {
        return ContextCompat.checkSelfPermission(this, "android.permission.POST_NOTIFICATIONS") == 0;
    }

    private final void W6() {
        int i;
        if (isFinishing() || this.R == null || com.uptodown.activities.preferences.a.a.h0(this)) {
            S6();
            return;
        }
        RelativeLayout relativeLayout = this.R;
        kotlin.jvm.internal.m.b(relativeLayout);
        relativeLayout.setVisibility(0);
        RelativeLayout relativeLayout2 = this.R;
        kotlin.jvm.internal.m.b(relativeLayout2);
        relativeLayout2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.X6(view);
            }
        });
        Iterator it = this.P.iterator();
        kotlin.jvm.internal.m.d(it, "iterator(...)");
        while (it.hasNext()) {
            Object next = it.next();
            kotlin.jvm.internal.m.d(next, "next(...)");
            g2.Y y3 = (g2.Y) next;
            int a = y3.a();
            if (a == 1) {
                y3.e(v6());
            } else if (a == 2) {
                C0955f c0955f = this.X;
                if (c0955f != null) {
                    kotlin.jvm.internal.m.b(c0955f);
                    y3.e(e6(c0955f));
                }
            } else if (a == 3) {
                y3.e(b6());
            } else if (a == 4) {
                y3.e(o6());
            } else if (a == 5) {
                y3.e(j6());
            }
        }
        if (this.P.size() <= 0 || (i = this.O) < 0 || i >= this.P.size()) {
            S6();
            return;
        }
        Object obj = this.P.get(this.O);
        kotlin.jvm.internal.m.d(obj, "get(...)");
        f7((g2.Y) obj);
    }

    private final boolean X5() {
        TextView textView = (TextView) findViewById(2131363923);
        return textView != null && textView.getVisibility() == 0;
    }

    public static final void X6(View view) {
    }

    private final boolean Y5() {
        File n4 = new u2.p().n(this);
        if (com.uptodown.activities.preferences.a.a.d0(this)) {
            b7();
            return true;
        }
        if (n4 == null) {
            return false;
        }
        h7();
        return true;
    }

    public final void Y6() {
        ProgressBar progressBar = this.f244n0;
        if (progressBar != null) {
            kotlin.jvm.internal.m.b(progressBar);
            if (progressBar.getVisibility() != 0) {
                ProgressBar progressBar2 = this.f244n0;
                kotlin.jvm.internal.m.b(progressBar2);
                progressBar2.setVisibility(0);
                o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.b(), (o3.L) null, new v(null), 2, (Object) null);
                C0898y1 c0898y1 = this.f248r0;
                if (c0898y1 != null) {
                    c0898y1.C();
                }
                B1 b12 = this.f246p0;
                if (b12 != null) {
                    b12.x();
                }
                K1 k12 = this.f247q0;
                if (k12 != null) {
                    k12.L();
                }
            }
        }
    }

    public final void Y7() {
        if (this.R == null || this.O < 0) {
            return;
        }
        int size = this.P.size();
        int i = this.O;
        if (size > i && ((g2.Y) this.P.get(i)).a() == 4 && U() && T()) {
            ((TextView) findViewById(2131363967)).setBackground(ContextCompat.getDrawable(this, 2131231288));
            ((TextView) findViewById(2131363967)).setTextColor(ContextCompat.getColor(this, 2131100644));
        }
    }

    private final boolean Z5() {
        RelativeLayout relativeLayout = this.R;
        if (relativeLayout == null) {
            return false;
        }
        kotlin.jvm.internal.m.b(relativeLayout);
        if (relativeLayout.getVisibility() != 0) {
            return false;
        }
        RelativeLayout relativeLayout2 = this.R;
        kotlin.jvm.internal.m.b(relativeLayout2);
        return relativeLayout2.getChildCount() != 0;
    }

    private final void Z6() {
        x xVar = new x(getSupportFragmentManager(), getLifecycle());
        ViewPager2 viewPager2 = this.Y;
        if (viewPager2 != null) {
            viewPager2.setAdapter(xVar);
        }
        TabLayout tabLayout = this.f245o0;
        if (tabLayout == null || this.Y == null) {
            return;
        }
        kotlin.jvm.internal.m.b(tabLayout);
        ViewPager2 viewPager22 = this.Y;
        kotlin.jvm.internal.m.b(viewPager22);
        new TabLayoutMediator(tabLayout, viewPager22, new TabLayoutMediator.TabConfigurationStrategy() {
            @Override
            public final void onConfigureTab(TabLayout.Tab tab, int i) {
                MainActivity.a7(MainActivity.this, tab, i);
            }
        }).attach();
        TabLayout tabLayout2 = this.f245o0;
        kotlin.jvm.internal.m.b(tabLayout2);
        tabLayout2.addOnTabSelectedListener((TabLayout.OnTabSelectedListener) new w());
    }

    private final void Z7() {
        TextView textView = (TextView) findViewById(2131363581);
        if (textView != null) {
            textView.setBackground(ContextCompat.getDrawable(this, 2131231288));
        }
        if (textView != null) {
            textView.setEnabled(true);
        }
        ((ProgressBar) findViewById(2131363042)).setVisibility(8);
    }

    private final void a6() {
        o5(b6(), 3);
    }

    public static final void a7(MainActivity mainActivity, TabLayout.Tab tab, int i) {
        kotlin.jvm.internal.m.e(tab, "tab");
        if (i == 0) {
            tab.setContentDescription(mainActivity.getString(2131951769));
            mainActivity.e7(2131231275, tab);
            return;
        }
        if (i == 1) {
            tab.setContentDescription(mainActivity.getString(2131952689));
            mainActivity.e7(2131231274, tab);
        } else if (i == 2) {
            tab.setContentDescription(mainActivity.getString(2131952688));
            mainActivity.e7(2131231276, tab);
        } else {
            if (i != 3) {
                return;
            }
            tab.setContentDescription(mainActivity.getString(2131952522));
            mainActivity.e7(2131231573, tab);
        }
    }

    private final RelativeLayout b6() {
        View inflate = LayoutInflater.from(this).inflate(2131558897, (ViewGroup) this.R, false);
        kotlin.jvm.internal.m.c(inflate, "null cannot be cast to non-null type android.widget.RelativeLayout");
        RelativeLayout relativeLayout = (RelativeLayout) inflate;
        TextView textView = (TextView) relativeLayout.findViewById(2131364421);
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.x());
        ((TextView) relativeLayout.findViewById(2131363614)).setTypeface(aVar.w());
        ((TextView) relativeLayout.findViewById(2131363674)).setTypeface(aVar.x());
        TextView textView2 = (TextView) relativeLayout.findViewById(2131363966);
        textView2.setTypeface(aVar.w());
        textView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.c6(MainActivity.this, view);
            }
        });
        return relativeLayout;
    }

    private final void b7() {
        setContentView(2131558831);
        TextView textView = (TextView) findViewById(2131363923);
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.x());
        textView.setText(u2.I.a.d(getString(2131952316)));
        TextView textView2 = (TextView) findViewById(2131364347);
        textView2.setTypeface(aVar.x());
        textView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.c7(MainActivity.this, view);
            }
        });
    }

    public static final void b8(View view) {
    }

    public static final void c6(MainActivity mainActivity, View view) {
        mainActivity.q5();
    }

    public static final void c7(MainActivity mainActivity, View view) {
        File n4 = new u2.p().n(mainActivity);
        if (n4 != null) {
            UptodownApp.a.Y(UptodownApp.F, n4, mainActivity, null, 4, null);
        } else {
            mainActivity.K7();
        }
    }

    private final void d6(C0955f c0955f) {
        this.X = c0955f;
        o5(e6(c0955f), 2);
    }

    public final void d7(Drawable drawable, boolean z3) {
        TabLayout.Tab tabAt;
        View inflate = getLayoutInflater().inflate(2131558834, (ViewGroup) null);
        if (inflate != null) {
            if (drawable != null) {
                View findViewById = inflate.findViewById(2131362282);
                kotlin.jvm.internal.m.d(findViewById, "findViewById(...)");
                ((ImageView) findViewById).setImageDrawable(drawable);
            }
            View findViewById2 = inflate.findViewById(2131362287);
            kotlin.jvm.internal.m.d(findViewById2, "findViewById(...)");
            ImageView imageView = (ImageView) findViewById2;
            if (z3) {
                imageView.setVisibility(0);
            } else {
                imageView.setVisibility(8);
            }
            TabLayout tabLayout = this.f245o0;
            if (tabLayout == null || (tabAt = tabLayout.getTabAt(3)) == null) {
                return;
            }
            tabAt.setCustomView(inflate);
        }
    }

    private final RelativeLayout e6(C0955f c0955f) {
        View inflate = LayoutInflater.from(this).inflate(2131558898, (ViewGroup) this.R, false);
        kotlin.jvm.internal.m.c(inflate, "null cannot be cast to non-null type android.widget.RelativeLayout");
        RelativeLayout relativeLayout = (RelativeLayout) inflate;
        ImageView imageView = (ImageView) relativeLayout.findViewById(2131362330);
        ImageView imageView2 = (ImageView) relativeLayout.findViewById(2131362390);
        RelativeLayout relativeLayout2 = (RelativeLayout) relativeLayout.findViewById(2131363188);
        LinearLayout linearLayout = (LinearLayout) relativeLayout.findViewById(2131362616);
        com.squareup.picasso.s.h().l(c0955f.F()).n(UptodownApp.F.h0(this)).i(imageView2);
        com.squareup.picasso.s.h().l(c0955f.z()).j(imageView, new l(relativeLayout2, linearLayout, this));
        TextView textView = (TextView) relativeLayout.findViewById(2131363938);
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.x());
        u.a aVar2 = u2.u.b;
        String string = getString(2131952856, c0955f.M());
        kotlin.jvm.internal.m.d(string, "getString(...)");
        Typeface w3 = aVar.w();
        kotlin.jvm.internal.m.b(w3);
        textView.setText(aVar2.a(string, w3));
        ((TextView) relativeLayout.findViewById(2131363615)).setTypeface(aVar.w());
        ((TextView) relativeLayout.findViewById(2131364422)).setTypeface(aVar.x());
        ((TextView) relativeLayout.findViewById(2131364232)).setTypeface(aVar.w());
        ((TextView) relativeLayout.findViewById(2131364232)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.f6(MainActivity.this, view);
            }
        });
        ((TextView) relativeLayout.findViewById(2131364078)).setTypeface(aVar.w());
        ((TextView) relativeLayout.findViewById(2131364078)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.g6(MainActivity.this, view);
            }
        });
        TextView textView2 = (TextView) relativeLayout.findViewById(2131363579);
        textView2.setTypeface(aVar.w());
        textView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.h6(MainActivity.this, view);
            }
        });
        return relativeLayout;
    }

    private final void e7(int i, TabLayout.Tab tab) {
        View inflate = getLayoutInflater().inflate(2131558834, (ViewGroup) null);
        View findViewById = inflate.findViewById(2131362282);
        kotlin.jvm.internal.m.d(findViewById, "findViewById(...)");
        ((ImageView) findViewById).setImageDrawable(ContextCompat.getDrawable(this, i));
        ((ImageView) inflate.findViewById(2131362287)).setVisibility(8);
        tab.setCustomView(inflate);
    }

    public static final void f6(MainActivity mainActivity, View view) {
        mainActivity.N6();
    }

    public final void f7(g2.Y y3) {
        RelativeLayout relativeLayout = this.R;
        kotlin.jvm.internal.m.b(relativeLayout);
        relativeLayout.removeAllViews();
        RelativeLayout relativeLayout2 = this.R;
        kotlin.jvm.internal.m.b(relativeLayout2);
        relativeLayout2.addView(y3.c());
        z6(y3.b());
    }

    private final boolean f8(Intent intent) {
        return (intent.getFlags() & ExtractorMediaSource.DEFAULT_LOADING_CHECK_INTERVAL_BYTES) == 1048576;
    }

    public static final void g6(MainActivity mainActivity, View view) {
        mainActivity.K6();
    }

    public static final void g7(MainActivity mainActivity, ActivityResult activityResult) {
        int resultCode = activityResult.getResultCode();
        if (resultCode != 1003) {
            if (resultCode != 1004) {
                mainActivity.r2();
                return;
            }
            UptodownApp.F.e(mainActivity);
            mainActivity.finish();
            mainActivity.startActivity(mainActivity.getIntent());
            return;
        }
        u2.v a = u2.v.v.a(mainActivity);
        a.a();
        a.p();
        a.i();
        mainActivity.finish();
        mainActivity.startActivity(mainActivity.getIntent());
    }

    public static final void h6(MainActivity mainActivity, View view) {
        mainActivity.y4();
    }

    private final void h7() {
        C0965p a;
        u2.v a4 = u2.v.v.a(this);
        a4.a();
        String packageName = getPackageName();
        kotlin.jvm.internal.m.d(packageName, "getPackageName(...)");
        g2.P C02 = a4.C0(packageName);
        a4.i();
        if (C02 == null || 680 >= C02.j() || (a = C02.a()) == null || !a.f()) {
            return;
        }
        setContentView(2131558485);
        TextView textView = (TextView) findViewById(2131364241);
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        ((TextView) findViewById(2131363711)).setTypeface(aVar.x());
        ((TextView) findViewById(2131363830)).setTypeface(aVar.x());
        TextView textView2 = (TextView) findViewById(2131363840);
        textView2.setTypeface(aVar.x());
        PackageManager packageManager = getPackageManager();
        kotlin.jvm.internal.m.d(packageManager, "getPackageManager(...)");
        String packageName2 = getPackageName();
        kotlin.jvm.internal.m.d(packageName2, "getPackageName(...)");
        textView2.setText(getString(2131951712, W1.s.d(packageManager, packageName2, 0).versionName));
        TextView textView3 = (TextView) findViewById(2131364348);
        textView3.setTypeface(aVar.w());
        textView3.setText(getString(2131951714, C02.k()));
        TextView textView4 = (TextView) findViewById(2131364346);
        textView4.setTypeface(aVar.x());
        if (C02.a() != null) {
            W1.i iVar = new W1.i();
            C0965p a5 = C02.a();
            kotlin.jvm.internal.m.b(a5);
            textView4.setText(getString(2131951713, iVar.d(a5.z(), this)));
        }
        RelativeLayout relativeLayout = (RelativeLayout) findViewById(2131363275);
        ((TextView) findViewById(2131364357)).setTypeface(aVar.x());
        final ImageView imageView = (ImageView) findViewById(2131362477);
        final TextView textView5 = (TextView) findViewById(2131364356);
        textView5.setTypeface(aVar.x());
        new C0561j(this, C02.h(), new y(textView5, this, C02), LifecycleOwnerKt.getLifecycleScope(this));
        relativeLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.i7(textView5, imageView, view);
            }
        });
        ((TextView) findViewById(2131364342)).setTypeface(aVar.w());
        ((RelativeLayout) findViewById(2131363270)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.j7(MainActivity.this, view);
            }
        });
        ((TextView) findViewById(N1.f.f139u0)).setTypeface(aVar.w());
        ((RelativeLayout) findViewById(2131363137)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.k7(MainActivity.this, view);
            }
        });
    }

    private final void i6() {
        o5(j6(), 5);
    }

    public static final void i7(TextView textView, ImageView imageView, View view) {
        kotlin.jvm.internal.m.b(textView);
        if (textView.getVisibility() == 0) {
            textView.setVisibility(8);
            imageView.setScaleY(1.0f);
        } else {
            textView.setVisibility(0);
            imageView.setScaleY(-1.0f);
        }
    }

    private final RelativeLayout j6() {
        View inflate = LayoutInflater.from(this).inflate(2131558901, (ViewGroup) this.R, false);
        kotlin.jvm.internal.m.c(inflate, "null cannot be cast to non-null type android.widget.RelativeLayout");
        RelativeLayout relativeLayout = (RelativeLayout) inflate;
        RelativeLayout relativeLayout2 = (RelativeLayout) relativeLayout.findViewById(2131363193);
        if (relativeLayout2 != null) {
            ((TextView) relativeLayout2.findViewById(2131364265)).setTypeface(N1.k.g.w());
        }
        TextView textView = (TextView) relativeLayout.findViewById(2131364294);
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        RelativeLayout relativeLayout3 = (RelativeLayout) relativeLayout.findViewById(2131363210);
        if (UptodownApp.F.Q()) {
            relativeLayout3.setVisibility(8);
        } else {
            ((TextView) relativeLayout.findViewById(2131363888)).setTypeface(aVar.w());
            relativeLayout3.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.k6(MainActivity.this, view);
                }
            });
        }
        TextView textView2 = (TextView) relativeLayout.findViewById(2131363886);
        textView2.setTypeface(aVar.w());
        textView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.l6(MainActivity.this, view);
            }
        });
        ((TextView) relativeLayout.findViewById(2131363885)).setTypeface(aVar.x());
        ((TextView) relativeLayout.findViewById(2131363885)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.m6(MainActivity.this, view);
            }
        });
        return relativeLayout;
    }

    public static final void j7(MainActivity mainActivity, View view) {
        try {
            File n4 = new u2.p().n(mainActivity);
            if (n4 == null || !n4.exists()) {
                mainActivity.U6();
            } else {
                mainActivity.T1(n4);
            }
        } catch (Exception unused) {
            mainActivity.K7();
        }
    }

    public static final void k6(MainActivity mainActivity, View view) {
        mainActivity.o3();
    }

    public static final void k7(MainActivity mainActivity, View view) {
        mainActivity.finish();
    }

    public static final void l6(MainActivity mainActivity, View view) {
        mainActivity.f240E0.launch(new Intent((Context) mainActivity, (Class<?>) LoginActivity.class), UptodownApp.F.b(mainActivity));
    }

    private final void l7() {
        ArrayList a = new u2.y().a();
        if (a.isEmpty() || isFinishing()) {
            return;
        }
        AlertDialog k22 = k2();
        if (k22 != null) {
            k22.dismiss();
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        C0591l c = C0591l.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        final ArrayList arrayList = new ArrayList();
        A a4 = new A(c, arrayList, this);
        Iterator it = a.iterator();
        kotlin.jvm.internal.m.d(it, "iterator(...)");
        while (it.hasNext()) {
            Object next = it.next();
            kotlin.jvm.internal.m.d(next, "next(...)");
            new C0561j(this, (String) next, a4, LifecycleOwnerKt.getLifecycleScope(this));
        }
        TextView textView = c.g;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        c.e.setTypeface(aVar.w());
        c.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.m7(MainActivity.this, view);
            }
        });
        c.f.setTypeface(aVar.w());
        c.f.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.n7(MainActivity.this, arrayList, view);
            }
        });
        builder.setView(c.getRoot());
        builder.setCancelable(true);
        K2(builder.create());
        if (isFinishing() || k2() == null) {
            return;
        }
        AlertDialog k23 = k2();
        kotlin.jvm.internal.m.b(k23);
        Window window = k23.getWindow();
        if (window != null) {
            window.setBackgroundDrawable(new ColorDrawable(0));
        }
        AlertDialog k24 = k2();
        kotlin.jvm.internal.m.b(k24);
        k24.show();
        com.uptodown.activities.preferences.a.a.k1(this, true);
    }

    public static final void m6(MainActivity mainActivity, View view) {
        mainActivity.q5();
    }

    public static final void m7(MainActivity mainActivity, View view) {
        AlertDialog k22 = mainActivity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    private final void n6() {
        o5(o6(), 4);
    }

    public static final void n7(final MainActivity mainActivity, ArrayList arrayList, View view) {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(mainActivity), o3.Y.b(), (o3.L) null, new z(arrayList, mainActivity, null), 2, (Object) null).i(new d3.l() {
            @Override
            public final Object invoke(Object obj) {
                R2.s o7;
                o7 = MainActivity.o7(MainActivity.this, (Throwable) obj);
                return o7;
            }
        });
        AlertDialog k22 = mainActivity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    private final void o5(RelativeLayout relativeLayout, int i) {
        g2.Y y3 = new g2.Y();
        y3.d(i);
        y3.e(relativeLayout);
        this.P.add(y3);
    }

    private final RelativeLayout o6() {
        View inflate = LayoutInflater.from(this).inflate(2131558902, (ViewGroup) this.R, false);
        kotlin.jvm.internal.m.c(inflate, "null cannot be cast to non-null type android.widget.RelativeLayout");
        RelativeLayout relativeLayout = (RelativeLayout) inflate;
        RelativeLayout relativeLayout2 = (RelativeLayout) relativeLayout.findViewById(2131363194);
        if (relativeLayout2 != null) {
            ((TextView) relativeLayout2.findViewById(2131364265)).setTypeface(N1.k.g.w());
        }
        TextView textView = (TextView) relativeLayout.findViewById(2131364295);
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        RelativeLayout relativeLayout3 = (RelativeLayout) relativeLayout.findViewById(2131363230);
        if (Build.VERSION.SDK_INT >= 33) {
            ((TextView) relativeLayout.findViewById(2131364000)).setTypeface(aVar.w());
            ((TextView) relativeLayout.findViewById(2131363999)).setTypeface(aVar.x());
            SwitchCompat findViewById = relativeLayout.findViewById(2131363359);
            this.V = findViewById;
            kotlin.jvm.internal.m.b(findViewById);
            findViewById.setChecked(W5());
            SwitchCompat switchCompat = this.V;
            kotlin.jvm.internal.m.b(switchCompat);
            switchCompat.setClickable(false);
            relativeLayout3.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.p6(MainActivity.this, view);
                }
            });
        } else if (relativeLayout3 != null) {
            relativeLayout3.setVisibility(8);
        }
        RelativeLayout relativeLayout4 = (RelativeLayout) relativeLayout.findViewById(2131363269);
        ((ScrollableTextView) relativeLayout.findViewById(2131364339)).setTypeface(aVar.w());
        ((TextView) relativeLayout.findViewById(2131364337)).setTypeface(aVar.w());
        TextView textView2 = (TextView) relativeLayout.findViewById(2131364338);
        textView2.setText(getString(N1.i.b0, getString(N1.i.b)));
        textView2.setTypeface(aVar.x());
        SwitchCompat findViewById2 = relativeLayout.findViewById(2131363361);
        this.U = findViewById2;
        kotlin.jvm.internal.m.b(findViewById2);
        findViewById2.setChecked(U());
        SwitchCompat switchCompat2 = this.U;
        kotlin.jvm.internal.m.b(switchCompat2);
        switchCompat2.setClickable(false);
        relativeLayout4.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.q6(MainActivity.this, view);
            }
        });
        if (relativeLayout3.getVisibility() == 8) {
            relativeLayout.findViewById(2131364455).setVisibility(4);
        }
        TextView textView3 = (TextView) relativeLayout.findViewById(2131363967);
        textView3.setTypeface(aVar.w());
        textView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.r6(MainActivity.this, view);
            }
        });
        TextView textView4 = (TextView) relativeLayout.findViewById(2131363632);
        textView4.setTypeface(aVar.w());
        textView4.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.s6(MainActivity.this, view);
            }
        });
        return relativeLayout;
    }

    public static final R2.s o7(MainActivity mainActivity, Throwable th) {
        mainActivity.M6();
        return R2.s.a;
    }

    public final void p5() {
        int i;
        if (this.Q || this.P.size() <= 0 || (i = this.O) < 0) {
            return;
        }
        new y2.n(this).g(((g2.Y) this.P.get(i)).c(), 2130772029, new AnimationAnimationListenerC0736f());
    }

    public static final void p6(MainActivity mainActivity, View view) {
        SwitchCompat switchCompat = mainActivity.V;
        if (switchCompat == null || switchCompat.isChecked()) {
            return;
        }
        mainActivity.j0();
    }

    private final void q5() {
        com.uptodown.activities.preferences.a.a.m1(this, ((g2.Y) this.P.get(this.O)).a());
        new y2.n(this).g(((g2.Y) this.P.get(this.O)).c(), 2130772033, new AnimationAnimationListenerC0737g());
    }

    public static final void q6(MainActivity mainActivity, View view) {
        SwitchCompat switchCompat = mainActivity.U;
        if (switchCompat == null || switchCompat.isChecked() || mainActivity.U()) {
            return;
        }
        mainActivity.l0();
    }

    public static final void q7(MainActivity mainActivity, View view) {
        mainActivity.L6();
    }

    private final void r5(C0955f c0955f, boolean z3) {
        C0837m1 a = C0837m1.n.a(c0955f);
        FragmentTransaction beginTransaction = getSupportFragmentManager().beginTransaction();
        kotlin.jvm.internal.m.d(beginTransaction, "beginTransaction(...)");
        if (findViewById(2131363225) == null) {
            String string = getString(2131952006);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            r0(string);
            return;
        }
        try {
            beginTransaction.replace(2131363225, a);
            beginTransaction.addToBackStack((String) null);
            if (z3) {
                beginTransaction.setTransition(4099);
            }
            if (isFinishing() || getSupportFragmentManager().isDestroyed()) {
                return;
            }
            beginTransaction.commitAllowingStateLoss();
        } catch (Exception e) {
            e.printStackTrace();
            String string2 = getString(2131952006);
            kotlin.jvm.internal.m.d(string2, "getString(...)");
            r0(string2);
        }
    }

    public static final void r6(MainActivity mainActivity, View view) {
        mainActivity.q5();
    }

    public static final void r7(MainActivity mainActivity, View view) {
        mainActivity.M6();
    }

    public static final void s6(MainActivity mainActivity, View view) {
        mainActivity.p5();
    }

    public static final void s7(MainActivity mainActivity, View view) {
        mainActivity.O6();
    }

    private final void t5() {
        long currentTimeMillis = System.currentTimeMillis();
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        if (currentTimeMillis - c0191a.z(this) >= TimeUnit.DAYS.toMillis(7L)) {
            c0191a.T0(this, System.currentTimeMillis());
            if (Build.VERSION.SDK_INT >= 33) {
                if (!W5()) {
                    x5();
                    return;
                }
            } else if (!c0191a.U(this)) {
                x5();
                return;
            }
        }
        y7();
    }

    private final void t6() {
        n6();
        i6();
    }

    public static final void t7(MainActivity mainActivity, View view) {
        mainActivity.Y6();
    }

    private final void u5() {
        if (u2.F.a.a(this)) {
            return;
        }
        u2.v a = u2.v.v.a(this);
        a.a();
        Q2(a.x0());
        a.i();
        for (int i = 0; o2().size() > 0 && i < 2; i++) {
            Object remove = o2().remove(0);
            kotlin.jvm.internal.m.d(remove, "removeAt(...)");
            H2((C0944E) remove);
        }
    }

    private final void u6() {
        o5(v6(), 1);
    }

    public static final void u7(View view) {
    }

    private final void v5() {
        g2.S e = g2.S.m.e(this);
        if ((e == null || !e.n()) && com.uptodown.activities.preferences.a.a.E(this) == 0) {
            D7();
        } else {
            t5();
            u5();
        }
    }

    private final RelativeLayout v6() {
        View inflate = LayoutInflater.from(this).inflate(2131558904, (ViewGroup) this.R, false);
        kotlin.jvm.internal.m.c(inflate, "null cannot be cast to non-null type android.widget.RelativeLayout");
        RelativeLayout relativeLayout = (RelativeLayout) inflate;
        TextView textView = (TextView) relativeLayout.findViewById(2131364423);
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.x());
        ((TextView) relativeLayout.findViewById(2131363616)).setTypeface(aVar.w());
        ((TextView) relativeLayout.findViewById(2131364202)).setTypeface(aVar.x());
        ((TextView) relativeLayout.findViewById(2131364233)).setTypeface(aVar.w());
        ((RelativeLayout) relativeLayout.findViewById(2131363264)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.w6(MainActivity.this, view);
            }
        });
        ((TextView) relativeLayout.findViewById(2131364079)).setTypeface(aVar.w());
        ((RelativeLayout) relativeLayout.findViewById(2131363238)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.x6(MainActivity.this, view);
            }
        });
        TextView textView2 = (TextView) relativeLayout.findViewById(2131363581);
        textView2.setTypeface(aVar.w());
        textView2.setEnabled(false);
        textView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.y6(MainActivity.this, view);
            }
        });
        ProgressBar progressBar = (ProgressBar) relativeLayout.findViewById(2131363042);
        if (!m2()) {
            progressBar.setVisibility(0);
            return relativeLayout;
        }
        textView2.setBackground(ContextCompat.getDrawable(this, 2131231288));
        textView2.setEnabled(true);
        progressBar.setVisibility(8);
        return relativeLayout;
    }

    public static final void v7(MainActivity mainActivity, View view) {
        mainActivity.P6();
    }

    private final void w5() {
        FrameLayout frameLayout = this.f253w0;
        if (frameLayout != null) {
            kotlin.jvm.internal.m.b(frameLayout);
            if (frameLayout.getChildCount() == 0 || this.f254x0 == null) {
                return;
            }
            y2.n nVar = new y2.n(this);
            F0 f0 = this.f254x0;
            kotlin.jvm.internal.m.b(f0);
            RelativeLayout root = f0.getRoot();
            kotlin.jvm.internal.m.d(root, "getRoot(...)");
            nVar.g(root, 2130772034, new AnimationAnimationListenerC0738h());
        }
    }

    public static final void w6(MainActivity mainActivity, View view) {
        mainActivity.N6();
    }

    public static final void w7(View view) {
    }

    private final void x5() {
        if (isFinishing()) {
            return;
        }
        AlertDialog k22 = k2();
        if (k22 != null) {
            k22.dismiss();
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        C0599p c = C0599p.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        TextView textView = c.d;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.x());
        c.d.setText(getString(2131952426));
        c.e.setTypeface(aVar.w());
        c.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.y5(MainActivity.this, view);
            }
        });
        c.c.setTypeface(aVar.w());
        c.c.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.z5(MainActivity.this, view);
            }
        });
        builder.setView(c.getRoot());
        builder.setCancelable(true);
        K2(builder.create());
        if (isFinishing() || k2() == null) {
            return;
        }
        AlertDialog k23 = k2();
        kotlin.jvm.internal.m.b(k23);
        Window window = k23.getWindow();
        if (window != null) {
            window.setBackgroundDrawable(new ColorDrawable(0));
        }
        AlertDialog k24 = k2();
        kotlin.jvm.internal.m.b(k24);
        k24.show();
    }

    public static final void x6(MainActivity mainActivity, View view) {
        mainActivity.K6();
    }

    public static final void x7(MainActivity mainActivity, View view) {
        mainActivity.S6();
    }

    private final void y4() {
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        if (!c0191a.P(this)) {
            c0191a.A0(this, true);
            c0191a.l0(this, true);
            c0191a.q0(this, true);
            c0191a.e1(this, true);
            UptodownApp.a aVar = UptodownApp.F;
            UptodownApp.a.P0(aVar, this, false, 2, null);
            aVar.I(this);
            O2(new u2.z(this));
            u2.z n22 = n2();
            if (n22 != null) {
                n22.b();
            }
        }
        L2();
        if (c0191a.e0(this)) {
            q5();
        } else {
            new u2.p().e(k2(), this);
        }
    }

    public static final void y5(MainActivity mainActivity, View view) {
        AlertDialog k22 = mainActivity.k2();
        kotlin.jvm.internal.m.b(k22);
        k22.dismiss();
        if (Build.VERSION.SDK_INT >= 33) {
            mainActivity.j0();
        }
        com.uptodown.activities.preferences.a.a.S0(mainActivity, true);
    }

    public static final void y6(MainActivity mainActivity, View view) {
        mainActivity.y4();
    }

    private final boolean y7() {
        FrameLayout frameLayout;
        g2.S e = g2.S.m.e(this);
        boolean z3 = System.currentTimeMillis() - com.uptodown.activities.preferences.a.a.A(this) >= TimeUnit.DAYS.toMillis(14L);
        if (e != null || !z3 || (frameLayout = this.f253w0) == null) {
            return false;
        }
        kotlin.jvm.internal.m.b(frameLayout);
        frameLayout.removeAllViews();
        F0 c = F0.c(getLayoutInflater());
        this.f254x0 = c;
        kotlin.jvm.internal.m.b(c);
        TextView textView = c.h;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.x());
        c.f.setTypeface(aVar.x());
        c.g.setTypeface(aVar.w());
        c.e.setTypeface(aVar.w());
        String string = getString(2131952559);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        List<C0963n> e4 = C0963n.f.e(string, "\\[xx](.*?)\\[/xx]");
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(new m3.j("\\[xx](.*?)\\[/xx]").f(string, new d3.l() {
            @Override
            public final Object invoke(Object obj) {
                CharSequence z7;
                z7 = MainActivity.z7((m3.h) obj);
                return z7;
            }
        }));
        for (C0963n c0963n : e4) {
            int L = m3.m.L(spannableStringBuilder, c0963n.d(), 0, false, 6, null);
            int length = c0963n.d().length() + L;
            if (L >= 0) {
                spannableStringBuilder.setSpan(new C(), L, length, 33);
            }
        }
        c.f.setText(spannableStringBuilder);
        c.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.A7(MainActivity.this, view);
            }
        });
        c.c.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.B7(MainActivity.this, view);
            }
        });
        FrameLayout frameLayout2 = this.f253w0;
        kotlin.jvm.internal.m.b(frameLayout2);
        F0 f0 = this.f254x0;
        kotlin.jvm.internal.m.b(f0);
        frameLayout2.addView(f0.getRoot());
        y2.n nVar = new y2.n(this);
        F0 f02 = this.f254x0;
        kotlin.jvm.internal.m.b(f02);
        RelativeLayout root = f02.getRoot();
        kotlin.jvm.internal.m.d(root, "getRoot(...)");
        nVar.h(root, 2130772030);
        com.uptodown.activities.preferences.a.a.b1(this, System.currentTimeMillis());
        return true;
    }

    public static final void z5(MainActivity mainActivity, View view) {
        AlertDialog k22 = mainActivity.k2();
        kotlin.jvm.internal.m.b(k22);
        k22.dismiss();
    }

    private final void z6(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("type", str);
        u2.z n22 = n2();
        if (n22 != null) {
            n22.d("wizard", bundle);
        }
    }

    public static final CharSequence z7(m3.h it) {
        kotlin.jvm.internal.m.e(it, "it");
        return (CharSequence) it.a().get(1);
    }

    public final void A5() {
        V6();
        if (Z5()) {
            return;
        }
        l7();
    }

    @Override
    public void B2(C0955f appInfo) {
        kotlin.jvm.internal.m.e(appInfo, "appInfo");
        super.B2(appInfo);
        if (this.R != null && this.O == 0 && this.P.size() == 1 && ((g2.Y) this.P.get(this.O)).a() == 1) {
            d6(appInfo);
            q5();
        }
    }

    @Override
    public void C2() {
        if (this.R != null && this.O == 0 && this.P.size() == 1 && ((g2.Y) this.P.get(this.O)).a() == 1) {
            Z7();
            t6();
        }
    }

    @Override
    public void D2(long j4) {
        P5();
        if (j4 <= 0) {
            F2();
        } else if (this.f252v0 == -1) {
            this.f252v0 = j4;
            new C0560i(this, j4, new r(), LifecycleOwnerKt.getLifecycleScope(this));
        }
    }

    public final ResultReceiverC0980f E5() {
        return this.f236A0;
    }

    public final ActivityResultLauncher F5() {
        return this.f238C0;
    }

    public final Fragment G5() {
        if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
            List fragments = getSupportFragmentManager().getFragments();
            kotlin.jvm.internal.m.d(fragments, "getFragments(...)");
            return (Fragment) AbstractC0525o.P(fragments);
        }
        if (this.f250t0.isEmpty()) {
            return null;
        }
        return (Fragment) AbstractC0525o.P(this.f250t0);
    }

    public final RelativeLayout I5() {
        return this.f243m0;
    }

    public final void I7() {
        g2.S e = g2.S.m.e(this);
        if (isFinishing() || e == null || !e.n()) {
            return;
        }
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        if (c0191a.g0(this)) {
            return;
        }
        AlertDialog k22 = k2();
        if (k22 != null) {
            k22.dismiss();
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        N0 c = N0.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        TextView textView = c.o;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        String string = getString(2131952782);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        int color = ContextCompat.getColor(this, 2131100666);
        int color2 = ContextCompat.getColor(this, 2131100665);
        TextView tvTitleTurboWelcomePopup = c.o;
        kotlin.jvm.internal.m.d(tvTitleTurboWelcomePopup, "tvTitleTurboWelcomePopup");
        String obj = tvTitleTurboWelcomePopup.getText().toString();
        LinearGradient linearGradient = new LinearGradient(0.0f, 0.0f, tvTitleTurboWelcomePopup.getPaint().measureText(string), tvTitleTurboWelcomePopup.getHeight(), new int[]{color, color2}, new float[]{0.0f, 1.0f}, Shader.TileMode.CLAMP);
        SpannableString spannableString = new SpannableString(obj);
        int L = m3.m.L(obj, string, 0, false, 6, null);
        if (L >= 0) {
            spannableString.setSpan(new p.a.C0226a(linearGradient, getResources().getDimension(2131165350)), L, string.length() + L, 33);
        }
        tvTitleTurboWelcomePopup.setText(spannableString);
        Spanned d = u2.I.a.d(getString(2131952734, getString(2131952736)));
        String string2 = getString(2131952736);
        kotlin.jvm.internal.m.d(string2, "getString(...)");
        SpannableString spannableString2 = new SpannableString(d);
        int L3 = m3.m.L(d, string2, 0, false, 6, null);
        if (L3 >= 0) {
            spannableString2.setSpan(new StyleSpan(1), L3, string2.length() + L3, 33);
        }
        c.i.setText(spannableString2);
        c.i.setTypeface(aVar.x());
        c.m.setTypeface(aVar.w());
        c.l.setTypeface(aVar.x());
        c.h.setTypeface(aVar.w());
        c.g.setTypeface(aVar.x());
        c.k.setTypeface(aVar.w());
        c.j.setTypeface(aVar.x());
        c.n.setTypeface(aVar.w());
        c.n.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.J7(MainActivity.this, view);
            }
        });
        builder.setView(c.getRoot());
        builder.setCancelable(true);
        K2(builder.create());
        if (isFinishing() || k2() == null) {
            return;
        }
        AlertDialog k23 = k2();
        kotlin.jvm.internal.m.b(k23);
        Window window = k23.getWindow();
        if (window != null) {
            window.setBackgroundDrawable(new ColorDrawable(0));
        }
        AlertDialog k24 = k2();
        kotlin.jvm.internal.m.b(k24);
        k24.show();
        c0191a.k1(this, true);
    }

    public final void K5() {
        RelativeLayout relativeLayout = this.Z;
        if (relativeLayout != null) {
            kotlin.jvm.internal.m.b(relativeLayout);
            if (relativeLayout.getVisibility() == 0) {
                RelativeLayout relativeLayout2 = this.Z;
                kotlin.jvm.internal.m.b(relativeLayout2);
                relativeLayout2.setVisibility(8);
            }
        }
    }

    public final void M7(String str) {
        if (G5() instanceof C0820h) {
            Fragment G5 = G5();
            kotlin.jvm.internal.m.c(G5, "null cannot be cast to non-null type com.uptodown.fragments.AlternativesFragment");
            ((C0820h) G5).u(str);
        }
    }

    public final Object N7(String str, V2.d dVar) {
        Object g = o3.g.g(o3.Y.c(), new E(str, null), dVar);
        return g == W2.b.c() ? g : R2.s.a;
    }

    public final Object O7(String str, V2.d dVar) {
        Object g = o3.g.g(o3.Y.c(), new F(str, null), dVar);
        return g == W2.b.c() ? g : R2.s.a;
    }

    public final void Q6() {
        TabLayout tabLayout;
        TabLayout tabLayout2;
        TabLayout tabLayout3;
        RelativeLayout relativeLayout;
        if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
            getSupportFragmentManager().popBackStackImmediate((String) null, 1);
        }
        RelativeLayout relativeLayout2 = this.f243m0;
        if (relativeLayout2 != null && relativeLayout2.getVisibility() == 0 && (relativeLayout = this.f243m0) != null) {
            relativeLayout.setVisibility(8);
        }
        TabLayout tabLayout4 = this.f245o0;
        if ((tabLayout4 == null || tabLayout4.getSelectedTabPosition() != 2) && ((tabLayout = this.f245o0) == null || tabLayout.getSelectedTabPosition() != 3)) {
            C7();
        }
        TabLayout tabLayout5 = this.f245o0;
        if (((tabLayout5 == null || tabLayout5.getSelectedTabPosition() != 1) && ((tabLayout2 = this.f245o0) == null || tabLayout2.getSelectedTabPosition() != 0)) || (tabLayout3 = this.W) == null) {
            return;
        }
        tabLayout3.setVisibility(0);
    }

    public final void Q7(int i, g2.P p3) {
        Fragment G5 = G5();
        if (p3 == null || !(G5 instanceof C0837m1)) {
            return;
        }
        runOnUiThread(((C0837m1) G5).new RunnableC0839b(i, p3));
    }

    public final void R7(String str) {
        if (G5() instanceof C0898y1) {
            Fragment G5 = G5();
            kotlin.jvm.internal.m.c(G5, "null cannot be cast to non-null type com.uptodown.fragments.HomeFragment");
            ((C0898y1) G5).I(str);
        } else {
            C0898y1 c0898y1 = this.f248r0;
            if (c0898y1 != null) {
                kotlin.jvm.internal.m.b(c0898y1);
                c0898y1.I(str);
            }
        }
    }

    public final void T6() {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new t(null), 2, (Object) null);
    }

    public final void T7() {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), (V2.g) null, (o3.L) null, new H(null), 3, (Object) null);
    }

    public final void U6() {
        S6();
        if (Y5()) {
            return;
        }
        W6();
        V6();
        T7();
    }

    public final void U7(String str) {
        if (G5() instanceof B1) {
            Fragment G5 = G5();
            kotlin.jvm.internal.m.c(G5, "null cannot be cast to non-null type com.uptodown.fragments.ParentCategoryFragment");
            ((B1) G5).z(str);
        } else {
            B1 b12 = this.f246p0;
            if (b12 != null) {
                kotlin.jvm.internal.m.b(b12);
                b12.z(str);
            }
        }
    }

    public final boolean V5() {
        RelativeLayout relativeLayout = this.Z;
        if (relativeLayout == null) {
            return false;
        }
        kotlin.jvm.internal.m.b(relativeLayout);
        return relativeLayout.getVisibility() == 0;
    }

    public final void V7() {
        ImageView imageView = (ImageView) findViewById(2131362232);
        g2.S e = g2.S.m.e(this);
        if (isFinishing() || e == null || !e.n()) {
            if (imageView != null) {
                imageView.setVisibility(0);
            }
        } else if (imageView != null) {
            imageView.setVisibility(8);
        }
        T7();
    }

    public final void W7(String str) {
        if (G5() instanceof K1) {
            Fragment G5 = G5();
            kotlin.jvm.internal.m.c(G5, "null cannot be cast to non-null type com.uptodown.fragments.TopByCategoryFragment");
            ((K1) G5).Z(str);
        } else {
            K1 k12 = this.f247q0;
            if (k12 != null) {
                kotlin.jvm.internal.m.b(k12);
                k12.Z(str);
            }
        }
    }

    @Override
    public void X() {
        super.X();
        SwitchCompat switchCompat = this.V;
        if (switchCompat != null) {
            switchCompat.setChecked(false);
        }
        Y7();
    }

    public final void X7(C0965p download, int i) {
        kotlin.jvm.internal.m.e(download, "download");
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new I(i, this, download, null), 2, (Object) null);
    }

    @Override
    public void Y() {
        super.Y();
        SwitchCompat switchCompat = this.V;
        if (switchCompat != null) {
            switchCompat.setChecked(true);
        }
        Y7();
    }

    @Override
    public void Y2(long j4) {
        com.uptodown.activities.preferences.a.a.n0(this, String.valueOf(j4));
        Bitmap L7 = L7();
        RelativeLayout relativeLayout = (RelativeLayout) findViewById(2131363289);
        this.R = relativeLayout;
        kotlin.jvm.internal.m.b(relativeLayout);
        relativeLayout.setVisibility(0);
        RelativeLayout relativeLayout2 = this.R;
        kotlin.jvm.internal.m.b(relativeLayout2);
        relativeLayout2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.w7(view);
            }
        });
        RelativeLayout relativeLayout3 = this.R;
        kotlin.jvm.internal.m.b(relativeLayout3);
        relativeLayout3.removeAllViews();
        View inflate = LayoutInflater.from(this).inflate(2131558900, (ViewGroup) this.R, false);
        kotlin.jvm.internal.m.c(inflate, "null cannot be cast to non-null type android.widget.RelativeLayout");
        RelativeLayout relativeLayout4 = (RelativeLayout) inflate;
        TextView textView = (TextView) relativeLayout4.findViewById(2131364292);
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        TextView textView2 = (TextView) relativeLayout4.findViewById(2131364201);
        textView2.setTypeface(aVar.x());
        textView2.setText(getString(N1.i.v, getString(N1.i.b)));
        ((TextView) relativeLayout4.findViewById(2131364200)).setTypeface(aVar.w());
        TextView textView3 = (TextView) relativeLayout4.findViewById(2131363580);
        textView3.setTypeface(aVar.x());
        textView3.setEnabled(true);
        textView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.x7(MainActivity.this, view);
            }
        });
        g2.Y y3 = new g2.Y();
        y3.d(6);
        y3.e(relativeLayout4);
        f7(y3);
        ImageView imageView = (ImageView) relativeLayout4.findViewById(2131362463);
        Animation loadAnimation = AnimationUtils.loadAnimation(this, 2130772038);
        loadAnimation.setStartOffset(500L);
        loadAnimation.setFillAfter(true);
        ImageView imageView2 = (ImageView) relativeLayout4.findViewById(2131362422);
        imageView2.setImageBitmap(L7);
        Animation loadAnimation2 = AnimationUtils.loadAnimation(this, 2130772037);
        loadAnimation2.setFillAfter(true);
        loadAnimation2.setStartOffset(500L);
        loadAnimation2.setAnimationListener(new B(imageView, loadAnimation, imageView2));
        imageView.startAnimation(loadAnimation);
        imageView2.startAnimation(loadAnimation2);
    }

    @Override
    public void a3(C0955f appInfo) {
        kotlin.jvm.internal.m.e(appInfo, "appInfo");
        Fragment G5 = G5();
        RelativeLayout relativeLayout = this.f243m0;
        if (relativeLayout != null) {
            relativeLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.b8(view);
                }
            });
        }
        RelativeLayout relativeLayout2 = this.f243m0;
        if (relativeLayout2 != null) {
            relativeLayout2.setVisibility(0);
        }
        if (!(G5 instanceof C0837m1)) {
            r5(appInfo, false);
        } else if (((C0837m1) G5).P3().e() != appInfo.e()) {
            r5(appInfo, true);
        }
        N5();
    }

    public final void a8(C0952c alternatives) {
        kotlin.jvm.internal.m.e(alternatives, "alternatives");
        P5();
        M5();
        C0820h a = C0820h.f.a(alternatives);
        FragmentTransaction beginTransaction = getSupportFragmentManager().beginTransaction();
        kotlin.jvm.internal.m.d(beginTransaction, "beginTransaction(...)");
        if (findViewById(2131363225) == null) {
            String string = getString(2131952006);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            r0(string);
            return;
        }
        try {
            beginTransaction.setCustomAnimations(2130772032, 2130772029);
            beginTransaction.add(2131363225, a);
            beginTransaction.addToBackStack(alternatives.c());
            if (G5() instanceof K1) {
                beginTransaction.setTransition(4099);
            }
            if (isFinishing() || getSupportFragmentManager().isDestroyed()) {
                return;
            }
            try {
                beginTransaction.commitAllowingStateLoss();
            } catch (Exception e) {
                e.printStackTrace();
                String string2 = getString(2131952006);
                kotlin.jvm.internal.m.d(string2, "getString(...)");
                r0(string2);
            }
        } catch (Exception e4) {
            e4.printStackTrace();
            String string3 = getString(2131952006);
            kotlin.jvm.internal.m.d(string3, "getString(...)");
            r0(string3);
        }
    }

    @Override
    public void c0() {
        super.c0();
        b2();
    }

    public final void c8(C0957h category) {
        kotlin.jvm.internal.m.e(category, "category");
        P5();
        M5();
        K1 a = K1.i.a(category);
        FragmentTransaction beginTransaction = getSupportFragmentManager().beginTransaction();
        kotlin.jvm.internal.m.d(beginTransaction, "beginTransaction(...)");
        if (findViewById(2131363225) == null) {
            String string = getString(2131952006);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            r0(string);
            return;
        }
        try {
            beginTransaction.setCustomAnimations(2130772032, 2130772029);
            beginTransaction.add(2131363225, a);
            beginTransaction.addToBackStack(a.K().d());
            if (G5() instanceof K1) {
                beginTransaction.setTransition(4099);
            }
            if (isFinishing() || getSupportFragmentManager().isDestroyed()) {
                return;
            }
            try {
                beginTransaction.commitAllowingStateLoss();
            } catch (Exception e) {
                e.printStackTrace();
                String string2 = getString(2131952006);
                kotlin.jvm.internal.m.d(string2, "getString(...)");
                r0(string2);
            }
        } catch (Exception e4) {
            e4.printStackTrace();
            String string3 = getString(2131952006);
            kotlin.jvm.internal.m.d(string3, "getString(...)");
            r0(string3);
        }
    }

    @Override
    public void d0() {
        super.d0();
        b2();
    }

    public final void d8() {
        FragmentTransaction beginTransaction = getSupportFragmentManager().beginTransaction();
        kotlin.jvm.internal.m.d(beginTransaction, "beginTransaction(...)");
        List<Fragment> fragments = getSupportFragmentManager().getFragments();
        kotlin.jvm.internal.m.d(fragments, "getFragments(...)");
        for (Fragment fragment : fragments) {
            if (fragment.isVisible()) {
                beginTransaction.hide(fragment);
            }
        }
        C0898y1 c0898y1 = this.f248r0;
        if (c0898y1 == null) {
            C0898y1 c0898y12 = new C0898y1();
            this.f248r0 = c0898y12;
            kotlin.jvm.internal.m.b(c0898y12);
            beginTransaction.add(2131362173, c0898y12);
        } else {
            kotlin.jvm.internal.m.b(c0898y1);
            beginTransaction.show(c0898y1);
        }
        if (!isFinishing() && !getSupportFragmentManager().isDestroyed()) {
            try {
                beginTransaction.commitAllowingStateLoss();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        TabLayout tabLayout = this.W;
        if (tabLayout != null) {
            tabLayout.selectTab(tabLayout != null ? tabLayout.getTabAt(0) : null);
        }
        this.f256z0 = 0;
        s5(0);
    }

    @Override
    public void e0() {
        super.e0();
        O1();
    }

    public final void e8(C0957h parentCategory) {
        B1 b12;
        kotlin.jvm.internal.m.e(parentCategory, "parentCategory");
        if (parentCategory.b() == 523) {
            s5(1);
            return;
        }
        this.f250t0 = new ArrayList();
        TabLayout tabLayout = this.W;
        kotlin.jvm.internal.m.b(tabLayout);
        int tabCount = tabLayout.getTabCount();
        int i = 1;
        while (true) {
            b12 = null;
            if (i >= tabCount) {
                break;
            }
            TabLayout tabLayout2 = this.W;
            kotlin.jvm.internal.m.b(tabLayout2);
            TabLayout.Tab tabAt = tabLayout2.getTabAt(i);
            if ((tabAt != null ? tabAt.getTag() : null) instanceof C0957h) {
                TabLayout tabLayout3 = this.W;
                kotlin.jvm.internal.m.b(tabLayout3);
                TabLayout.Tab tabAt2 = tabLayout3.getTabAt(i);
                Object tag = tabAt2 != null ? tabAt2.getTag() : null;
                kotlin.jvm.internal.m.c(tag, "null cannot be cast to non-null type com.uptodown.models.Category");
                if (((C0957h) tag).b() == parentCategory.b()) {
                    TabLayout tabLayout4 = this.W;
                    kotlin.jvm.internal.m.b(tabLayout4);
                    TabLayout tabLayout5 = this.W;
                    kotlin.jvm.internal.m.b(tabLayout5);
                    tabLayout4.selectTab(tabLayout5.getTabAt(i));
                }
            }
            i++;
        }
        Iterator it = this.f251u0.iterator();
        kotlin.jvm.internal.m.d(it, "iterator(...)");
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            Object next = it.next();
            kotlin.jvm.internal.m.d(next, "next(...)");
            B1 b13 = (B1) next;
            if (b13.u() != null) {
                C0957h u3 = b13.u();
                kotlin.jvm.internal.m.b(u3);
                if (u3.b() == parentCategory.b()) {
                    b12 = b13;
                    break;
                }
            }
        }
        FragmentTransaction beginTransaction = getSupportFragmentManager().beginTransaction();
        kotlin.jvm.internal.m.d(beginTransaction, "beginTransaction(...)");
        if (b12 == null) {
            b12 = B1.m.a(parentCategory);
            this.f251u0.add(b12);
            beginTransaction.add(2131362173, b12);
        }
        List<Fragment> fragments = getSupportFragmentManager().getFragments();
        kotlin.jvm.internal.m.d(fragments, "getFragments(...)");
        for (Fragment fragment : fragments) {
            if (fragment.isVisible()) {
                beginTransaction.hide(fragment);
            }
        }
        beginTransaction.show(b12);
        if (this.f250t0.size() < 1) {
            this.f250t0.add(b12);
        }
        if (!isFinishing() && !getSupportFragmentManager().isDestroyed()) {
            try {
                beginTransaction.commitAllowingStateLoss();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        s5(0);
    }

    @Override
    public void f0() {
        super.f0();
        O1();
    }

    @Override
    public void i0() {
        SwitchCompat switchCompat = this.U;
        if (switchCompat != null) {
            switchCompat.setChecked(U());
        }
        Y7();
    }

    @Override
    protected void i3() {
    }

    @Override
    public g2.S k3() {
        g2.S e = g2.S.m.e(this);
        if ((e != null ? e.g() : null) == null || !e.m(this)) {
            return null;
        }
        return e;
    }

    @Override
    protected void onCreate(Bundle bundle) {
        long j4;
        Bundle extras;
        Bundle extras2;
        super.onCreate(bundle);
        setContentView(2131558656);
        if (new u2.M().a(this)) {
            finish();
            return;
        }
        this.f253w0 = (FrameLayout) findViewById(2131362177);
        this.f255y0 = (FrameLayout) findViewById(2131362178);
        RelativeLayout relativeLayout = (RelativeLayout) findViewById(2131363257);
        this.N = relativeLayout;
        kotlin.jvm.internal.m.b(relativeLayout);
        relativeLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.B6(view);
            }
        });
        M2((RelativeLayout) findViewById(2131361915));
        UptodownApp.a aVar = UptodownApp.F;
        if (aVar.J()) {
            RelativeLayout relativeLayout2 = this.N;
            kotlin.jvm.internal.m.b(relativeLayout2);
            relativeLayout2.setVisibility(8);
            aVar.t0(false);
        }
        this.R = (RelativeLayout) findViewById(2131363289);
        r2();
        this.S = findViewById(2131363521);
        this.T = (AppBarLayout) findViewById(2131361811);
        this.W = (TabLayout) findViewById(2131363466);
        ((ImageView) findViewById(2131362231)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.C6(MainActivity.this, view);
            }
        });
        RelativeLayout relativeLayout3 = (RelativeLayout) findViewById(2131363226);
        ((TextView) findViewById(2131363891)).setTypeface(N1.k.g.x());
        relativeLayout3.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.D6(MainActivity.this, view);
            }
        });
        ((ImageView) findViewById(2131362232)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.E6(MainActivity.this, view);
            }
        });
        V7();
        V7();
        String str = null;
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), (V2.g) null, (o3.L) null, new n(null), 3, (Object) null);
        Q5();
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                MainActivity.F6(MainActivity.this);
            }
        });
        UptodownApp.a.P0(aVar, this, false, 2, null);
        if (!com.uptodown.activities.preferences.a.a.R(this)) {
            Context applicationContext = getApplicationContext();
            kotlin.jvm.internal.m.d(applicationContext, "getApplicationContext(...)");
            new b2.n(applicationContext);
        }
        if (getIntent() != null) {
            Intent intent = getIntent();
            kotlin.jvm.internal.m.d(intent, "getIntent(...)");
            if (!f8(intent)) {
                Uri data = getIntent().getData();
                if (data != null) {
                    String uri = data.toString();
                    kotlin.jvm.internal.m.d(uri, "toString(...)");
                    String j5 = new C0536h().j(data, this);
                    if (j5 != null && m3.m.o(j5, ".apk", false, 2, null)) {
                        String h = new u2.y().h(j5);
                        if (h != null) {
                            E2(h, null);
                        } else {
                            Intent intent2 = new Intent(getApplicationContext(), (Class<?>) InstallerActivity.class);
                            intent2.setData(data);
                            this.f242G0.launch(intent2);
                        }
                    } else if (j5 != null && W1.G.b.a(j5)) {
                        Intent intent3 = new Intent(getApplicationContext(), (Class<?>) InstallerActivity.class);
                        intent3.setData(data);
                        this.f242G0.launch(intent3);
                    } else if (m3.m.y(uri, "https://dw.uptodown.com/dwn/", false, 2, null)) {
                        new C0555d(this, uri, new o(), LifecycleOwnerKt.getLifecycleScope(this));
                    } else if (m3.m.D(uri, "preregister-available", false, 2, null)) {
                        String queryParameter = data.getQueryParameter("appID");
                        if (queryParameter != null && queryParameter.length() != 0) {
                            try {
                                String queryParameter2 = data.getQueryParameter("appID");
                                kotlin.jvm.internal.m.b(queryParameter2);
                                D2(Long.parseLong(queryParameter2));
                            } catch (NumberFormatException e) {
                                e.printStackTrace();
                            }
                        }
                    } else if (!aVar.S(this)) {
                        new C0561j(this, new u2.p().j(data), this.f237B0, LifecycleOwnerKt.getLifecycleScope(this));
                    }
                }
                Intent intent4 = getIntent();
                String string = (intent4 == null || (extras2 = intent4.getExtras()) == null) ? null : extras2.getString("appId");
                if (string != null) {
                    try {
                        j4 = Long.parseLong(string);
                    } catch (NumberFormatException e4) {
                        e4.printStackTrace();
                        j4 = -1;
                    }
                    if (j4 > 0) {
                        Bundle extras3 = getIntent().getExtras();
                        String string2 = extras3 != null ? extras3.getString("packageName") : null;
                        C0973y c0973y = new C0973y();
                        c0973y.j(j4);
                        c0973y.m(string2);
                        c0973y.n(this);
                        new C0560i(this, j4, this.f237B0, LifecycleOwnerKt.getLifecycleScope(this));
                    }
                } else {
                    C0973y b = C0973y.f.b(this);
                    if (b != null && !b.g()) {
                        new C0560i(this, b.b(), this.f237B0, LifecycleOwnerKt.getLifecycleScope(this));
                    }
                }
                Intent intent5 = getIntent();
                if (intent5 != null && (extras = intent5.getExtras()) != null) {
                    str = extras.getString("campaign");
                }
                if (str != null && m3.m.p(str, "BlackFriday", true)) {
                    Z2();
                }
            }
        }
        getOnBackPressedDispatcher().addCallback(this, this.f241F0);
        U2(registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                MainActivity.H6(MainActivity.this, (ActivityResult) obj);
            }
        }));
        ViewPager2 findViewById = findViewById(2131364466);
        this.Y = findViewById;
        if (findViewById != null) {
            findViewById.setOffscreenPageLimit(4);
        }
        ViewPager2 viewPager2 = this.Y;
        if (viewPager2 != null) {
            viewPager2.setUserInputEnabled(false);
        }
        this.f245o0 = (TabLayout) findViewById(2131363467);
        this.f243m0 = (RelativeLayout) findViewById(2131363121);
        Z6();
    }

    public boolean onKeyDown(int i, KeyEvent event) {
        kotlin.jvm.internal.m.e(event, "event");
        return super.onKeyDown(i, event);
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (Y5()) {
            return;
        }
        T7();
        u2.F.a.h(this);
        if (V5()) {
            Y6();
        }
    }

    protected void onStart() {
        super.onStart();
        this.f236A0 = new ResultReceiverC0980f(null, new d3.l() {
            @Override
            public final Object invoke(Object obj) {
                R2.s I6;
                I6 = MainActivity.I6(MainActivity.this, (String) obj);
                return I6;
            }
        });
    }

    protected void onStop() {
        super.onStop();
        this.f236A0 = null;
    }

    @Override
    public void p3() {
        if (this.R != null) {
            int size = this.P.size();
            int i = this.O;
            if (size <= i || ((g2.Y) this.P.get(i)).a() != 5) {
                return;
            }
            q5();
            v2 v2Var = this.f249s0;
            if (v2Var != null) {
                v2Var.L0();
            }
        }
    }

    public final void p7() {
        if (this.Z == null) {
            this.Z = (RelativeLayout) findViewById(2131363149);
            View inflate = LayoutInflater.from(this).inflate(2131558530, (ViewGroup) this.Z, false);
            RelativeLayout relativeLayout = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout);
            relativeLayout.addView(inflate);
            RelativeLayout relativeLayout2 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout2);
            TextView textView = (TextView) relativeLayout2.findViewById(2131363916);
            k.a aVar = N1.k.g;
            textView.setTypeface(aVar.w());
            RelativeLayout relativeLayout3 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout3);
            ((TextView) relativeLayout3.findViewById(2131363924)).setTypeface(aVar.w());
            RelativeLayout relativeLayout4 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout4);
            TextView textView2 = (TextView) relativeLayout4.findViewById(2131364350);
            textView2.setTypeface(aVar.x());
            textView2.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.v7(MainActivity.this, view);
                }
            });
            RelativeLayout relativeLayout5 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout5);
            TextView textView3 = (TextView) relativeLayout5.findViewById(2131363839);
            textView3.setTypeface(aVar.x());
            textView3.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.q7(MainActivity.this, view);
                }
            });
            RelativeLayout relativeLayout6 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout6);
            TextView textView4 = (TextView) relativeLayout6.findViewById(2131363778);
            textView4.setTypeface(aVar.x());
            textView4.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.r7(MainActivity.this, view);
                }
            });
            RelativeLayout relativeLayout7 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout7);
            ((TextView) relativeLayout7.findViewById(2131364159)).setTypeface(aVar.w());
            RelativeLayout relativeLayout8 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout8);
            ((LinearLayout) relativeLayout8.findViewById(2131362564)).setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.s7(MainActivity.this, view);
                }
            });
            RelativeLayout relativeLayout9 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout9);
            TextView textView5 = (TextView) relativeLayout9.findViewById(2131364110);
            textView5.setTypeface(aVar.w());
            textView5.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.t7(MainActivity.this, view);
                }
            });
            RelativeLayout relativeLayout10 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout10);
            this.f244n0 = (ProgressBar) relativeLayout10.findViewById(2131363020);
            RelativeLayout relativeLayout11 = this.Z;
            kotlin.jvm.internal.m.b(relativeLayout11);
            ((RelativeLayout) relativeLayout11.findViewById(2131363152)).setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.u7(view);
                }
            });
        }
        RelativeLayout relativeLayout12 = this.Z;
        kotlin.jvm.internal.m.b(relativeLayout12);
        relativeLayout12.setVisibility(0);
        ProgressBar progressBar = this.f244n0;
        kotlin.jvm.internal.m.b(progressBar);
        progressBar.setVisibility(4);
    }

    public final void s5(int i) {
        TabLayout tabLayout = this.f245o0;
        kotlin.jvm.internal.m.b(tabLayout);
        if (i < tabLayout.getTabCount()) {
            TabLayout tabLayout2 = this.f245o0;
            kotlin.jvm.internal.m.b(tabLayout2);
            if (tabLayout2.getSelectedTabPosition() != i) {
                TabLayout tabLayout3 = this.f245o0;
                kotlin.jvm.internal.m.b(tabLayout3);
                TabLayout.Tab tabAt = tabLayout3.getTabAt(i);
                if (tabAt != null) {
                    tabAt.select();
                }
            }
        }
    }

    @Override
    protected void t3() {
    }

    @Override
    protected void u3() {
    }

    @Override
    protected void q3(g2.S s3) {
    }

    @Override
    protected void s3(g2.S s3, String str) {
    }
}