导航菜单

页面标题

页面副标题

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

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

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


package d2;

import N1.k;
import S2.AbstractC0525o;
import W1.G;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcelable;
import android.text.Editable;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.animation.Animation;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
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.AppCompatTextView;
import androidx.appcompat.widget.Toolbar;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentViewModelLazyKt;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import b2.C0560i;
import b2.C0563l;
import c2.C0566A;
import c2.C0571b;
import c2.C0573c;
import c2.C0583h;
import c2.C0587j;
import c2.C0593m;
import c2.C0599p;
import c2.C0606t;
import c2.C0609u0;
import c2.C0612w;
import c2.C0613w0;
import c2.C0617y0;
import c2.C0618z;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.newinterstitial.out.MBNewInterstitialHandler;
import com.mbridge.msdk.newinterstitial.out.NewInterstitialListener;
import com.mbridge.msdk.out.BannerAdListener;
import com.mbridge.msdk.out.BannerSize;
import com.mbridge.msdk.out.MBBannerView;
import com.mbridge.msdk.out.MBridgeIds;
import com.mbridge.msdk.out.RewardInfo;
import com.mbridge.msdk.playercommon.exoplayer2.DefaultRenderersFactory;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.uptodown.UptodownApp;
import com.uptodown.activities.AbstractC0740a;
import com.uptodown.activities.AppDetailActivity;
import com.uptodown.activities.AppInstalledDetailsActivity;
import com.uptodown.activities.FreeUpSpaceActivity;
import com.uptodown.activities.Gallery;
import com.uptodown.activities.InformationActivity;
import com.uptodown.activities.LoginActivity;
import com.uptodown.activities.MainActivity;
import com.uptodown.activities.MoreInfo;
import com.uptodown.activities.OldVersionsActivity;
import com.uptodown.activities.OrganizationActivity;
import com.uptodown.activities.PublicProfileActivity;
import com.uptodown.activities.RepliesActivity;
import com.uptodown.activities.ReviewsActivity;
import com.uptodown.activities.SearchActivity;
import com.uptodown.activities.VirusTotalReport;
import com.uptodown.activities.YouTubeActivity;
import com.uptodown.activities.preferences.a;
import com.uptodown.util.views.UsernameTextView;
import com.uptodown.workers.DownloadApkWorker;
import com.uptodown.workers.DownloadWorker;
import com.uptodown.workers.GenerateQueueWorker;
import com.uptodown.workers.GetUserDataWorker;
import d2.C0837m1;
import d2.C0880s1;
import f2.InterfaceC0913D;
import f2.InterfaceC0918a;
import f2.InterfaceC0921d;
import f2.InterfaceC0927j;
import f2.InterfaceC0934q;
import g2.C0944E;
import g2.C0948I;
import g2.C0952c;
import g2.C0953d;
import g2.C0955f;
import g2.C0957h;
import g2.C0958i;
import g2.C0963n;
import g2.C0964o;
import g2.C0965p;
import g2.C0966q;
import g2.C0968t;
import g2.C0973y;
import g2.S;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import kotlin.jvm.internal.AbstractC1009g;
import u2.C1221a;
import u2.C1233m;
import u2.H;
import u2.O;
import u2.p;
import u2.v;
import w2.C1254c;
import w2.C1255d;
import w2.k;

public final class C0837m1 extends Fragment {
    public static final C0838a n = new C0838a(null);
    public C0955f a;
    private C0571b b;
    private u2.z d;
    private AlertDialog e;
    private ArrayList f;
    private Menu g;
    private M1.I h;
    private M1.I i;
    private final ActivityResultLauncher l;
    private final ActivityResultLauncher m;
    private final R2.g c = FragmentViewModelLazyKt.createViewModelLazy(this, kotlin.jvm.internal.D.b(C0880s1.class), new V(new U(this)), (d3.a) null);
    private ArrayList j = new ArrayList();
    private final C0850m k = new C0850m();

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object emit(u2.H h, V2.d dVar) {
                if (!(h instanceof H.a)) {
                    if (h instanceof H.c) {
                        H.c cVar = (H.c) h;
                        ArrayList b = ((C0880s1.b) cVar.a()).b();
                        if (b == null || b.isEmpty()) {
                            ArrayList a = ((C0880s1.b) cVar.a()).a();
                            if (a != null && !a.isEmpty()) {
                                this.a.t5(((C0880s1.b) cVar.a()).a());
                            }
                        } else {
                            this.a.Q5(((C0880s1.b) cVar.a()).b());
                        }
                    } else if (!(h instanceof H.b)) {
                        throw new R2.k();
                    }
                }
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I G = C0837m1.this.U3().G();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (G.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object emit(u2.H h, V2.d dVar) {
                if (!(h instanceof H.a)) {
                    if (h instanceof H.c) {
                        H.c cVar = (H.c) h;
                        this.a.N5(((C0880s1.c) cVar.a()).b());
                        this.a.x5(((C0880s1.c) cVar.a()).a());
                    } else if (!(h instanceof H.b)) {
                        throw new R2.k();
                    }
                }
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I I = C0837m1.this.U3().I();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (I.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public static final void e(C0837m1 c0837m1, u2.H h, View view) {
                if (UptodownApp.F.a0()) {
                    c0837m1.L6((ArrayList) ((H.c) h).a());
                }
            }

            public final Object emit(final u2.H h, V2.d dVar) {
                if (!(h instanceof H.a)) {
                    if (h instanceof H.c) {
                        if (((Collection) ((H.c) h).a()).isEmpty()) {
                            this.a.Q3().L.b.setVisibility(8);
                            this.a.W3(2131361886);
                        } else {
                            if (((Number) this.a.U3().P().getValue()).intValue() == -1) {
                                this.a.Q3().L.b.setVisibility(0);
                            }
                            this.a.K6(2131361886);
                            ImageView imageView = this.a.Q3().L.b;
                            final C0837m1 c0837m1 = this.a;
                            imageView.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public final void onClick(View view) {
                                    C0837m1.C.a.e(C0837m1.this, h, view);
                                }
                            });
                        }
                    } else if (!(h instanceof H.b)) {
                        throw new R2.k();
                    }
                }
                return R2.s.a;
            }
        }

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

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return C0837m1.this.new 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);
                r3.I j0 = C0837m1.this.U3().j0();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (j0.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

    public static final class E implements f2.V {
        E() {
        }

        @Override
        public void a(C0948I reportVT) {
            kotlin.jvm.internal.m.e(reportVT, "reportVT");
            if (C0837m1.this.getActivity() == null || C0837m1.this.requireActivity().isFinishing()) {
                return;
            }
            Intent intent = new Intent((Context) C0837m1.this.requireActivity(), (Class<?>) VirusTotalReport.class);
            intent.putExtra("appInfo", C0837m1.this.P3());
            intent.putExtra("appReportVT", reportVT);
            C0837m1 c0837m1 = C0837m1.this;
            UptodownApp.a aVar = UptodownApp.F;
            FragmentActivity requireActivity = c0837m1.requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            c0837m1.startActivity(intent, aVar.a(requireActivity));
            C0837m1.this.U3().k0().setValue(Boolean.FALSE);
        }

        @Override
        public void b() {
            if (C0837m1.this.getActivity() == null || C0837m1.this.requireActivity().isFinishing()) {
                return;
            }
            String o02 = C0837m1.this.P3().o0();
            if (o02 != null && o02.length() != 0) {
                String o03 = C0837m1.this.P3().o0();
                kotlin.jvm.internal.m.b(o03);
                if (Long.parseLong(o03) > 650000000) {
                    Intent intent = new Intent((Context) C0837m1.this.requireActivity(), (Class<?>) VirusTotalReport.class);
                    intent.putExtra("appInfo", C0837m1.this.P3());
                    intent.putExtra("isVirusTotalReportAvaialable", false);
                    C0837m1 c0837m1 = C0837m1.this;
                    UptodownApp.a aVar = UptodownApp.F;
                    FragmentActivity requireActivity = c0837m1.requireActivity();
                    kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
                    c0837m1.startActivity(intent, aVar.a(requireActivity));
                    C0837m1.this.U3().k0().setValue(Boolean.FALSE);
                    return;
                }
            }
            AbstractC0740a activity = C0837m1.this.getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            activity.G2(C0837m1.this.P3().l0());
        }
    }

    public static final class F implements H1.b {
        final Context b;

        F(Context context) {
            this.b = context;
        }

        @Override
        public void a(Exception e) {
            kotlin.jvm.internal.m.e(e, "e");
            e.printStackTrace();
            C0837m1 c0837m1 = C0837m1.this;
            c0837m1.V5(c0837m1.Q3().O.b, this.b);
        }

        @Override
        public void onSuccess() {
            C0837m1 c0837m1 = C0837m1.this;
            c0837m1.V5(c0837m1.Q3().O.b, this.b);
        }
    }

    public static final class G implements InterfaceC0921d {
        G() {
        }

        @Override
        public void a(C0955f app) {
            kotlin.jvm.internal.m.e(app, "app");
            if (!UptodownApp.F.a0() || C0837m1.this.getActivity() == null || C0837m1.this.requireActivity().isFinishing()) {
                return;
            }
            C0837m1.this.i5(app);
        }
    }

    public static final class H implements InterfaceC0918a {
        H() {
        }

        @Override
        public void a(C0955f appInfo, int i) {
            kotlin.jvm.internal.m.e(appInfo, "appInfo");
            C0837m1.this.F6(appInfo);
        }
    }

    public static final class I implements ViewTreeObserver.OnPreDrawListener {
        final C0613w0 a;

        I(C0613w0 c0613w0) {
            this.a = c0613w0;
        }

        @Override
        public boolean onPreDraw() {
            this.a.n.getViewTreeObserver().removeOnPreDrawListener(this);
            TextView tvBodyReview = this.a.n;
            kotlin.jvm.internal.m.d(tvBodyReview, "tvBodyReview");
            if (!w2.s.a(tvBodyReview)) {
                return true;
            }
            this.a.s.setVisibility(0);
            this.a.s.setTypeface(N1.k.g.w());
            return true;
        }
    }

    public static final class J implements ViewTreeObserver.OnPreDrawListener {
        final C0617y0 a;

        J(C0617y0 c0617y0) {
            this.a = c0617y0;
        }

        @Override
        public boolean onPreDraw() {
            this.a.n.getViewTreeObserver().removeOnPreDrawListener(this);
            TextView tvBodyReview = this.a.n;
            kotlin.jvm.internal.m.d(tvBodyReview, "tvBodyReview");
            if (!w2.s.a(tvBodyReview)) {
                return true;
            }
            this.a.s.setVisibility(0);
            this.a.s.setTypeface(N1.k.g.w());
            return true;
        }
    }

    public static final class K implements InterfaceC0913D {
        final ArrayList b;
        final kotlin.jvm.internal.C c;
        final ArrayList d;

        K(ArrayList arrayList, kotlin.jvm.internal.C c, ArrayList arrayList2) {
            this.b = arrayList;
            this.c = c;
            this.d = arrayList2;
        }

        @Override
        public void a(g2.M screenshot) {
            kotlin.jvm.internal.m.e(screenshot, "screenshot");
            UptodownApp.a aVar = UptodownApp.F;
            if (!aVar.a0() || C0837m1.this.getActivity() == null || C0837m1.this.requireActivity().isFinishing()) {
                return;
            }
            Intent intent = new Intent((Context) C0837m1.this.requireActivity(), (Class<?>) Gallery.class);
            Bundle bundle = new Bundle();
            bundle.putParcelableArrayList("images", this.b);
            bundle.putInt("index", this.b.indexOf(screenshot));
            intent.putExtra("bundle", bundle);
            C0837m1 c0837m1 = C0837m1.this;
            FragmentActivity requireActivity = c0837m1.requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            c0837m1.startActivity(intent, aVar.a(requireActivity));
        }

        @Override
        public void b(g2.M screenshot) {
            kotlin.jvm.internal.m.e(screenshot, "screenshot");
            this.b.remove(screenshot);
            M1.B b = (M1.B) this.c.a;
            if (b != null) {
                b.c(screenshot);
            }
        }

        @Override
        public void c(g2.X video) {
            kotlin.jvm.internal.m.e(video, "video");
            this.d.remove(video);
            M1.B b = (M1.B) this.c.a;
            if (b != null) {
                b.c(video);
            }
        }

        @Override
        public void d(g2.X video) {
            kotlin.jvm.internal.m.e(video, "video");
            if (!UptodownApp.F.a0() || C0837m1.this.getActivity() == null || C0837m1.this.requireActivity().isFinishing()) {
                return;
            }
            Intent intent = new Intent((Context) C0837m1.this.getActivity(), (Class<?>) YouTubeActivity.class);
            intent.putExtra("id_youtube", video.a());
            C0837m1.this.startActivity(intent);
        }
    }

    public static final class L implements InterfaceC0921d {
        L() {
        }

        @Override
        public void a(C0955f app) {
            kotlin.jvm.internal.m.e(app, "app");
            if (!UptodownApp.F.a0() || C0837m1.this.getActivity() == null || C0837m1.this.requireActivity().isFinishing()) {
                return;
            }
            C0837m1.this.i5(app);
        }
    }

    public static final class M implements InterfaceC0918a {
        M() {
        }

        @Override
        public void a(C0955f appInfo, int i) {
            kotlin.jvm.internal.m.e(appInfo, "appInfo");
            C0837m1.this.F6(appInfo);
        }
    }

    public static final class N implements InterfaceC0921d {
        N() {
        }

        @Override
        public void a(C0955f app) {
            kotlin.jvm.internal.m.e(app, "app");
            if (!UptodownApp.F.a0() || C0837m1.this.getActivity() == null || C0837m1.this.requireActivity().isFinishing()) {
                return;
            }
            C0837m1.this.i5(app);
        }
    }

    public static final class O implements InterfaceC0918a {
        O() {
        }

        @Override
        public void a(C0955f appInfo, int i) {
            kotlin.jvm.internal.m.e(appInfo, "appInfo");
            C0837m1.this.F6(appInfo);
        }
    }

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

        static final class a implements r3.f {
            final C0837m1 a;

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

                C0198a(C0837m1 c0837m1, V2.d dVar) {
                    super(2, dVar);
                    this.b = c0837m1;
                }

                @Override
                public final V2.d create(Object obj, V2.d dVar) {
                    return new C0198a(this.b, 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);
                    if (this.b.P3().g0() == 1) {
                        C0837m1 c0837m1 = this.b;
                        String string = c0837m1.getString(2131952564);
                        kotlin.jvm.internal.m.d(string, "getString(...)");
                        c0837m1.c6(2131361885, string);
                        this.b.Q3().P.setBackground(ContextCompat.getDrawable(this.b.requireContext(), 2131231248));
                        this.b.Q3().k.setImageDrawable(ContextCompat.getDrawable(this.b.requireContext(), 2131231402));
                        this.b.Q3().f196u0.setTextColor(ContextCompat.getColor(this.b.requireContext(), 2131100688));
                        this.b.Q3().f196u0.setText(this.b.getString(2131952564));
                    } else {
                        C0837m1 c0837m12 = this.b;
                        String string2 = c0837m12.getString(2131951658);
                        kotlin.jvm.internal.m.d(string2, "getString(...)");
                        c0837m12.c6(2131361885, string2);
                        this.b.Q3().P.setBackground(ContextCompat.getDrawable(this.b.requireContext(), 2131231258));
                        this.b.Q3().k.setImageDrawable(ContextCompat.getDrawable(this.b.requireContext(), 2131231401));
                        this.b.Q3().f196u0.setTextColor(ContextCompat.getColor(this.b.requireContext(), 2131100648));
                        this.b.Q3().f196u0.setText(this.b.getString(2131951658));
                    }
                    return R2.s.a;
                }

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

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object b(int i, V2.d dVar) {
                this.a.P3().V0(i);
                Object g = o3.g.g(o3.Y.c(), new C0198a(this.a, null), dVar);
                return g == W2.b.c() ? g : R2.s.a;
            }

            public Object emit(Object obj, V2.d dVar) {
                return b(((Number) obj).intValue(), dVar);
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.t W = C0837m1.this.U3().W();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (W.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

        @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 ViewTreeObserver.OnPreDrawListener {
        final View a;
        final C0837m1 b;

        Q(View view, C0837m1 c0837m1) {
            this.a = view;
            this.b = c0837m1;
        }

        @Override
        public boolean onPreDraw() {
            this.a.getViewTreeObserver().removeOnPreDrawListener(this);
            this.b.startPostponedEnterTransition();
            return true;
        }
    }

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object emit(u2.H h, V2.d dVar) {
                if (!(h instanceof H.a)) {
                    if (h instanceof H.c) {
                        H.c cVar = (H.c) h;
                        if (((C0880s1.f) cVar.a()).b()) {
                            AbstractC0740a activity = this.a.getActivity();
                            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                            String string = this.a.requireContext().getString(2131952573);
                            kotlin.jvm.internal.m.d(string, "getString(...)");
                            activity.r0(string);
                        } else if (!((C0880s1.f) cVar.a()).b() && ((C0880s1.f) cVar.a()).a() == 0) {
                            AbstractC0740a activity2 = this.a.getActivity();
                            kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                            String string2 = this.a.getString(2131952014);
                            kotlin.jvm.internal.m.d(string2, "getString(...)");
                            activity2.r0(string2);
                        } else if (((C0880s1.f) cVar.a()).a() == 401) {
                            this.a.P4();
                        } else if (((C0880s1.f) cVar.a()).a() == 403) {
                            AbstractC0740a activity3 = this.a.getActivity();
                            kotlin.jvm.internal.m.c(activity3, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                            String string3 = this.a.getString(2131951991);
                            kotlin.jvm.internal.m.d(string3, "getString(...)");
                            activity3.r0(string3);
                        } else {
                            AbstractC0740a activity4 = this.a.getActivity();
                            kotlin.jvm.internal.m.c(activity4, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                            String string4 = this.a.getString(2131952006);
                            kotlin.jvm.internal.m.d(string4, "getString(...)");
                            activity4.r0(string4);
                        }
                    } else if (!(h instanceof H.b)) {
                        throw new R2.k();
                    }
                }
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I c0 = C0837m1.this.U3().c0();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (c0.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

    public static final class S implements NewInterstitialListener {
        final MBNewInterstitialHandler b;

        S(MBNewInterstitialHandler mBNewInterstitialHandler) {
            this.b = mBNewInterstitialHandler;
        }

        @Override
        public void onAdClicked(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
            Bundle bundle = new Bundle();
            bundle.putString("type", "clicked");
            new u2.z(C0837m1.this.getContext()).d("mintegral_interstitial", bundle);
        }

        @Override
        public void onAdClose(MBridgeIds ids, RewardInfo info) {
            kotlin.jvm.internal.m.e(ids, "ids");
            kotlin.jvm.internal.m.e(info, "info");
            Bundle bundle = new Bundle();
            bundle.putString("type", "closed");
            new u2.z(C0837m1.this.getContext()).d("mintegral_interstitial", bundle);
        }

        @Override
        public void onAdCloseWithNIReward(MBridgeIds ids, RewardInfo info) {
            kotlin.jvm.internal.m.e(ids, "ids");
            kotlin.jvm.internal.m.e(info, "info");
        }

        @Override
        public void onAdShow(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
            if (C0837m1.this.getContext() != null) {
                Bundle bundle = new Bundle();
                bundle.putString("type", "show");
                new u2.z(C0837m1.this.getContext()).d("mintegral_interstitial", bundle);
                a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
                Context requireContext = C0837m1.this.requireContext();
                kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
                c0191a.N0(requireContext, System.currentTimeMillis());
            }
        }

        @Override
        public void onEndcardShow(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
        }

        @Override
        public void onLoadCampaignSuccess(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
        }

        @Override
        public void onResourceLoadFail(MBridgeIds ids, String errorMsg) {
            String str;
            kotlin.jvm.internal.m.e(ids, "ids");
            kotlin.jvm.internal.m.e(errorMsg, "errorMsg");
            Bundle bundle = new Bundle();
            bundle.putString("type", "load_failed");
            if (errorMsg.length() > 10) {
                str = errorMsg.substring(0, 10);
                kotlin.jvm.internal.m.d(str, "substring(...)");
            } else {
                str = errorMsg.length() > 0 ? errorMsg : null;
            }
            if (str != null) {
                bundle.putString(CampaignEx.JSON_NATIVE_VIDEO_ERROR, errorMsg);
            }
            new u2.z(C0837m1.this.getContext()).d("mintegral_interstitial", bundle);
        }

        @Override
        public void onResourceLoadSuccess(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
            Bundle bundle = new Bundle();
            bundle.putString("type", "loaded");
            new u2.z(C0837m1.this.getContext()).d("mintegral_interstitial", bundle);
            if (this.b.isReady()) {
                this.b.show();
            }
        }

        @Override
        public void onShowFail(MBridgeIds ids, String errorMsg) {
            String str;
            kotlin.jvm.internal.m.e(ids, "ids");
            kotlin.jvm.internal.m.e(errorMsg, "errorMsg");
            Bundle bundle = new Bundle();
            bundle.putString("type", "show_failed");
            if (errorMsg.length() > 10) {
                str = errorMsg.substring(0, 10);
                kotlin.jvm.internal.m.d(str, "substring(...)");
            } else {
                str = errorMsg.length() > 0 ? errorMsg : null;
            }
            if (str != null) {
                bundle.putString(CampaignEx.JSON_NATIVE_VIDEO_ERROR, errorMsg);
            }
            new u2.z(C0837m1.this.getContext()).d("mintegral_interstitial", bundle);
        }

        @Override
        public void onVideoComplete(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
            Bundle bundle = new Bundle();
            bundle.putString("type", "video_completed");
            new u2.z(C0837m1.this.getContext()).d("mintegral_interstitial", bundle);
        }
    }

    public static final class T implements f2.K {
        final ArrayList a;
        final ArrayList b;
        final kotlin.jvm.internal.z c;

        T(ArrayList arrayList, ArrayList arrayList2, kotlin.jvm.internal.z zVar) {
            this.a = arrayList;
            this.b = arrayList2;
            this.c = zVar;
        }

        @Override
        public void a(int i) {
            if (((g2.V) this.a.get(i)).d() != 0) {
                this.c.a = !r3.a;
            } else if (this.b.contains(this.a.get(i))) {
                this.b.remove(this.a.get(i));
            } else {
                this.b.add(this.a.get(i));
            }
        }
    }

    public static final class U extends kotlin.jvm.internal.n implements d3.a {
        final Fragment a;

        public U(Fragment fragment) {
            super(0);
            this.a = fragment;
        }

        @Override
        public final Fragment invoke() {
            return this.a;
        }
    }

    public static final class V extends kotlin.jvm.internal.n implements d3.a {
        final d3.a a;

        public V(d3.a aVar) {
            super(0);
            this.a = aVar;
        }

        @Override
        public final ViewModelStore invoke() {
            ViewModelStore viewModelStore = ((ViewModelStoreOwner) this.a.invoke()).getViewModelStore();
            kotlin.jvm.internal.m.d(viewModelStore, "ownerProducer().viewModelStore");
            return viewModelStore;
        }
    }

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

        W(Context context, V2.d dVar) {
            super(2, dVar);
            this.c = context;
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return C0837m1.this.new W(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);
                C0837m1 c0837m1 = C0837m1.this;
                Context context = this.c;
                this.a = 1;
                if (c0837m1.S2(context, 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 ((W) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

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

        X(String str, C0837m1 c0837m1, V2.d dVar) {
            super(2, dVar);
            this.b = str;
            this.c = c0837m1;
        }

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object obj2;
            Object obj3;
            Object obj4;
            W2.b.c();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            String str = this.b;
            if (str != null && str.length() != 0) {
                if (this.c.h != null) {
                    M1.I i = this.c.h;
                    kotlin.jvm.internal.m.b(i);
                    ArrayList c = i.c();
                    String str2 = this.b;
                    int size = c.size();
                    int i4 = 0;
                    while (true) {
                        if (i4 >= size) {
                            obj4 = null;
                            break;
                        }
                        obj4 = c.get(i4);
                        i4++;
                        if (kotlin.jvm.internal.m.a(((C0955f) obj4).R(), str2)) {
                            break;
                        }
                    }
                    M1.I i5 = this.c.h;
                    kotlin.jvm.internal.m.b(i5);
                    int K = AbstractC0525o.K(i5.c(), (C0955f) obj4);
                    M1.I i6 = this.c.h;
                    kotlin.jvm.internal.m.b(i6);
                    i6.notifyItemChanged(K);
                }
                if (this.c.i != null) {
                    M1.I i7 = this.c.i;
                    kotlin.jvm.internal.m.b(i7);
                    ArrayList c4 = i7.c();
                    String str3 = this.b;
                    int size2 = c4.size();
                    int i8 = 0;
                    while (true) {
                        if (i8 >= size2) {
                            obj3 = null;
                            break;
                        }
                        obj3 = c4.get(i8);
                        i8++;
                        if (kotlin.jvm.internal.m.a(((C0955f) obj3).R(), str3)) {
                            break;
                        }
                    }
                    M1.I i9 = this.c.i;
                    kotlin.jvm.internal.m.b(i9);
                    int K3 = AbstractC0525o.K(i9.c(), (C0955f) obj3);
                    M1.I i10 = this.c.i;
                    kotlin.jvm.internal.m.b(i10);
                    i10.notifyItemChanged(K3);
                }
                if (!this.c.j.isEmpty()) {
                    Iterator it = this.c.j.iterator();
                    kotlin.jvm.internal.m.d(it, "iterator(...)");
                    while (it.hasNext()) {
                        Object next = it.next();
                        kotlin.jvm.internal.m.d(next, "next(...)");
                        M1.I i11 = (M1.I) next;
                        ArrayList c5 = i11.c();
                        String str4 = this.b;
                        int size3 = c5.size();
                        int i12 = 0;
                        while (true) {
                            if (i12 >= size3) {
                                obj2 = null;
                                break;
                            }
                            obj2 = c5.get(i12);
                            i12++;
                            if (kotlin.jvm.internal.m.a(((C0955f) obj2).R(), str4)) {
                                break;
                            }
                        }
                        i11.notifyItemChanged(AbstractC0525o.K(i11.c(), (C0955f) obj2));
                    }
                }
            }
            return R2.s.a;
        }

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

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

        Y(String str, C0837m1 c0837m1, V2.d dVar) {
            super(2, dVar);
            this.b = str;
            this.c = c0837m1;
        }

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

        @Override
        public final Object invokeSuspend(Object obj) {
            FragmentActivity activity;
            W2.b.c();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            if (m3.m.p(this.b, this.c.P3().R(), true) && (activity = this.c.getActivity()) != null) {
                this.c.Q6(activity);
            }
            return R2.s.a;
        }

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

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

        Z(a0 a0Var, V2.d dVar) {
            super(2, dVar);
            this.c = a0Var;
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return C0837m1.this.new Z(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;
                Context requireContext = C0837m1.this.requireContext();
                kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
                a0 a0Var = this.c;
                this.a = 1;
                if (aVar.a(requireContext, a0Var, 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 ((Z) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

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

        public final C0837m1 a(C0955f c0955f) {
            C0837m1 c0837m1 = new C0837m1();
            Bundle bundle = new Bundle();
            if (c0955f != null) {
                bundle.putParcelable("appInfo", c0955f);
            }
            c0837m1.setArguments(bundle);
            return c0837m1;
        }

        private C0838a() {
        }
    }

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

        @Override
        public void a() {
            S.b bVar = g2.S.m;
            Context requireContext = C0837m1.this.requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            g2.S e = bVar.e(requireContext);
            if (e == null || !e.n()) {
                return;
            }
            C0837m1.this.Q3().D.setVisibility(8);
        }
    }

    public final class RunnableC0839b implements Runnable {
        private final int a;
        private final g2.P b;

        public RunnableC0839b(int i, g2.P p) {
            this.a = i;
            this.b = p;
        }

        @Override
        public void run() {
            File n;
            g2.P p = this.b;
            if (p == null || !m3.m.p(p.h(), C0837m1.this.P3().R(), true)) {
                return;
            }
            int i = this.a;
            if (i != 108) {
                if (i == 109) {
                    C0837m1.this.S3();
                    C0837m1.this.x6(this.b);
                    return;
                } else {
                    if (i == 201) {
                        C0837m1.this.x6(this.b);
                        return;
                    }
                    FragmentActivity activity = C0837m1.this.getActivity();
                    if (activity != null) {
                        C0837m1.this.Q6(activity);
                        return;
                    }
                    return;
                }
            }
            if (C0837m1.this.getContext() != null) {
                C0837m1 c0837m1 = C0837m1.this;
                Context requireContext = c0837m1.requireContext();
                kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
                c0837m1.Q6(requireContext);
                g2.P p3 = this.b;
                Context requireContext2 = C0837m1.this.requireContext();
                kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
                C0965p b = p3.b(requireContext2);
                if (b == null || (n = b.n()) == null || !n.exists()) {
                    return;
                }
                C0837m1.this.I4(n);
            }
        }
    }

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

        static final class a implements r3.f {
            final C0837m1 a;

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

                C0199a(C0837m1 c0837m1, V2.d dVar) {
                    super(2, dVar);
                    this.b = c0837m1;
                }

                @Override
                public final V2.d create(Object obj, V2.d dVar) {
                    return new C0199a(this.b, 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);
                    if (this.b.P3().D0() == 1) {
                        C0837m1 c0837m1 = this.b;
                        String string = c0837m1.getString(2131951690);
                        kotlin.jvm.internal.m.d(string, "getString(...)");
                        c0837m1.c6(2131361893, string);
                        this.b.Q3().U.setBackground(ContextCompat.getDrawable(this.b.requireContext(), 2131231248));
                        this.b.Q3().m.setImageDrawable(ContextCompat.getDrawable(this.b.requireContext(), 2131231428));
                        this.b.Q3().f184E0.setTextColor(ContextCompat.getColor(this.b.requireContext(), 2131100688));
                        this.b.Q3().f184E0.setText(this.b.getString(2131951690));
                    } else {
                        C0837m1 c0837m12 = this.b;
                        String string2 = c0837m12.getString(2131951683);
                        kotlin.jvm.internal.m.d(string2, "getString(...)");
                        c0837m12.c6(2131361893, string2);
                        this.b.Q3().U.setBackground(ContextCompat.getDrawable(this.b.requireContext(), 2131231258));
                        this.b.Q3().m.setImageDrawable(ContextCompat.getDrawable(this.b.requireContext(), 2131231427));
                        this.b.Q3().f184E0.setTextColor(ContextCompat.getColor(this.b.requireContext(), 2131100648));
                        this.b.Q3().f184E0.setText(this.b.getString(2131951683));
                    }
                    return R2.s.a;
                }

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

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object b(int i, V2.d dVar) {
                this.a.P3().a1(i);
                Object g = o3.g.g(o3.Y.c(), new C0199a(this.a, null), dVar);
                return g == W2.b.c() ? g : R2.s.a;
            }

            public Object emit(Object obj, V2.d dVar) {
                return b(((Number) obj).intValue(), dVar);
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.t n02 = C0837m1.this.U3().n0();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (n02.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

    public final class RunnableC0840c implements Runnable {
        private final String a;
        private final int b;
        final C0837m1 c;

        public RunnableC0840c(C0837m1 c0837m1, String packagename, int i) {
            kotlin.jvm.internal.m.e(packagename, "packagename");
            this.c = c0837m1;
            this.a = packagename;
            this.b = i;
        }

        @Override
        public void run() {
            throw new UnsupportedOperationException("Method not decompiled: d2.C0837m1.RunnableC0840c.run():void");
        }
    }

    public final class RunnableC0841d implements Runnable {
        private final int a;
        private final C0965p b;

        public RunnableC0841d(int i, C0965p c0965p) {
            this.a = i;
            this.b = c0965p;
        }

        @Override
        public void run() {
            C0965p c0965p = this.b;
            String w = c0965p != null ? c0965p.w() : null;
            if (w != null && w.length() != 0) {
                C0965p c0965p2 = this.b;
                if (m3.m.p(c0965p2 != null ? c0965p2.w() : null, C0837m1.this.P3().R(), true)) {
                    switch (this.a) {
                        case 199:
                            C0837m1.this.i6(null);
                            break;
                        case 200:
                            C0837m1.this.S3();
                            if (C0837m1.F4(C0837m1.this, null, 1, null)) {
                                C0837m1.this.i6(this.b);
                                C0965p c0965p3 = this.b;
                                if ((c0965p3 == null || C0837m1.this.P3().I() != c0965p3.E()) && C0837m1.this.getActivity() != null && (C0837m1.this.getActivity() instanceof AbstractC0740a)) {
                                    AbstractC0740a activity = C0837m1.this.getActivity();
                                    kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                                    C0837m1 c0837m1 = C0837m1.this;
                                    String string = c0837m1.getString(2131952543, new Object[]{c0837m1.P3().M()});
                                    kotlin.jvm.internal.m.d(string, "getString(...)");
                                    activity.r0(string);
                                    break;
                                }
                            }
                            break;
                        case 201:
                            if (C0837m1.F4(C0837m1.this, null, 1, null)) {
                                C0837m1.this.i6(this.b);
                                break;
                            }
                            break;
                        case 202:
                            FragmentActivity activity2 = C0837m1.this.getActivity();
                            if (activity2 != null) {
                                C0837m1 c0837m12 = C0837m1.this;
                                C0965p c0965p4 = this.b;
                                if (c0965p4 != null) {
                                    c0837m12.C4(c0965p4, activity2);
                                    break;
                                }
                            }
                            break;
                        case 203:
                            FragmentActivity activity3 = C0837m1.this.getActivity();
                            if (activity3 != null) {
                                C0837m1 c0837m13 = C0837m1.this;
                                String string2 = c0837m13.getString(2131951959);
                                kotlin.jvm.internal.m.d(string2, "getString(...)");
                                c0837m13.j3(string2);
                                c0837m13.g6(activity3);
                                break;
                            }
                            break;
                        case 205:
                            C0837m1.this.i6(this.b);
                            break;
                        case 207:
                            FragmentActivity activity4 = C0837m1.this.getActivity();
                            if (activity4 != null) {
                                C0837m1.this.g6(activity4);
                                break;
                            }
                            break;
                        case 208:
                            FragmentActivity activity5 = C0837m1.this.getActivity();
                            if (activity5 != null) {
                                C0837m1 c0837m14 = C0837m1.this;
                                String string3 = c0837m14.getString(2131952403);
                                kotlin.jvm.internal.m.d(string3, "getString(...)");
                                c0837m14.j3(string3);
                                c0837m14.Q6(activity5);
                                break;
                            }
                            break;
                        case 209:
                            FragmentActivity activity6 = C0837m1.this.getActivity();
                            if (activity6 != null) {
                                C0837m1 c0837m15 = C0837m1.this;
                                String string4 = c0837m15.getString(2131952009);
                                kotlin.jvm.internal.m.d(string4, "getString(...)");
                                c0837m15.j3(string4);
                                c0837m15.Q6(activity6);
                                break;
                            }
                            break;
                        case 210:
                            FragmentActivity activity7 = C0837m1.this.getActivity();
                            if (activity7 != null) {
                                C0837m1.this.Q6(activity7);
                                break;
                            }
                            break;
                        case 211:
                            C0837m1.this.r6(this.b);
                            break;
                    }
                    return;
                }
            }
            C0837m1 c0837m16 = C0837m1.this;
            C0965p c0965p5 = this.b;
            c0837m16.X6(c0965p5 != null ? c0965p5.w() : null);
        }
    }

    static final class C0842e extends kotlin.coroutines.jvm.internal.d {
        Object a;
        Object b;
        int d;

        C0842e(V2.d dVar) {
            super(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            this.b = obj;
            this.d |= Integer.MIN_VALUE;
            return C0837m1.this.N2(this);
        }
    }

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

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            String R;
            W2.b.c();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            if (C0837m1.this.getContext() != null && (R = C0837m1.this.P3().R()) != null && R.length() != 0) {
                v.a aVar = u2.v.v;
                Context requireContext = C0837m1.this.requireContext();
                kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
                u2.v a = aVar.a(requireContext);
                a.a();
                String R3 = C0837m1.this.P3().R();
                kotlin.jvm.internal.m.b(R3);
                C0953d W = a.W(R3);
                if (W != null) {
                    C0837m1.this.U3().Q().setValue(W);
                }
            }
            return R2.s.a;
        }

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

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

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

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return C0837m1.this.new C0844g(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);
            if (C0837m1.this.U3().Q().getValue() != null) {
                Object value = C0837m1.this.U3().Q().getValue();
                kotlin.jvm.internal.m.b(value);
                if (((C0953d) value).e() == 0) {
                    C0837m1 c0837m1 = C0837m1.this;
                    String string = c0837m1.getString(2131952416);
                    kotlin.jvm.internal.m.d(string, "getString(...)");
                    c0837m1.c6(2131361873, string);
                    return R2.s.a;
                }
            }
            C0837m1 c0837m12 = C0837m1.this;
            String string2 = c0837m12.getString(2131952443);
            kotlin.jvm.internal.m.d(string2, "getString(...)");
            c0837m12.c6(2131361873, string2);
            return R2.s.a;
        }

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

    static final class C0845h extends kotlin.coroutines.jvm.internal.l implements d3.p {
        int a;
        final Context c;
        final kotlin.jvm.internal.C d;
        final kotlin.jvm.internal.z e;
        final kotlin.jvm.internal.z f;

        C0845h(Context context, kotlin.jvm.internal.C c, kotlin.jvm.internal.z zVar, kotlin.jvm.internal.z zVar2, V2.d dVar) {
            super(2, dVar);
            this.c = context;
            this.d = c;
            this.e = zVar;
            this.f = zVar2;
        }

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

        @Override
        public final Object invokeSuspend(Object obj) {
            String u;
            W2.b.c();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            R2.n.b(obj);
            C0837m1.this.Q3().L.g.setVisibility(8);
            C0837m1.this.Q3().H.g.setVisibility(8);
            if (C0837m1.this.P3().c()) {
                C0837m1.this.Q3().x.setVisibility(0);
            } else {
                C0837m1.this.Q3().x.setVisibility(8);
            }
            if (C0837m1.this.U3().Q().getValue() != null) {
                C0837m1.this.Q3().L.c.setVisibility(0);
            } else {
                C0837m1.this.Q3().L.c.setVisibility(8);
            }
            if (C0837m1.this.P3().M0()) {
                C0837m1.this.t6(this.c);
            } else if (C0837m1.this.P3().J0()) {
                C0837m1.this.e6();
            } else if (C0837m1.this.P3().I0()) {
                C0837m1.this.g6(this.c);
            } else if (C0837m1.this.P3().K0()) {
                C0837m1.this.s6();
            } else if (!com.uptodown.activities.preferences.a.a.M(this.c)) {
                C0837m1.this.b6();
            } else if (C0837m1.this.P3().E0()) {
                if (!C0837m1.this.V3()) {
                    C0837m1.this.o6(this.c, (C0965p) this.d.a);
                } else if (((Boolean) C0837m1.this.U3().M().getValue()).booleanValue() || C0837m1.this.P3().G0()) {
                    C0837m1 c0837m1 = C0837m1.this;
                    String string = c0837m1.getString(2131951686);
                    kotlin.jvm.internal.m.d(string, "getString(...)");
                    c0837m1.f6(string);
                } else if (C0837m1.this.U3().Q().getValue() != null) {
                    if (C0837m1.this.U3().h0().getValue() != null) {
                        Object value = C0837m1.this.U3().h0().getValue();
                        kotlin.jvm.internal.m.b(value);
                        if (!((g2.P) value).m()) {
                            Object value2 = C0837m1.this.U3().Q().getValue();
                            kotlin.jvm.internal.m.b(value2);
                            if (((C0953d) value2).e() != 1) {
                                Object obj2 = this.d.a;
                                if (obj2 == null) {
                                    C0837m1.this.g6(this.c);
                                } else if (((C0965p) obj2).f()) {
                                    C0837m1.this.z6(this.c);
                                } else {
                                    if (!this.e.a) {
                                        C0837m1 c0837m12 = C0837m1.this;
                                        if (!c0837m12.E4((g2.P) c0837m12.U3().h0().getValue())) {
                                            if (((C0965p) this.d.a).y() > 0) {
                                                C0837m1.this.B6();
                                            } else {
                                                C0837m1.this.g6(this.c);
                                            }
                                        }
                                    }
                                    C0837m1.this.i6((C0965p) this.d.a);
                                }
                            }
                        }
                    }
                    Object value3 = C0837m1.this.U3().Q().getValue();
                    kotlin.jvm.internal.m.b(value3);
                    if (((C0953d) value3).H()) {
                        C0837m1.this.Q3().L.getRoot().setVisibility(4);
                        C0837m1.this.Q3().H.getRoot().setVisibility(8);
                    } else {
                        C0837m1.this.q6(this.c);
                    }
                } else {
                    T1.a i = N1.k.g.i();
                    if (m3.m.p(i != null ? i.b() : null, C0837m1.this.P3().R(), true)) {
                        C0837m1 c0837m13 = C0837m1.this;
                        String string2 = c0837m13.getString(N1.i.T);
                        kotlin.jvm.internal.m.d(string2, "getString(...)");
                        c0837m13.l6(string2);
                    } else {
                        Object obj3 = this.d.a;
                        if (obj3 == null) {
                            C0837m1.this.g6(this.c);
                        } else if (((C0965p) obj3).f()) {
                            C0837m1.this.m6();
                        } else if ((C0837m1.F4(C0837m1.this, null, 1, null) || this.e.a) && this.f.a) {
                            C0837m1.this.i6((C0965p) this.d.a);
                        } else {
                            C0837m1.this.g6(this.c);
                        }
                    }
                }
            } else if (C0837m1.this.U3().Q().getValue() != null) {
                C0837m1.this.q6(this.c);
                C0837m1.this.M4(1);
            } else {
                C0837m1 c0837m14 = C0837m1.this;
                String string3 = c0837m14.getString(2131951687);
                kotlin.jvm.internal.m.d(string3, "getString(...)");
                c0837m14.f6(string3);
                C0837m1.this.M4(0);
            }
            C0837m1.this.U3().L().setValue(kotlin.coroutines.jvm.internal.b.a(true));
            if (C0837m1.this.U3().Q().getValue() != null) {
                C0837m1.this.K6(2131361855);
                C0837m1.this.K6(2131361873);
            } else {
                C0837m1.this.W3(2131361855);
                C0837m1.this.W3(2131361873);
            }
            if (!C0837m1.this.P3().I0() || (u = C0837m1.this.P3().u()) == null || u.length() == 0) {
                C0837m1.this.Q3().o.getRoot().setVisibility(8);
                C0837m1.this.Q3().o.c.setVisibility(8);
            } else {
                TextView textView = C0837m1.this.Q3().o.c;
                C0837m1 c0837m15 = C0837m1.this;
                textView.setTypeface(N1.k.g.x());
                textView.setText(c0837m15.P3().u());
                C0837m1.this.Q3().o.getRoot().setVisibility(0);
            }
            return R2.s.a;
        }

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

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

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

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return C0837m1.this.new C0846i(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);
            if (C0837m1.this.P3().K0()) {
                C0837m1.this.s6();
            } else {
                C0837m1 c0837m1 = C0837m1.this;
                String string = c0837m1.getString(2131951686);
                kotlin.jvm.internal.m.d(string, "getString(...)");
                c0837m1.f6(string);
            }
            return R2.s.a;
        }

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

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object emit(u2.H h, V2.d dVar) {
                String a;
                if (!(h instanceof H.a)) {
                    if (h instanceof H.c) {
                        H.c cVar = (H.c) h;
                        if (((C0880s1.e) cVar.a()).b()) {
                            C0837m1 c0837m1 = this.a;
                            TextView tvDownloadCancelBad = c0837m1.Q3().L.h;
                            kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
                            c0837m1.I2(tvDownloadCancelBad);
                            C0837m1 c0837m12 = this.a;
                            RelativeLayout rlStatusPreRegister = c0837m12.Q3().H.h;
                            kotlin.jvm.internal.m.d(rlStatusPreRegister, "rlStatusPreRegister");
                            c0837m12.I2(rlStatusPreRegister);
                            this.a.Q3().H.d.setVisibility(8);
                            if (this.a.getContext() != null && (a = ((C0880s1.e) cVar.a()).a()) != null && a.length() != 0) {
                                C0837m1 c0837m13 = this.a;
                                TextView tvDownloadCancelBad2 = c0837m13.Q3().L.h;
                                kotlin.jvm.internal.m.d(tvDownloadCancelBad2, "tvDownloadCancelBad");
                                c0837m13.a6(tvDownloadCancelBad2, ((C0880s1.e) cVar.a()).a());
                                this.a.Q3().H.h.setBackground(ContextCompat.getDrawable(this.a.requireContext(), 2131231256));
                                this.a.Q3().H.o.setTextColor(ContextCompat.getColorStateList(this.a.requireContext(), 2131100626));
                                this.a.Q3().H.o.setText(((C0880s1.e) cVar.a()).a());
                            }
                            v.a aVar = u2.v.v;
                            Context requireContext = this.a.requireContext();
                            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
                            u2.v a4 = aVar.a(requireContext);
                            a4.a();
                            C0944E u02 = a4.u0(this.a.P3().e());
                            a4.i();
                            if (u02 != null) {
                                this.a.Q3().E.setVisibility(0);
                                this.a.Q3().Y.setChecked(u02.d() == 1);
                            } else {
                                this.a.Q3().Y.setChecked(true);
                            }
                        } else {
                            C0837m1 c0837m14 = this.a;
                            TextView tvDownloadCancelBad3 = c0837m14.Q3().L.h;
                            kotlin.jvm.internal.m.d(tvDownloadCancelBad3, "tvDownloadCancelBad");
                            c0837m14.v2(tvDownloadCancelBad3);
                            C0837m1 c0837m15 = this.a;
                            RelativeLayout rlStatusPreRegister2 = c0837m15.Q3().H.h;
                            kotlin.jvm.internal.m.d(rlStatusPreRegister2, "rlStatusPreRegister");
                            c0837m15.v2(rlStatusPreRegister2);
                            this.a.Q3().H.d.setVisibility(0);
                            if (this.a.getContext() != null) {
                                C0837m1 c0837m16 = this.a;
                                TextView tvDownloadCancelBad4 = c0837m16.Q3().L.h;
                                kotlin.jvm.internal.m.d(tvDownloadCancelBad4, "tvDownloadCancelBad");
                                String string = this.a.getString(2131952499);
                                kotlin.jvm.internal.m.d(string, "getString(...)");
                                c0837m16.Z5(tvDownloadCancelBad4, string);
                                this.a.Q3().H.h.setBackground(ContextCompat.getDrawable(this.a.requireContext(), 2131231248));
                                this.a.Q3().H.o.setText(this.a.getString(2131952499));
                                this.a.Q3().H.o.setTextColor(ContextCompat.getColor(this.a.requireContext(), 2131100688));
                            }
                        }
                    } else if (!(h instanceof H.b)) {
                        throw new R2.k();
                    }
                }
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I T = C0837m1.this.U3().T();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (T.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

    public static final class C0848k implements f2.V {
        C0848k() {
        }

        public static final R2.s e(C0837m1 c0837m1) {
            c0837m1.H3();
            return R2.s.a;
        }

        public static final R2.s f(C0837m1 c0837m1) {
            FragmentActivity requireActivity = c0837m1.requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            c0837m1.H2(requireActivity);
            return R2.s.a;
        }

        @Override
        public void a(C0948I reportVT) {
            kotlin.jvm.internal.m.e(reportVT, "reportVT");
            if (C0837m1.this.getActivity() == null || !(C0837m1.this.getActivity() instanceof AbstractC0740a) || C0837m1.this.requireActivity().isFinishing()) {
                return;
            }
            C0837m1.this.P3().W0(reportVT);
            if (reportVT.d() <= 0) {
                C0837m1.this.H3();
                return;
            }
            AbstractC0740a activity = C0837m1.this.getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            C0955f P3 = C0837m1.this.P3();
            final C0837m1 c0837m1 = C0837m1.this;
            d3.a aVar = new d3.a() {
                @Override
                public final Object invoke() {
                    R2.s e;
                    e = C0837m1.C0848k.e(C0837m1.this);
                    return e;
                }
            };
            final C0837m1 c0837m12 = C0837m1.this;
            activity.e2(P3, aVar, new d3.a() {
                @Override
                public final Object invoke() {
                    R2.s f;
                    f = C0837m1.C0848k.f(C0837m1.this);
                    return f;
                }
            });
        }

        @Override
        public void b() {
            C0837m1.this.H3();
        }
    }

    public static final class C0850m implements InterfaceC0927j {
        C0850m() {
        }

        @Override
        public void a(long j) {
            C0837m1.this.h5(j);
        }

        @Override
        public void b(C0957h category) {
            kotlin.jvm.internal.m.e(category, "category");
            C0837m1.this.V4(category);
        }
    }

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

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                C0837m1 c0837m1 = C0837m1.this;
                this.a = 1;
                if (c0837m1.N2(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 ((C0851n) create(j, dVar)).invokeSuspend(R2.s.a);
        }
    }

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

        @Override
        public void c(int i) {
            if (i == 404) {
                C0837m1.this.U3().M().setValue(Boolean.TRUE);
            }
        }

        @Override
        public void d(C0955f appInfo) {
            kotlin.jvm.internal.m.e(appInfo, "appInfo");
            C0837m1.this.Y5(appInfo);
            C0837m1.this.w5();
            C0837m1.this.x2();
        }
    }

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object emit(ArrayList arrayList, V2.d dVar) {
                this.a.y5(arrayList);
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I V = C0837m1.this.U3().V();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (V.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

    public static final class C0854q implements S1.h {
        C0854q() {
        }

        @Override
        public void a() {
            C0837m1 c0837m1 = C0837m1.this;
            String string = c0837m1.getString(N1.i.T);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            c0837m1.l6(string);
        }

        @Override
        public void b(String str) {
            if (str != null) {
                C0837m1.this.j3(str);
                return;
            }
            C0837m1 c0837m1 = C0837m1.this;
            String string = c0837m1.getString(2131952006);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            c0837m1.j3(string);
        }
    }

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

        static final class a implements r3.f {
            final C0837m1 a;
            final g2.L b;

            a(C0837m1 c0837m1, g2.L l) {
                this.a = c0837m1;
                this.b = l;
            }

            public final Object b(int i, V2.d dVar) {
                if (i == 0) {
                    AbstractC0740a activity = this.a.getActivity();
                    kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                    String string = this.a.getString(2131952006);
                    kotlin.jvm.internal.m.d(string, "getString(...)");
                    activity.r0(string);
                } else if (i == 1) {
                    Iterator it = ((Iterable) this.a.U3().Z().getValue()).iterator();
                    int i4 = 0;
                    while (true) {
                        if (!it.hasNext()) {
                            i4 = -1;
                            break;
                        }
                        int i5 = i4 + 1;
                        if (((g2.L) it.next()).f() == this.b.f()) {
                            break;
                        }
                        i4 = i5;
                    }
                    if (i4 > 0 && i4 < ((ArrayList) this.a.U3().Z().getValue()).size()) {
                        this.a.Y6(this.b, i4);
                    }
                }
                return R2.s.a;
            }

            public Object emit(Object obj, V2.d dVar) {
                return b(((Number) obj).intValue(), dVar);
            }
        }

        C0856s(g2.L l, V2.d dVar) {
            super(2, dVar);
            this.c = l;
        }

        @Override
        public final V2.d create(Object obj, V2.d dVar) {
            return C0837m1.this.new C0856s(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);
                r3.I X = C0837m1.this.U3().X();
                a aVar = new a(C0837m1.this, this.c);
                this.a = 1;
                if (X.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

    public static final class C0857t implements BannerAdListener {
        C0857t() {
        }

        public static final void b(C0837m1 c0837m1, View view) {
            c0837m1.P6();
        }

        @Override
        public void closeFullScreen(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
        }

        @Override
        public void onClick(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
            Bundle bundle = new Bundle();
            bundle.putString("type", "clicked");
            new u2.z(C0837m1.this.getContext()).d("mintegral_banner", bundle);
        }

        @Override
        public void onCloseBanner(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
            Bundle bundle = new Bundle();
            bundle.putString("type", "closed");
            new u2.z(C0837m1.this.getContext()).d("mintegral_banner", bundle);
        }

        @Override
        public void onLeaveApp(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
        }

        @Override
        public void onLoadFailed(MBridgeIds ids, String errorMsg) {
            kotlin.jvm.internal.m.e(ids, "ids");
            kotlin.jvm.internal.m.e(errorMsg, "errorMsg");
            C0837m1.this.Q3().D.setVisibility(8);
            C0837m1.this.Q3().f197v0.setVisibility(8);
            C0837m1.this.Q3().D.release();
            Bundle bundle = new Bundle();
            bundle.putString("type", "failed");
            new u2.z(C0837m1.this.getContext()).d("mintegral_banner", bundle);
        }

        @Override
        public void onLoadSuccessed(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
            C0837m1.this.Q3().f197v0.setTypeface(N1.k.g.x());
            C0837m1.this.Q3().f197v0.setVisibility(0);
            TextView textView = C0837m1.this.Q3().f197v0;
            final C0837m1 c0837m1 = C0837m1.this;
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.C0857t.b(C0837m1.this, view);
                }
            });
            Bundle bundle = new Bundle();
            bundle.putString("type", "loaded");
            new u2.z(C0837m1.this.getContext()).d("mintegral_banner", bundle);
        }

        @Override
        public void onLogImpression(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
        }

        @Override
        public void showFullScreen(MBridgeIds ids) {
            kotlin.jvm.internal.m.e(ids, "ids");
        }
    }

    public static final class C0858u implements H1.b {
        C0858u() {
        }

        @Override
        public void a(Exception e) {
            kotlin.jvm.internal.m.e(e, "e");
        }

        @Override
        public void onSuccess() {
            C0837m1.this.Q3().N.b.setVisibility(0);
            if (!((Boolean) C0837m1.this.U3().F().getValue()).booleanValue()) {
                C0837m1.this.Q3().d.setTitle(C0837m1.this.P3().M());
                C0837m1.this.Q3().b.setExpanded(false, false);
            }
            String z = C0837m1.this.P3().z();
            if (z == null || z.length() == 0) {
                return;
            }
            C0837m1.this.O3();
            FragmentActivity activity = C0837m1.this.getActivity();
            if (activity != null) {
                C0837m1.this.W6(activity);
            }
        }
    }

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object emit(u2.H h, V2.d dVar) {
                if (!(h instanceof H.a)) {
                    if (h instanceof H.c) {
                        H.c cVar = (H.c) h;
                        if (((C0880s1.d) cVar.a()).a()) {
                            if (((C0880s1.d) cVar.a()).b()) {
                                this.a.n3();
                            }
                            this.a.s6();
                        }
                    } else if (!(h instanceof H.b)) {
                        throw new R2.k();
                    }
                }
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I S = C0837m1.this.U3().S();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (S.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object emit(ArrayList arrayList, V2.d dVar) {
                this.a.s5(arrayList);
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I N = C0837m1.this.U3().N();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (N.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object emit(u2.H h, V2.d dVar) {
                if (!(h instanceof H.a)) {
                    if (h instanceof H.c) {
                        H.c cVar = (H.c) h;
                        this.a.O5(((C0880s1.a) cVar.a()).a(), ((C0880s1.a) cVar.a()).b());
                    } else if (!(h instanceof H.b)) {
                        throw new R2.k();
                    }
                }
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I E = C0837m1.this.U3().E();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (E.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public final Object emit(ArrayList arrayList, V2.d dVar) {
                this.a.P5(arrayList, false);
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I f0 = C0837m1.this.U3().f0();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (f0.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

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

        static final class a implements r3.f {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            public static final void e(C0837m1 c0837m1, C0952c c0952c, View view) {
                c0837m1.R4(c0952c);
            }

            public final Object emit(final C0952c c0952c, V2.d dVar) {
                ArrayList a = c0952c.a();
                if (a != null && !a.isEmpty()) {
                    this.a.Q3().j.setVisibility(0);
                    this.a.Q3().f201z0.setText(this.a.getString(2131951728));
                    LinearLayout linearLayout = this.a.Q3().A;
                    final C0837m1 c0837m1 = this.a;
                    linearLayout.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public final void onClick(View view) {
                            C0837m1.C0863z.a.e(C0837m1.this, c0952c, view);
                        }
                    });
                    ArrayList a4 = c0952c.a();
                    kotlin.jvm.internal.m.b(a4);
                    if (a4.size() > 20) {
                        ArrayList a5 = c0952c.a();
                        kotlin.jvm.internal.m.b(a5);
                        this.a.P5(new ArrayList(a5.subList(0, 20)), true);
                    } else {
                        this.a.P5(c0952c.a(), true);
                    }
                }
                return R2.s.a;
            }
        }

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

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

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c = W2.b.c();
            int i = this.a;
            if (i == 0) {
                R2.n.b(obj);
                r3.I y = C0837m1.this.U3().y();
                a aVar = new a(C0837m1.this);
                this.a = 1;
                if (y.collect(aVar, this) == c) {
                    return c;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                R2.n.b(obj);
            }
            throw new R2.d();
        }

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

    public C0837m1() {
        ActivityResultLauncher registerForActivityResult = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                C0837m1.O4(C0837m1.this, (ActivityResult) obj);
            }
        });
        kotlin.jvm.internal.m.d(registerForActivityResult, "registerForActivityResult(...)");
        this.l = registerForActivityResult;
        ActivityResultLauncher registerForActivityResult2 = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                C0837m1.c7(C0837m1.this, (ActivityResult) obj);
            }
        });
        kotlin.jvm.internal.m.d(registerForActivityResult2, "registerForActivityResult(...)");
        this.m = registerForActivityResult2;
    }

    public static final void A2(C0837m1 c0837m1, View view) {
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        c0837m1.E3(requireContext);
    }

    public static final void A3(C0837m1 c0837m1, Context context, DialogInterface dialogInterface) {
        c0837m1.b7(((Number) c0837m1.U3().Y().getValue()).intValue(), context);
    }

    public static final void A4(C0837m1 c0837m1, View view) {
        c0837m1.j5();
    }

    public static final void A5(C0837m1 c0837m1, g2.L l, View view) {
        c0837m1.l5(l);
    }

    public static final void A6(C0837m1 c0837m1, Context context, View view) {
        c0837m1.E3(context);
    }

    public static final void B2(C0837m1 c0837m1, View view) {
        DownloadWorker.a aVar = DownloadWorker.d;
        if (!aVar.j(c0837m1.P3().e())) {
            String R3 = c0837m1.P3().R();
            kotlin.jvm.internal.m.b(R3);
            if (!aVar.m(R3)) {
                return;
            }
        }
        if (aVar.h()) {
            aVar.o();
            return;
        }
        v.a aVar2 = u2.v.v;
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        u2.v a = aVar2.a(requireContext);
        a.a();
        String R4 = c0837m1.P3().R();
        kotlin.jvm.internal.m.b(R4);
        C0965p g0 = a.g0(R4, c0837m1.P3().y0());
        a.i();
        if (g0 == null || !aVar.l(g0)) {
            return;
        }
        u2.z zVar = c0837m1.d;
        if (zVar != null) {
            Bundle bundle = new Bundle();
            bundle.putString("type", "paused");
            R2.s sVar = R2.s.a;
            zVar.d("download", bundle);
        }
        aVar.n();
        c0837m1.r6(null);
    }

    private final void B3() {
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
        C0618z c = C0618z.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        if (getActivity() == null || requireActivity().isFinishing()) {
            return;
        }
        TextView textView = c.g;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        c.h.setTypeface(aVar.w());
        c.f.setTypeface(aVar.w());
        if (((Number) U3().n0().getValue()).intValue() == 1) {
            c.e.setBackground(ContextCompat.getDrawable(requireContext(), 2131231248));
            c.h.setTextColor(ContextCompat.getColor(requireContext(), 2131100688));
            c.c.setVisibility(0);
        }
        if (((Number) U3().W().getValue()).intValue() == 1) {
            c.d.setBackground(ContextCompat.getDrawable(requireContext(), 2131231248));
            c.f.setTextColor(ContextCompat.getColor(requireContext(), 2131100688));
            c.b.setVisibility(0);
        }
        c.d.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.C3(C0837m1.this, view);
            }
        });
        c.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.D3(C0837m1.this, view);
            }
        });
        builder.setView(c.getRoot());
        builder.setCancelable(true);
        I6(builder);
    }

    public static final void B4(C0837m1 c0837m1, Context context, View view) {
        c0837m1.s3(context);
    }

    public static final void B5(C0837m1 c0837m1, g2.L l, View view) {
        c0837m1.l5(l);
    }

    public final void B6() {
        R6();
        U3().P().setValue(4);
        TextView tvDownloadCancelBad = Q3().L.h;
        kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
        String string = getString(N1.i.j0);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        a6(tvDownloadCancelBad, string);
        Q3().L.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.C6(C0837m1.this, view);
            }
        });
        TextView tvPauseBad = Q3().L.j;
        kotlin.jvm.internal.m.d(tvPauseBad, "tvPauseBad");
        String string2 = getString(2131952771);
        kotlin.jvm.internal.m.d(string2, "getString(...)");
        Z5(tvPauseBad, string2);
        Q3().H.n.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.D6(C0837m1.this, view);
            }
        });
        TextView tvStatusDownload = Q3().H.n;
        kotlin.jvm.internal.m.d(tvStatusDownload, "tvStatusDownload");
        String string3 = getString(2131952771);
        kotlin.jvm.internal.m.d(string3, "getString(...)");
        Z5(tvStatusDownload, string3);
        K6(2131361856);
    }

    private final void C2(final C0566A c0566a) {
        TextView textView = c0566a.n;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        c0566a.l.setTypeface(aVar.x());
        c0566a.m.setTypeface(aVar.x());
        c0566a.k.setTypeface(aVar.x());
        c0566a.i.setTypeface(aVar.x());
        c0566a.j.setTypeface(aVar.w());
        c0566a.o.setTypeface(aVar.w());
        c0566a.n.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.D2(C0837m1.this, view);
            }
        });
        c0566a.n.setFocusable(true);
        c0566a.b.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.E2(C0566A.this, this, view);
            }
        });
        c0566a.c.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.F2(C0566A.this, view);
            }
        });
        c0566a.j.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.G2(C0837m1.this, view);
            }
        });
        c0566a.j.setFocusable(true);
    }

    public static final void C3(C0837m1 c0837m1, View view) {
        c0837m1.t2();
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        activity.j2();
    }

    public final void C4(g2.C0965p r10, android.content.Context r11) {
        throw new UnsupportedOperationException("Method not decompiled: d2.C0837m1.C4(g2.p, android.content.Context):void");
    }

    public static final void C5(C0613w0 c0613w0, C0837m1 c0837m1, View view) {
        if (c0613w0.n.getMaxLines() == Integer.MAX_VALUE) {
            c0613w0.n.setMaxLines(4);
            c0613w0.s.setText(c0837m1.getString(2131952541));
        } else {
            c0613w0.n.setMaxLines(Integer.MAX_VALUE);
            c0613w0.s.setText(c0837m1.getString(2131952540));
        }
    }

    public static final void C6(C0837m1 c0837m1, View view) {
        c0837m1.Z2();
    }

    public static final void D2(C0837m1 c0837m1, View view) {
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        c0837m1.E3(requireContext);
    }

    public static final void D3(C0837m1 c0837m1, View view) {
        c0837m1.u2();
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        activity.j2();
    }

    private final boolean D4() {
        return UptodownApp.F.L(P3().R());
    }

    public static final void D5(C0837m1 c0837m1, g2.L l, View view) {
        UptodownApp.a aVar = UptodownApp.F;
        if (aVar.a0()) {
            Intent intent = new Intent((Context) c0837m1.requireActivity(), (Class<?>) RepliesActivity.class);
            intent.putExtra("review", l);
            intent.putExtra("appName", c0837m1.P3().M());
            FragmentActivity requireActivity = c0837m1.requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            c0837m1.startActivity(intent, aVar.a(requireActivity));
        }
    }

    public static final void D6(C0837m1 c0837m1, View view) {
        c0837m1.Z2();
    }

    public static final void E2(C0566A c0566a, C0837m1 c0837m1, View view) {
        if (c0566a.b.getVisibility() == 0) {
            c0837m1.Z2();
        }
    }

    private final void E3(final Context context) {
        String v;
        String X3;
        String R3 = P3().R();
        File file = null;
        if (R3 == null || R3.length() == 0 || com.uptodown.activities.preferences.a.a.M(context)) {
            if (((Boolean) U3().L().getValue()).booleanValue() && P3().E0() && P3().H0()) {
                u2.v a = u2.v.v.a(context);
                a.a();
                String R4 = P3().R();
                kotlin.jvm.internal.m.b(R4);
                C0965p g0 = a.g0(R4, P3().y0());
                a.i();
                File n4 = (g0 == null || !g0.f()) ? null : g0.n();
                if (n4 == null || !n4.exists()) {
                    i6(null);
                    T2();
                    return;
                } else {
                    kotlin.jvm.internal.m.b(g0);
                    C4(g0, context);
                    return;
                }
            }
            if (!P3().I0() || (v = P3().v()) == null || v.length() == 0) {
                String string = getString(2131951959);
                kotlin.jvm.internal.m.d(string, "getString(...)");
                j3(string);
                return;
            }
            S.b bVar = g2.S.m;
            FragmentActivity requireActivity = requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            g2.S e = bVar.e(requireActivity);
            if (e == null || !e.n()) {
                String v3 = P3().v();
                kotlin.jvm.internal.m.b(v3);
                X4(v3, context);
                return;
            } else {
                AbstractC0740a activity = getActivity();
                kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                activity.e2(P3(), new d3.a() {
                    @Override
                    public final Object invoke() {
                        R2.s F3;
                        F3 = C0837m1.F3(C0837m1.this, context);
                        return F3;
                    }
                }, new d3.a() {
                    @Override
                    public final Object invoke() {
                        R2.s G3;
                        G3 = C0837m1.G3();
                        return G3;
                    }
                });
                return;
            }
        }
        u2.v a4 = u2.v.v.a(context);
        a4.a();
        String R5 = P3().R();
        kotlin.jvm.internal.m.b(R5);
        C0965p f0 = a4.f0(R5);
        a4.i();
        if (f0 != null && f0.f()) {
            file = f0.n();
        }
        if (file != null) {
            kotlin.jvm.internal.m.b(f0);
            C4(f0, context);
            return;
        }
        String p = P3().p();
        if (p == null || p.length() == 0) {
            String string2 = getString(2131951959);
            kotlin.jvm.internal.m.d(string2, "getString(...)");
            j3(string2);
            return;
        }
        C0965p c0965p = new C0965p();
        c0965p.c(P3());
        int R6 = c0965p.R(context);
        if (P3().L0() && (X3 = P3().X()) != null && X3.length() != 0) {
            g2.r rVar = new g2.r();
            long e4 = P3().e();
            Object value = U3().K().getValue();
            kotlin.jvm.internal.m.b(value);
            rVar.a(e4, (String) value);
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            rVar.f(requireContext);
        }
        i6(c0965p);
        DownloadApkWorker.a aVar = DownloadApkWorker.i;
        String p3 = P3().p();
        kotlin.jvm.internal.m.b(p3);
        aVar.a(context, p3, R6);
    }

    public final boolean E4(g2.P p) {
        if (DownloadWorker.d.j(P3().e())) {
            return true;
        }
        return p != null && UptodownApp.F.O(p);
    }

    public static final void E5(C0837m1 c0837m1, C0613w0 c0613w0, g2.L l, View view) {
        if (UptodownApp.F.a0()) {
            Context requireContext = c0837m1.requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            y2.n nVar = new y2.n(requireContext);
            ImageView ivLikesCounterReview = c0613w0.d;
            kotlin.jvm.internal.m.d(ivLikesCounterReview, "ivLikesCounterReview");
            nVar.n(ivLikesCounterReview);
            if (u2.I.a.i(l.f())) {
                return;
            }
            c0837m1.J4(l);
            c0613w0.p.setText(String.valueOf(l.g() + 1));
        }
    }

    private final void E6() {
        if (getContext() != null) {
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            new b2.t(requireContext, P3(), null, null, LifecycleOwnerKt.getLifecycleScope(this));
        }
    }

    public static final void F2(C0566A c0566a, View view) {
        if (c0566a.c.getVisibility() == 0) {
            DownloadWorker.d.o();
        }
    }

    public static final R2.s F3(C0837m1 c0837m1, Context context) {
        String v = c0837m1.P3().v();
        kotlin.jvm.internal.m.b(v);
        c0837m1.X4(v, context);
        return R2.s.a;
    }

    static boolean F4(C0837m1 c0837m1, g2.P p, int i, Object obj) {
        if ((i & 1) != 0) {
            p = null;
        }
        return c0837m1.E4(p);
    }

    private final View F5(LinearLayout.LayoutParams layoutParams) {
        C0613w0 c = C0613w0.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        c.getRoot().setLayoutParams(layoutParams);
        c.getRoot().setVisibility(4);
        RelativeLayout root = c.getRoot();
        kotlin.jvm.internal.m.d(root, "getRoot(...)");
        return root;
    }

    public final void F6(final C0955f c0955f) {
        if ((getActivity() instanceof MainActivity) || (getActivity() instanceof AppDetailActivity)) {
            AbstractC0740a activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            activity.W2(c0955f, new d3.a() {
                @Override
                public final Object invoke() {
                    R2.s G6;
                    G6 = C0837m1.G6(C0955f.this, this);
                    return G6;
                }
            });
        }
    }

    public static final void G2(C0837m1 c0837m1, View view) {
        c0837m1.S4();
    }

    public static final R2.s G3() {
        return R2.s.a;
    }

    private final void G4(File file) {
        boolean z;
        C0855r c0855r = new C0855r();
        if (getActivity() instanceof MainActivity) {
            MainActivity activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.MainActivity");
            z = activity.U();
        } else if (getActivity() instanceof AppDetailActivity) {
            AppDetailActivity activity2 = getActivity();
            kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.AppDetailActivity");
            z = activity2.U();
        } else {
            z = true;
        }
        G.a aVar = W1.G.b;
        String name = file.getName();
        kotlin.jvm.internal.m.d(name, "getName(...)");
        if (aVar.a(name)) {
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            String absolutePath = file.getAbsolutePath();
            kotlin.jvm.internal.m.d(absolutePath, "getAbsolutePath(...)");
            new R1.c(requireContext, absolutePath, c0855r, z);
            return;
        }
        UptodownApp.a aVar2 = UptodownApp.F;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        aVar2.V(file, requireActivity, P3().N());
        R2.s sVar = R2.s.a;
    }

    private final View G5(LinearLayout.LayoutParams layoutParams, final g2.L l, Context context) {
        final C0617y0 c = C0617y0.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        c.getRoot().setLayoutParams(layoutParams);
        c.e.setImageDrawable(ContextCompat.getDrawable(context, 2131231526));
        c.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231524));
        c.g.setImageDrawable(ContextCompat.getDrawable(context, 2131231524));
        c.h.setImageDrawable(ContextCompat.getDrawable(context, 2131231524));
        c.i.setImageDrawable(ContextCompat.getDrawable(context, 2131231524));
        if (l.h() >= 2) {
            c.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231526));
        }
        if (l.h() >= 3) {
            c.g.setImageDrawable(ContextCompat.getDrawable(context, 2131231526));
        }
        if (l.h() >= 4) {
            c.h.setImageDrawable(ContextCompat.getDrawable(context, 2131231526));
        }
        if (l.h() == 5) {
            c.i.setImageDrawable(ContextCompat.getDrawable(context, 2131231526));
        }
        AppCompatTextView appCompatTextView = c.t;
        k.a aVar = N1.k.g;
        appCompatTextView.setTypeface(aVar.w());
        c.o.setTypeface(aVar.x());
        c.n.setTypeface(aVar.x());
        c.q.setTypeface(aVar.x());
        c.r.setTypeface(aVar.x());
        S.b bVar = g2.S.m;
        if (bVar.c(l.e()) != null) {
            com.squareup.picasso.s.h().l(bVar.c(l.e())).n(UptodownApp.F.h0(context)).i(c.c);
        }
        String l4 = l.l();
        if (l4 != null && l4.length() != 0) {
            c.c.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.H5(C0837m1.this, l, view);
                }
            });
            c.t.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.I5(C0837m1.this, l, view);
                }
            });
        }
        if (l.m() != null) {
            c.t.setText(l.m());
            UsernameTextView.a aVar2 = UsernameTextView.k;
            UsernameTextView tvUsernameReview = c.t;
            kotlin.jvm.internal.m.d(tvUsernameReview, "tvUsernameReview");
            aVar2.a(tvUsernameReview, l.o(), l.n());
        }
        if (l.k() != null) {
            c.o.setText(l.k());
        }
        if (l.a() > 0) {
            c.r.setText(String.valueOf(l.a()));
        }
        if (l.i() != null) {
            c.q.setFocusable(true);
            TextView textView = c.n;
            Spanned j = l.j();
            textView.setText(j != null ? m3.m.u0(j) : null);
            c.n.getViewTreeObserver().addOnPreDrawListener(new J(c));
            c.s.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.J5(C0617y0.this, this, view);
                }
            });
            c.l.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.K5(C0837m1.this, l, view);
                }
            });
            c.l.setFocusable(true);
            c.p.setTypeface(aVar.x());
            c.p.setText(String.valueOf(l.g()));
            if (u2.I.a.i(l.f())) {
                c.d.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231426));
            }
            c.k.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.L5(C0837m1.this, c, l, view);
                }
            });
        } else {
            c.n.setVisibility(8);
            c.l.setVisibility(8);
            c.k.setVisibility(8);
        }
        c.j.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.M5(C0837m1.this, view);
            }
        });
        c.j.setVisibility(0);
        p.a aVar3 = u2.p.a;
        ImageView ivAvatarReview = c.c;
        kotlin.jvm.internal.m.d(ivAvatarReview, "ivAvatarReview");
        aVar3.a(ivAvatarReview);
        c.q.setFocusable(true);
        RelativeLayout root = c.getRoot();
        kotlin.jvm.internal.m.d(root, "getRoot(...)");
        return root;
    }

    public static final R2.s G6(C0955f c0955f, C0837m1 c0837m1) {
        if (c0955f.R() != null) {
            String R3 = c0955f.R();
            kotlin.jvm.internal.m.b(R3);
            c0837m1.X6(R3);
        }
        return R2.s.a;
    }

    public final void H2(Context context) {
        DownloadWorker.a aVar = DownloadWorker.d;
        if (aVar.j(P3().e())) {
            String R3 = P3().R();
            kotlin.jvm.internal.m.b(R3);
            aVar.c(R3);
            u2.F.a.e(context);
        } else {
            String R4 = P3().R();
            kotlin.jvm.internal.m.b(R4);
            if (aVar.m(R4)) {
                String R5 = P3().R();
                kotlin.jvm.internal.m.b(R5);
                aVar.c(R5);
            } else {
                u2.v a = u2.v.v.a(context);
                a.a();
                C0965p d0 = a.d0(String.valueOf(P3().A()));
                if (d0 != null) {
                    if (d0.O()) {
                        a.x(d0);
                    } else {
                        Iterator it = d0.o().iterator();
                        kotlin.jvm.internal.m.d(it, "iterator(...)");
                        while (it.hasNext()) {
                            Object next = it.next();
                            kotlin.jvm.internal.m.d(next, "next(...)");
                            C0966q c0966q = (C0966q) next;
                            c0966q.p(0L);
                            c0966q.l(0);
                            a.z1(c0966q);
                        }
                    }
                }
                a.i();
            }
        }
        Q6(context);
    }

    public final void H3() {
        CharSequence charSequence;
        if (getContext() != null) {
            if (U3().Q().getValue() != null && U3().h0().getValue() != null) {
                UptodownApp.a aVar = UptodownApp.F;
                Object value = U3().Q().getValue();
                kotlin.jvm.internal.m.b(value);
                if (aVar.c((C0953d) value).size() < 1 && aVar.D().size() < 1) {
                    GenerateQueueWorker.a aVar2 = GenerateQueueWorker.e;
                    Context requireContext = requireContext();
                    kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
                    Object value2 = U3().h0().getValue();
                    kotlin.jvm.internal.m.b(value2);
                    aVar2.a(requireContext, false, ((g2.P) value2).h());
                }
                if (DownloadWorker.d.h()) {
                    p3(new d3.a() {
                        @Override
                        public final Object invoke() {
                            R2.s I3;
                            I3 = C0837m1.I3();
                            return I3;
                        }
                    });
                    return;
                }
                return;
            }
            if (getActivity() == null || !(getActivity() instanceof AbstractC0740a)) {
                return;
            }
            UptodownApp.a aVar3 = UptodownApp.F;
            C0955f P3 = P3();
            FragmentActivity activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            int b02 = aVar3.b0(P3, (AbstractC0740a) activity);
            if (b02 < 0) {
                Context requireContext2 = requireContext();
                kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
                g6(requireContext2);
                return;
            }
            if (P3().L0() && (charSequence = (CharSequence) U3().K().getValue()) != null && charSequence.length() != 0) {
                g2.r rVar = new g2.r();
                long e = P3().e();
                Object value3 = U3().K().getValue();
                kotlin.jvm.internal.m.b(value3);
                rVar.a(e, (String) value3);
                Context requireContext3 = requireContext();
                kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
                rVar.f(requireContext3);
            }
            J6();
            if (D4()) {
                C0958i m = aVar3.m();
                kotlin.jvm.internal.m.b(m);
                m.g(b02);
            }
            String R3 = P3().R();
            kotlin.jvm.internal.m.b(R3);
            R2(b02, R3, P3().e());
            DownloadApkWorker.a aVar4 = DownloadApkWorker.i;
            Context requireContext4 = requireContext();
            kotlin.jvm.internal.m.d(requireContext4, "requireContext(...)");
            if (!aVar4.b(requireContext4, b02)) {
                TextView tvDownloadCancelBad = Q3().L.h;
                kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
                String string = getString(N1.i.j0);
                kotlin.jvm.internal.m.d(string, "getString(...)");
                a6(tvDownloadCancelBad, string);
                Q3().L.h.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        C0837m1.J3(C0837m1.this, view);
                    }
                });
                Q3().H.b.setVisibility(0);
                a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
                Context requireContext5 = requireContext();
                kotlin.jvm.internal.m.d(requireContext5, "requireContext(...)");
                if (!c0191a.O(requireContext5)) {
                    AbstractC0740a activity2 = getActivity();
                    kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                    kotlin.jvm.internal.F f = kotlin.jvm.internal.F.a;
                    String string2 = getString(2131952287);
                    kotlin.jvm.internal.m.d(string2, "getString(...)");
                    String format = String.format(string2, Arrays.copyOf(new Object[]{P3().M()}, 1));
                    kotlin.jvm.internal.m.d(format, "format(...)");
                    activity2.r0(format);
                }
            }
            if (DownloadWorker.d.h()) {
                p3(new d3.a() {
                    @Override
                    public final Object invoke() {
                        R2.s K3;
                        K3 = C0837m1.K3();
                        return K3;
                    }
                });
            }
        }
    }

    private final void H4(File file) {
        if (getActivity() == null || requireActivity().isFinishing()) {
            return;
        }
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AbstractC0740a.x2(activity, file, null, 2, null);
    }

    public static final void H5(C0837m1 c0837m1, g2.L l, View view) {
        c0837m1.l5(l);
    }

    private final void H6(Rect rect) {
        if (getContext() == null || kotlin.jvm.internal.m.a(P3().R(), requireContext().getPackageName())) {
            return;
        }
        if (Q3().L.getRoot().getLocalVisibleRect(rect) && !((Boolean) U3().J().getValue()).booleanValue()) {
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            y2.n nVar = new y2.n(requireContext);
            RelativeLayout rlBottomBoxDownloadButtonAppDetail = Q3().G;
            kotlin.jvm.internal.m.d(rlBottomBoxDownloadButtonAppDetail, "rlBottomBoxDownloadButtonAppDetail");
            nVar.i(rlBottomBoxDownloadButtonAppDetail, 2130772034);
            U3().J().setValue(Boolean.valueOf(!((Boolean) U3().J().getValue()).booleanValue()));
            return;
        }
        if (Q3().L.getRoot().getLocalVisibleRect(rect) || !((Boolean) U3().J().getValue()).booleanValue()) {
            return;
        }
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        y2.n nVar2 = new y2.n(requireContext2);
        RelativeLayout rlBottomBoxDownloadButtonAppDetail2 = Q3().G;
        kotlin.jvm.internal.m.d(rlBottomBoxDownloadButtonAppDetail2, "rlBottomBoxDownloadButtonAppDetail");
        nVar2.h(rlBottomBoxDownloadButtonAppDetail2, 2130772030);
        U3().J().setValue(Boolean.valueOf(!((Boolean) U3().J().getValue()).booleanValue()));
    }

    public final void I2(final View view) {
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view2) {
                C0837m1.J2(C0837m1.this, view, view2);
            }
        });
    }

    public static final R2.s I3() {
        DownloadWorker.a aVar = DownloadWorker.d;
        if (aVar.h()) {
            aVar.o();
        }
        return R2.s.a;
    }

    public final void I4(File file) {
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        if (new P1.a(requireContext).r()) {
            H4(file);
        } else {
            G4(file);
        }
    }

    public static final void I5(C0837m1 c0837m1, g2.L l, View view) {
        c0837m1.l5(l);
    }

    private final void I6(AlertDialog.Builder builder) {
        if (UptodownApp.F.M()) {
            return;
        }
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        activity.K2(builder.create());
        if (getActivity() == null || requireActivity().isFinishing()) {
            return;
        }
        AbstractC0740a activity2 = getActivity();
        kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        if (activity2.k2() != null) {
            AbstractC0740a activity3 = getActivity();
            kotlin.jvm.internal.m.c(activity3, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k22 = activity3.k2();
            kotlin.jvm.internal.m.b(k22);
            Window window = k22.getWindow();
            if (window != null) {
                window.setBackgroundDrawable(new ColorDrawable(0));
            }
            AbstractC0740a activity4 = getActivity();
            kotlin.jvm.internal.m.c(activity4, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k23 = activity4.k2();
            kotlin.jvm.internal.m.b(k23);
            k23.show();
        }
    }

    public static final void J2(final C0837m1 c0837m1, View view, View view2) {
        if (UptodownApp.F.a0()) {
            AbstractC0740a activity = c0837m1.getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k22 = activity.k2();
            if (k22 != null) {
                k22.dismiss();
            }
            if (view.getContext() != null) {
                C0606t c = C0606t.c(c0837m1.getLayoutInflater());
                kotlin.jvm.internal.m.d(c, "inflate(...)");
                TextView textView = c.f;
                k.a aVar = N1.k.g;
                textView.setTypeface(aVar.w());
                c.f.setText(c0837m1.getString(2131951755));
                c.d.setTypeface(aVar.x());
                TextView textView2 = c.d;
                u2.p pVar = new u2.p();
                String string = c0837m1.getString(2131951813, new Object[]{c0837m1.P3().M()});
                kotlin.jvm.internal.m.d(string, "getString(...)");
                String M3 = c0837m1.P3().M();
                kotlin.jvm.internal.m.b(M3);
                Context context = view.getContext();
                kotlin.jvm.internal.m.d(context, "getContext(...)");
                textView2.setText(pVar.d(string, M3, context));
                c.c.setTypeface(aVar.w());
                c.e.setTypeface(aVar.w());
                c.e.setText(c0837m1.getString(2131951920));
                c.c.setVisibility(0);
                c.c.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view3) {
                        C0837m1.K2(C0837m1.this, view3);
                    }
                });
                c.e.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view3) {
                        C0837m1.L2(C0837m1.this, view3);
                    }
                });
                c.b.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view3) {
                        C0837m1.M2(C0837m1.this, view3);
                    }
                });
                AlertDialog.Builder builder = new AlertDialog.Builder(c0837m1.requireContext());
                builder.setView(c.getRoot());
                builder.setCancelable(true);
                c0837m1.I6(builder);
            }
        }
    }

    public static final void J3(C0837m1 c0837m1, View view) {
        c0837m1.Z2();
    }

    private final void J4(g2.L l) {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new C0856s(l, null), 2, (Object) null);
        C0880s1 U3 = U3();
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        U3.p0(requireContext, l);
    }

    public static final void J5(C0617y0 c0617y0, C0837m1 c0837m1, View view) {
        if (c0617y0.n.getMaxLines() == Integer.MAX_VALUE) {
            c0617y0.n.setMaxLines(4);
            c0617y0.s.setText(c0837m1.getString(2131952541));
        } else {
            c0617y0.n.setMaxLines(Integer.MAX_VALUE);
            c0617y0.s.setText(c0837m1.getString(2131952540));
        }
    }

    private final void J6() {
        S.b bVar = g2.S.m;
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        g2.S e = bVar.e(requireContext);
        boolean z = e != null && e.n();
        if (getContext() == null || P3().d() != 1 || z) {
            return;
        }
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        long s = c0191a.s(requireContext2);
        if (s != 0 && System.currentTimeMillis() - s < 86400000) {
            return;
        }
        try {
            MBNewInterstitialHandler mBNewInterstitialHandler = new MBNewInterstitialHandler(requireContext(), "1525209", "3361225");
            mBNewInterstitialHandler.setInterstitialVideoListener(new S(mBNewInterstitialHandler));
            mBNewInterstitialHandler.playVideoMute(1);
            mBNewInterstitialHandler.load();
        } catch (Exception e4) {
            e4.printStackTrace();
            Bundle bundle = new Bundle();
            bundle.putString("type", "exception");
            new u2.z(getContext()).d("mintegral_interstitial", bundle);
        }
    }

    public static final void K2(C0837m1 c0837m1, View view) {
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    public static final R2.s K3() {
        DownloadWorker.a aVar = DownloadWorker.d;
        if (aVar.h()) {
            aVar.o();
        }
        return R2.s.a;
    }

    private final void K4() {
        S.b bVar = g2.S.m;
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        g2.S e = bVar.e(requireContext);
        boolean z = e != null && e.n();
        if (P3().d() != 1 || z) {
            Q3().D.setVisibility(8);
            Q3().D.release();
            return;
        }
        try {
            Q3().D.init(new BannerSize(5, getResources().getDisplayMetrics().widthPixels, (int) getResources().getDimension(2131166074)), "1517644", "3351941");
            Q3().D.setAllowShowCloseBtn(true);
            Q3().D.setRefreshTime(15);
            Q3().D.setBannerAdListener(new C0857t());
            Q3().D.load();
        } catch (Exception e4) {
            e4.printStackTrace();
            Bundle bundle = new Bundle();
            bundle.putString("type", "exception");
            new u2.z(getContext()).d("mintegral_banner", bundle);
            Q3().D.setVisibility(8);
            Q3().D.release();
        }
    }

    public static final void K5(C0837m1 c0837m1, g2.L l, View view) {
        UptodownApp.a aVar = UptodownApp.F;
        if (aVar.a0()) {
            Intent intent = new Intent((Context) c0837m1.requireActivity(), (Class<?>) RepliesActivity.class);
            intent.putExtra("review", l);
            intent.putExtra("appName", c0837m1.P3().M());
            FragmentActivity requireActivity = c0837m1.requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            c0837m1.startActivity(intent, aVar.a(requireActivity));
        }
    }

    public final void K6(int i) {
        Menu menu = this.g;
        if (menu != null) {
            kotlin.jvm.internal.m.b(menu);
            menu.findItem(i).setVisible(true);
        }
    }

    public static final void L2(C0837m1 c0837m1, View view) {
        C0880s1 U3 = c0837m1.U3();
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        U3.u(requireContext, c0837m1.P3().e());
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    private final void L3() {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), (V2.g) null, (o3.L) null, new C0851n(null), 3, (Object) null);
    }

    private final void L4() {
        if (P3().z() != null) {
            com.squareup.picasso.w l = com.squareup.picasso.s.h().l(P3().z());
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            l.n(new C1255d(requireContext)).j(Q3().N.b, new C0858u());
        }
    }

    public static final void L5(C0837m1 c0837m1, C0617y0 c0617y0, g2.L l, View view) {
        if (UptodownApp.F.a0()) {
            Context requireContext = c0837m1.requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            y2.n nVar = new y2.n(requireContext);
            ImageView ivLikesCounterReview = c0617y0.d;
            kotlin.jvm.internal.m.d(ivLikesCounterReview, "ivLikesCounterReview");
            nVar.n(ivLikesCounterReview);
            if (u2.I.a.i(l.f())) {
                return;
            }
            c0837m1.J4(l);
            c0617y0.p.setText(String.valueOf(l.g() + 1));
        }
    }

    public final void L6(final ArrayList arrayList) {
        final C0609u0 c = C0609u0.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        Q3().f.addView(c.getRoot());
        Q3().f.setVisibility(0);
        TextView textView = c.g;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        c.f.setTypeface(aVar.w());
        final kotlin.jvm.internal.z zVar = new kotlin.jvm.internal.z();
        final ArrayList arrayList2 = new ArrayList();
        M1.S s = new M1.S(arrayList, new T(arrayList, arrayList2, zVar));
        c.e.setLayoutManager(new LinearLayoutManager(requireContext(), 1, false));
        c.e.setItemAnimator((RecyclerView.ItemAnimator) null);
        c.e.setAdapter(s);
        c.f.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.M6(arrayList, this, arrayList2, zVar, c, view);
            }
        });
        c.b.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.N6(C0837m1.this, c, view);
            }
        });
        c.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.O6(C0837m1.this, c, view);
            }
        });
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        y2.n nVar = new y2.n(requireActivity);
        View vBackgroundRemoteInstallDevices = c.h;
        kotlin.jvm.internal.m.d(vBackgroundRemoteInstallDevices, "vBackgroundRemoteInstallDevices");
        nVar.d(vBackgroundRemoteInstallDevices, 1.0f);
        FragmentActivity requireActivity2 = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity2, "requireActivity(...)");
        y2.n nVar2 = new y2.n(requireActivity2);
        RelativeLayout rlpRemoteInstallDevices = c.d;
        kotlin.jvm.internal.m.d(rlpRemoteInstallDevices, "rlpRemoteInstallDevices");
        nVar2.h(rlpRemoteInstallDevices, 2130772030);
    }

    public static final void M2(C0837m1 c0837m1, View view) {
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    private final void M3() {
        String t02;
        String k = P3().k();
        if (k == null || k.length() == 0) {
            return;
        }
        if (Q3().Z.getVisibility() != 0) {
            Q3().f195t0.setText(2131952541);
            Q3().Z.setVisibility(0);
            Q3().r.setVisibility(8);
            Q3().S.setVisibility(8);
            Q3().e0.setMaxLines(6);
            Q3().e0.setEllipsize(TextUtils.TruncateAt.END);
            Q3().M.setVisibility(8);
            Q3().a0.smoothScrollTo(0, Q3().O.r.getBottom(), 1000);
            return;
        }
        Q3().f195t0.setText(2131952540);
        Q3().Z.setVisibility(8);
        LinearLayout llFaqsContainerAppDetails = Q3().r;
        kotlin.jvm.internal.m.d(llFaqsContainerAppDetails, "llFaqsContainerAppDetails");
        if (llFaqsContainerAppDetails.getChildCount() != 0) {
            Q3().r.setVisibility(0);
        }
        String A02 = P3().A0();
        if ((A02 != null && A02.length() != 0) || ((t02 = P3().t0()) != null && t02.length() != 0)) {
            Q3().S.setVisibility(0);
        }
        Q3().e0.setMaxLines(Integer.MAX_VALUE);
        Q3().e0.setEllipsize(null);
        String t = P3().t();
        if (t == null || t.length() == 0) {
            return;
        }
        Q3().M.setVisibility(0);
    }

    public final void M4(int i) {
        if (P3().O()) {
            return;
        }
        P3().R0(true);
        Bundle bundle = new Bundle();
        bundle.putString("appId", String.valueOf(P3().e()));
        bundle.putString("type", "noCompatibleFile");
        bundle.putInt("installed", i);
        u2.z zVar = this.d;
        if (zVar != null) {
            zVar.d("app_details", bundle);
        }
    }

    public static final void M5(C0837m1 c0837m1, View view) {
        c0837m1.P6();
    }

    public static final void M6(ArrayList arrayList, C0837m1 c0837m1, ArrayList arrayList2, kotlin.jvm.internal.z zVar, C0609u0 c0609u0, View view) {
        g2.V v;
        int size = arrayList.size();
        int i = 0;
        while (true) {
            if (i >= size) {
                v = 0;
                break;
            }
            v = arrayList.get(i);
            i++;
            if (((g2.V) v).d() == 1) {
                break;
            }
        }
        g2.V v3 = v;
        if (v3 != null) {
            C0880s1 U3 = c0837m1.U3();
            Context requireContext = c0837m1.requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            U3.s0(requireContext, c0837m1.P3().e(), v3, arrayList2);
        }
        if (zVar.a && c0837m1.P3().H0() && c0837m1.P3().E0()) {
            Context requireContext2 = c0837m1.requireContext();
            kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
            c0837m1.E3(requireContext2);
        }
        c0837m1.Y2(c0609u0);
    }

    public final java.lang.Object N2(V2.d r7) {
        throw new UnsupportedOperationException("Method not decompiled: d2.C0837m1.N2(V2.d):java.lang.Object");
    }

    private final void N3() {
        String N3 = P3().N();
        if (N3 == null || N3.length() == 0) {
            return;
        }
        if (Q3().T.e.getVisibility() == 0) {
            Q3().T.b.setText(2131952540);
            Q3().T.e.setVisibility(8);
            Q3().T.d.setMaxLines(Integer.MAX_VALUE);
            Q3().T.d.setEllipsize(null);
            return;
        }
        Q3().T.b.setText(2131952541);
        Q3().T.e.setVisibility(0);
        Q3().T.d.setMaxLines(6);
        Q3().T.d.setEllipsize(TextUtils.TruncateAt.END);
        Q3().a0.smoothScrollTo(0, Q3().T.c.getTop(), 1000);
    }

    private final void N4(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("type", str);
        bundle.putString("packagename", P3().R());
        if (P3().e() >= 0) {
            bundle.putString("appId", String.valueOf(P3().e()));
        }
        if (P3().A() >= 0) {
            bundle.putString("fileId", String.valueOf(P3().A()));
        }
        if (D4()) {
            bundle.putInt("deeplink", 1);
        } else {
            bundle.putInt("deeplink", 0);
        }
        u2.z zVar = this.d;
        if (zVar != null) {
            zVar.d("warning", bundle);
        }
    }

    public final void N5(ArrayList arrayList) {
        LinearLayout llReviewListContainer = Q3().y;
        kotlin.jvm.internal.m.d(llReviewListContainer, "llReviewListContainer");
        if (llReviewListContainer.getChildCount() != 0 || getContext() == null) {
            return;
        }
        if (arrayList == null || arrayList.isEmpty()) {
            Q3().y.setVisibility(8);
            Q3().K.setVisibility(8);
            return;
        }
        int dimension = (int) getResources().getDimension(2131166020);
        if (m3.m.p(getString(2131952586), "phone", true)) {
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
            layoutParams.setMargins(dimension, dimension, dimension, dimension);
            Iterator it = arrayList.iterator();
            kotlin.jvm.internal.m.d(it, "iterator(...)");
            while (it.hasNext()) {
                Object next = it.next();
                kotlin.jvm.internal.m.d(next, "next(...)");
                g2.L l = (g2.L) next;
                if (l.o()) {
                    LinearLayout linearLayout = Q3().y;
                    Context requireContext = requireContext();
                    kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
                    linearLayout.addView(G5(layoutParams, l, requireContext));
                } else {
                    LinearLayout linearLayout2 = Q3().y;
                    Context requireContext2 = requireContext();
                    kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
                    linearLayout2.addView(z5(layoutParams, l, requireContext2));
                }
            }
            return;
        }
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -2);
        layoutParams2.setMargins(dimension, dimension, dimension, dimension);
        for (int i = 0; i < arrayList.size(); i += 2) {
            LinearLayout linearLayout3 = new LinearLayout(getContext());
            linearLayout3.setOrientation(0);
            linearLayout3.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
            LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, -2);
            layoutParams3.setMargins(dimension, dimension, dimension, dimension);
            layoutParams3.weight = 1.0f;
            if (((g2.L) arrayList.get(i)).o()) {
                Object obj = arrayList.get(i);
                kotlin.jvm.internal.m.d(obj, "get(...)");
                Context requireContext3 = requireContext();
                kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
                linearLayout3.addView(G5(layoutParams2, (g2.L) obj, requireContext3));
            } else {
                Object obj2 = arrayList.get(i);
                kotlin.jvm.internal.m.d(obj2, "get(...)");
                Context requireContext4 = requireContext();
                kotlin.jvm.internal.m.d(requireContext4, "requireContext(...)");
                linearLayout3.addView(z5(layoutParams3, (g2.L) obj2, requireContext4));
            }
            int i4 = i + 1;
            if (i4 < arrayList.size()) {
                LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(-1, -2);
                layoutParams4.setMargins(dimension, dimension, 0, dimension);
                layoutParams4.weight = 1.0f;
                if (!((g2.L) arrayList.get(i4)).o()) {
                    Object obj3 = arrayList.get(i4);
                    kotlin.jvm.internal.m.d(obj3, "get(...)");
                    Context requireContext5 = requireContext();
                    kotlin.jvm.internal.m.d(requireContext5, "requireContext(...)");
                    linearLayout3.addView(z5(layoutParams4, (g2.L) obj3, requireContext5));
                }
            } else {
                linearLayout3.addView(F5(layoutParams3));
            }
            Q3().y.addView(linearLayout3);
        }
    }

    public static final void N6(C0837m1 c0837m1, C0609u0 c0609u0, View view) {
        c0837m1.Y2(c0609u0);
    }

    public final void O3() {
        if (getContext() != null) {
            UptodownApp.a aVar = UptodownApp.F;
            if (aVar.v() > 0) {
                Q3().N.b.setLayoutParams(new RelativeLayout.LayoutParams(-1, aVar.v()));
                Q3().d.setScrimVisibleHeightTrigger((int) (aVar.v() * 0.4d));
            }
        }
    }

    public static final void O4(C0837m1 c0837m1, ActivityResult activityResult) {
        if (activityResult.getResultCode() == 1) {
            S.b bVar = g2.S.m;
            Context requireContext = c0837m1.requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            g2.S e = bVar.e(requireContext);
            if ((e != null ? e.g() : null) != null) {
                Context requireContext2 = c0837m1.requireContext();
                kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
                if (e.m(requireContext2)) {
                    UptodownApp.a aVar = UptodownApp.F;
                    Context requireContext3 = c0837m1.requireContext();
                    kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
                    aVar.m0(requireContext3);
                    Context requireContext4 = c0837m1.requireContext();
                    kotlin.jvm.internal.m.d(requireContext4, "requireContext(...)");
                    aVar.l0(requireContext4);
                    c0837m1.X5();
                    c0837m1.U2();
                }
            }
        }
    }

    public final void O5(ArrayList arrayList, ArrayList arrayList2) {
        if (arrayList.isEmpty()) {
            Q3().W.setVisibility(8);
            return;
        }
        ArrayList arrayList3 = new ArrayList();
        if (!arrayList2.isEmpty()) {
            int size = arrayList2.size();
            int i = 0;
            while (i < size) {
                Object obj = arrayList2.get(i);
                i++;
                g2.X x = (g2.X) obj;
                String b = x.b();
                if (b != null && b.length() != 0) {
                    arrayList3.add(x);
                }
            }
        }
        ArrayList arrayList4 = new ArrayList();
        int size2 = arrayList.size();
        for (int i4 = 0; i4 < size2; i4++) {
            Object obj2 = arrayList.get(i4);
            kotlin.jvm.internal.m.d(obj2, "get(...)");
            g2.M m = (g2.M) obj2;
            if (m.a() == 0) {
                arrayList4.add(m);
            }
        }
        kotlin.jvm.internal.C c = new kotlin.jvm.internal.C();
        K k = new K(arrayList4, c, arrayList3);
        ArrayList arrayList5 = new ArrayList();
        arrayList5.addAll(arrayList3);
        arrayList5.addAll(arrayList4);
        c.a = new M1.B(arrayList5, k);
        Q3().W.setAdapter((RecyclerView.Adapter) c.a);
        Q3().W.setVisibility(0);
    }

    public static final void O6(C0837m1 c0837m1, C0609u0 c0609u0, View view) {
        c0837m1.Y2(c0609u0);
    }

    private final void P2() {
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public final void run() {
                C0837m1.Q2(C0837m1.this);
            }
        }, DefaultRenderersFactory.DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS);
    }

    public final void P4() {
        S.b bVar = g2.S.m;
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        bVar.a(requireContext);
        Z4();
    }

    public final void P5(ArrayList arrayList, boolean z) {
        if (getContext() == null || arrayList == null || arrayList.isEmpty()) {
            Q3().R.setVisibility(8);
            return;
        }
        M1.I i = new M1.I(new L(), new M(), z ? 25 : 20);
        this.h = i;
        kotlin.jvm.internal.m.b(i);
        i.d(arrayList);
        Q3().X.setAdapter(this.h);
        Q3().X.setNestedScrollingEnabled(false);
        Q3().X.setItemAnimator((RecyclerView.ItemAnimator) null);
        Q3().X.setLayoutManager(new LinearLayoutManager(getContext(), 0, false));
        Q3().R.setVisibility(0);
    }

    public final void P6() {
        if (getContext() != null) {
            CustomTabsIntent build = new CustomTabsIntent.Builder().build();
            kotlin.jvm.internal.m.d(build, "build(...)");
            O.a aVar = u2.O.b;
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            build.intent.setData(Uri.parse(new u2.p().c(aVar.c(requireContext))));
            ActivityResultLauncher activityResultLauncher = this.m;
            Intent intent = build.intent;
            UptodownApp.a aVar2 = UptodownApp.F;
            FragmentActivity requireActivity = requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            activityResultLauncher.launch(intent, aVar2.b(requireActivity));
        }
    }

    public static final void Q2(C0837m1 c0837m1) {
        if (c0837m1.getContext() != null) {
            a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
            Context requireContext = c0837m1.requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            if (!c0191a.M(requireContext)) {
                c0837m1.b6();
            } else if (c0837m1.Q3().e.getChildCount() > 0) {
                c0837m1.Q3().e.removeAllViews();
            }
        }
    }

    public final C0571b Q3() {
        C0571b c0571b = this.b;
        kotlin.jvm.internal.m.b(c0571b);
        return c0571b;
    }

    private final void Q4() {
        throw new UnsupportedOperationException("Method not decompiled: d2.C0837m1.Q4():void");
    }

    public final void Q5(ArrayList arrayList) {
        LinearLayout llFloatingCategoriesAppDetail = Q3().s;
        kotlin.jvm.internal.m.d(llFloatingCategoriesAppDetail, "llFloatingCategoriesAppDetail");
        if (llFloatingCategoriesAppDetail.getChildCount() == 0) {
            Q3().k0.setVisibility(8);
            if (getActivity() != null) {
                Iterator it = arrayList.iterator();
                int i = 0;
                while (it.hasNext()) {
                    int i4 = i + 1;
                    final g2.O o = (g2.O) it.next();
                    c2.K c = c2.K.c(getLayoutInflater());
                    kotlin.jvm.internal.m.d(c, "inflate(...)");
                    if (i > 0) {
                        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
                        layoutParams.setMargins(0, (int) getResources().getDimension(2131166019), 0, 0);
                        c.getRoot().setLayoutParams(layoutParams);
                    }
                    M1.I i5 = new M1.I(new N(), new O(), 20);
                    i5.d(o.a());
                    c.e.setTypeface(N1.k.g.w());
                    c.e.setText(o.b().d());
                    c.c.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public final void onClick(View view) {
                            C0837m1.R5(C0837m1.this, o, view);
                        }
                    });
                    c.d.setAdapter(i5);
                    c.d.setNestedScrollingEnabled(false);
                    c.d.setLayoutManager(new LinearLayoutManager(getContext(), 0, false));
                    DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
                    defaultItemAnimator.setSupportsChangeAnimations(false);
                    c.d.setItemAnimator(defaultItemAnimator);
                    Q3().s.addView(c.getRoot());
                    this.j.add(i5);
                    i = i4;
                }
            }
            Q3().t.setVisibility(0);
        }
    }

    public final void Q6(Context context) {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), (V2.g) null, (o3.L) null, new W(context, null), 3, (Object) null);
    }

    private final void R2(int i, String str, long j) {
        if (getContext() == null || i < 0) {
            return;
        }
        C0973y.a aVar = C0973y.f;
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        C0973y b = aVar.b(requireContext);
        if (b != null && b.c() == -1 && kotlin.jvm.internal.m.a(b.d(), str) && b.b() == j) {
            Context requireContext2 = requireContext();
            kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
            b.l(requireContext2, i);
        }
    }

    private final void R3() {
        if (P3().e() > 0) {
            w5();
            x2();
            R2.s sVar = R2.s.a;
        } else {
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            new C0560i(requireContext, ((Number) U3().C().getValue()).longValue(), new C0852o(), LifecycleOwnerKt.getLifecycleScope(this));
        }
    }

    public final void R4(C0952c c0952c) {
        if (getActivity() != null && (getActivity() instanceof MainActivity)) {
            MainActivity activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.MainActivity");
            activity.a8(c0952c);
        } else {
            if (getActivity() == null || !(getActivity() instanceof AppDetailActivity)) {
                return;
            }
            AppDetailActivity activity2 = getActivity();
            kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.AppDetailActivity");
            activity2.t3(c0952c);
        }
    }

    public static final void R5(C0837m1 c0837m1, g2.O o, View view) {
        if (UptodownApp.F.a0()) {
            c0837m1.V4(o.b());
        }
    }

    private final void R6() {
        Q3().O.e.setVisibility(0);
        Q3().O.c.setVisibility(8);
        Q3().L.f.setVisibility(0);
        Q3().L.h.setVisibility(0);
        Q3().L.i.setVisibility(8);
        Q3().L.j.setVisibility(8);
        Q3().H.n.setVisibility(0);
        Q3().H.f.setVisibility(8);
        Q3().H.j.setVisibility(8);
    }

    public final Object S2(Context context, V2.d dVar) {
        kotlin.jvm.internal.C c = new kotlin.jvm.internal.C();
        kotlin.jvm.internal.z zVar = new kotlin.jvm.internal.z();
        kotlin.jvm.internal.z zVar2 = new kotlin.jvm.internal.z();
        String R3 = P3().R();
        if (R3 == null || R3.length() == 0) {
            Object g = o3.g.g(o3.Y.c(), new C0846i(null), dVar);
            return g == W2.b.c() ? g : R2.s.a;
        }
        U3().Q().setValue(new C1233m().D(context, P3().R()));
        u2.v a = u2.v.v.a(context);
        a.a();
        if (U3().Q().getValue() != null) {
            r3.t h0 = U3().h0();
            String R4 = P3().R();
            kotlin.jvm.internal.m.b(R4);
            h0.setValue(a.C0(R4));
            g2.P p = (g2.P) U3().h0().getValue();
            c.a = p != null ? p.b(context) : null;
        } else {
            c.a = a.d0(String.valueOf(P3().A()));
        }
        C0965p c0965p = (C0965p) c.a;
        zVar.a = c0965p != null && c0965p.L();
        a.i();
        C0965p c0965p2 = (C0965p) c.a;
        zVar2.a = c0965p2 != null && c0965p2.E() == P3().I();
        Object g4 = o3.g.g(o3.Y.c(), new C0845h(context, c, zVar, zVar2, null), dVar);
        return g4 == W2.b.c() ? g4 : R2.s.a;
    }

    public final void S3() {
        if (getContext() != null) {
            o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new C0853p(null), 2, (Object) null);
            C0880s1 U3 = U3();
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            U3.U(requireContext, P3().e());
        }
    }

    private final void S4() {
        String R3;
        if (getActivity() == null || requireActivity().isFinishing() || (R3 = P3().R()) == null || R3.length() == 0 || m3.m.p(P3().R(), requireActivity().getPackageName(), true)) {
            return;
        }
        PackageManager packageManager = requireActivity().getPackageManager();
        String R4 = P3().R();
        kotlin.jvm.internal.m.b(R4);
        Intent launchIntentForPackage = packageManager.getLaunchIntentForPackage(R4);
        if (launchIntentForPackage != null) {
            startActivity(launchIntentForPackage);
        }
    }

    private final void S5() {
        boolean z;
        boolean z3;
        boolean z4;
        String X3;
        if (!P3().E0()) {
            N4("no_file_id");
            String string = getString(2131952290);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            j3(string);
            return;
        }
        C0965p c0965p = new C0965p();
        c0965p.c(P3());
        if (P3().L0() && (X3 = P3().X()) != null && X3.length() != 0) {
            g2.r rVar = new g2.r();
            long e = P3().e();
            String X4 = P3().X();
            kotlin.jvm.internal.m.b(X4);
            rVar.a(e, X4);
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            rVar.f(requireContext);
        }
        C0964o c0964o = new C0964o();
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        c0964o.k(requireContext2);
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        Context requireContext3 = requireContext();
        kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
        boolean n12 = c0191a.n1(requireContext3);
        boolean z5 = true;
        if (n12) {
            boolean i = c0964o.i(c0965p);
            z4 = c0964o.g(c0965p);
            z = c0964o.h(c0965p);
            if (P3().i0() != null) {
                ArrayList i0 = P3().i0();
                kotlin.jvm.internal.m.b(i0);
                Context requireContext4 = requireContext();
                kotlin.jvm.internal.m.d(requireContext4, "requireContext(...)");
                z3 = c0964o.f(i0, requireContext4);
                z5 = i;
            } else {
                z5 = i;
                z3 = true;
            }
        } else {
            z = true;
            z3 = true;
            z4 = true;
        }
        if (z5 && z4 && z && z3) {
            V2();
            return;
        }
        if (!z5) {
            N4("sdk");
            String string2 = getString(2131952321);
            kotlin.jvm.internal.m.d(string2, "getString(...)");
            c3(string2);
            return;
        }
        if (!z4) {
            N4("abi");
            String string3 = getString(2131952317);
            kotlin.jvm.internal.m.d(string3, "getString(...)");
            c3(string3);
            return;
        }
        if (z) {
            N4("required_feature");
            String string4 = getString(2131952319);
            kotlin.jvm.internal.m.d(string4, "getString(...)");
            c3(string4);
            return;
        }
        N4("density");
        String string5 = getString(2131952318);
        kotlin.jvm.internal.m.d(string5, "getString(...)");
        c3(string5);
    }

    private final void S6() {
        Q3().O.e.setVisibility(8);
        Q3().O.c.setVisibility(0);
        Q3().L.f.setVisibility(0);
        Q3().L.h.setVisibility(0);
        Q3().L.b.setVisibility(8);
        Q3().L.i.setVisibility(8);
        Q3().H.g.setVisibility(8);
        Q3().H.n.setVisibility(8);
        Q3().H.f.setVisibility(0);
        Q3().H.j.setVisibility(8);
    }

    private final void T2() {
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        if (!activity.S()) {
            AbstractC0740a activity2 = getActivity();
            kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            activity2.m0();
            return;
        }
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        if (c0191a.Y(requireContext)) {
            k6();
        } else {
            e7();
        }
    }

    private final long T3() {
        try {
            String o02 = P3().o0();
            if (o02 != null && o02.length() != 0) {
                String o03 = P3().o0();
                kotlin.jvm.internal.m.b(o03);
                return Long.parseLong(o03);
            }
            return 0L;
        } catch (NumberFormatException e) {
            e.printStackTrace();
            return 0L;
        }
    }

    private final void T4() {
        if (getActivity() == null || requireActivity().isFinishing()) {
            return;
        }
        Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
        intent.setData(Uri.fromParts("package", P3().R(), null));
        intent.addFlags(268435456);
        intent.addFlags(8388608);
        try {
            startActivity(intent);
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
        }
    }

    private final void T5() {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new P(null), 2, (Object) null);
    }

    private final void T6() {
        Q3().O.e.setVisibility(0);
        Q3().O.c.setVisibility(8);
        Q3().L.f.setVisibility(8);
        Q3().L.h.setVisibility(8);
        Q3().L.b.setVisibility(8);
        Q3().L.i.setVisibility(0);
        Q3().L.j.setVisibility(8);
        Q3().H.n.setVisibility(8);
        Q3().H.f.setVisibility(8);
        Q3().H.j.setVisibility(0);
    }

    private final void U2() {
        if (P3().K0()) {
            o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new C0847j(null), 2, (Object) null);
            C0880s1 U3 = U3();
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            U3.v(requireContext, P3().e());
        }
    }

    public final C0880s1 U3() {
        return (C0880s1) this.c.getValue();
    }

    private final void U4() {
        if (getContext() != null) {
            v.a aVar = u2.v.v;
            FragmentActivity requireActivity = requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            u2.v a = aVar.a(requireActivity);
            a.a();
            String R3 = P3().R();
            kotlin.jvm.internal.m.b(R3);
            C0953d W3 = a.W(R3);
            a.i();
            Intent intent = new Intent((Context) requireActivity(), (Class<?>) AppInstalledDetailsActivity.class);
            intent.putExtra("appInstalled", W3);
            intent.putExtra("appInfo", P3());
            UptodownApp.a aVar2 = UptodownApp.F;
            FragmentActivity requireActivity2 = requireActivity();
            kotlin.jvm.internal.m.d(requireActivity2, "requireActivity(...)");
            startActivity(intent, aVar2.a(requireActivity2));
        }
    }

    private final void U6() {
        Q3().O.e.setVisibility(0);
        Q3().O.c.setVisibility(8);
        Q3().L.f.setVisibility(0);
        Q3().L.h.setVisibility(0);
        Q3().L.b.setVisibility(8);
        Q3().L.i.setVisibility(8);
        Q3().L.j.setVisibility(8);
        Q3().H.h.setVisibility(0);
        Q3().H.n.setVisibility(8);
        Q3().H.g.setVisibility(8);
        Q3().H.f.setVisibility(8);
        Q3().H.j.setVisibility(8);
    }

    private final void V2() {
        if (getActivity() == null || requireActivity().isFinishing()) {
            return;
        }
        S.b bVar = g2.S.m;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        g2.S e = bVar.e(requireActivity);
        if (e == null || !e.n()) {
            H3();
            R2.s sVar = R2.s.a;
            return;
        }
        if (P3().h0() == null) {
            FragmentActivity requireActivity2 = requireActivity();
            kotlin.jvm.internal.m.d(requireActivity2, "requireActivity(...)");
            new b2.m(requireActivity2, String.valueOf(P3().A()), P3().l0(), new C0848k(), LifecycleOwnerKt.getLifecycleScope(this));
            return;
        }
        C0948I h0 = P3().h0();
        kotlin.jvm.internal.m.b(h0);
        if (h0.d() > 0) {
            AbstractC0740a activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            activity.e2(P3(), new d3.a() {
                @Override
                public final Object invoke() {
                    R2.s W22;
                    W22 = C0837m1.W2(C0837m1.this);
                    return W22;
                }
            }, new d3.a() {
                @Override
                public final Object invoke() {
                    R2.s X22;
                    X22 = C0837m1.X2(C0837m1.this);
                    return X22;
                }
            });
        } else {
            H3();
        }
        R2.s sVar2 = R2.s.a;
    }

    public final boolean V3() {
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        if (!activity.S() || getContext() == null) {
            return true;
        }
        u2.y yVar = new u2.y();
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        File e = yVar.e(requireContext);
        C1221a c1221a = new C1221a();
        u2.y yVar2 = new u2.y();
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        return c1221a.a(yVar2.j(requireContext2, e), T3());
    }

    public final void V4(C0957h c0957h) {
        if (getActivity() != null && (getActivity() instanceof MainActivity)) {
            MainActivity activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.MainActivity");
            activity.c8(c0957h);
        } else {
            if (getActivity() == null || !(getActivity() instanceof AppDetailActivity)) {
                return;
            }
            AppDetailActivity activity2 = getActivity();
            kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.AppDetailActivity");
            activity2.u3(c0957h);
        }
    }

    public final void V5(View view, Context context) {
        ViewTreeObserver viewTreeObserver;
        if (!com.uptodown.activities.preferences.a.a.K(context) || view == null || (viewTreeObserver = view.getViewTreeObserver()) == null) {
            return;
        }
        viewTreeObserver.addOnPreDrawListener(new Q(view, this));
    }

    private final void V6(Context context) {
        Q3().f185F0.setVisibility(8);
        Q3().b0.setBackgroundColor(ContextCompat.getColor(context, 2131100655));
        if (new u2.p().o(context)) {
            d6(ContextCompat.getColor(context, 2131100314));
            Drawable drawable = ContextCompat.getDrawable(context, N1.e.c);
            if (drawable != null) {
                Q3().b0.setNavigationIcon(drawable);
            }
            Drawable drawable2 = ContextCompat.getDrawable(context, N1.e.f);
            if (drawable2 != null) {
                Q3().b0.setOverflowIcon(drawable2);
            }
        }
    }

    public static final R2.s W2(C0837m1 c0837m1) {
        c0837m1.H3();
        return R2.s.a;
    }

    public final void W3(int i) {
        Menu menu = this.g;
        if (menu != null) {
            kotlin.jvm.internal.m.b(menu);
            menu.findItem(i).setVisible(false);
        }
    }

    private final void W4() {
        if (getActivity() == null || requireActivity().isFinishing()) {
            return;
        }
        String string = getString(2131951949);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        String string2 = getString(2131952788);
        kotlin.jvm.internal.m.d(string2, "getString(...)");
        u2.p pVar = new u2.p();
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        pVar.p(requireActivity, string2, string);
    }

    private final void W5(String str) {
        int intValue = ((Number) U3().Y().getValue()).intValue();
        if (1 > intValue || intValue >= 6) {
            AbstractC0740a activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            String string = getString(2131952015);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            activity.r0(string);
            return;
        }
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new R(null), 2, (Object) null);
        C0880s1 U3 = U3();
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        U3.t0(requireContext, str, ((Number) U3().Y().getValue()).intValue(), P3().e());
    }

    public final void W6(Context context) {
        Q3().f185F0.setVisibility(0);
        Q3().b0.setBackgroundColor(ContextCompat.getColor(context, 2131100655));
        d6(ContextCompat.getColor(context, 2131100688));
        Drawable drawable = ContextCompat.getDrawable(context, 2131231396);
        if (drawable != null) {
            Q3().b0.setNavigationIcon(drawable);
        }
        Drawable drawable2 = ContextCompat.getDrawable(context, 2131231447);
        if (drawable2 != null) {
            Q3().b0.setOverflowIcon(drawable2);
        }
    }

    public static final R2.s X2(C0837m1 c0837m1) {
        FragmentActivity requireActivity = c0837m1.requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        c0837m1.H2(requireActivity);
        return R2.s.a;
    }

    private final void X3() {
        S6();
        C1254c c1254c = C1254c.a;
        ProgressBar pbProgressAppDetail = Q3().O.h;
        kotlin.jvm.internal.m.d(pbProgressAppDetail, "pbProgressAppDetail");
        ImageView ivLogoAppDetail = Q3().O.b;
        kotlin.jvm.internal.m.d(ivLogoAppDetail, "ivLogoAppDetail");
        c1254c.e(pbProgressAppDetail, ivLogoAppDetail);
        U3().P().setValue(-1);
        Q3().L.i.setVisibility(8);
        Q3().L.j.setVisibility(8);
        Q3().L.f.setVisibility(8);
        Q3().L.g.setVisibility(0);
        Q3().O.h.setIndeterminate(true);
        Q3().O.t.setText(getString(2131952659));
        Q3().H.j.setVisibility(8);
        Q3().H.b.setVisibility(4);
        Q3().H.m.setText(TtmlNode.ANONYMOUS_REGION_ID);
        Q3().H.e.setIndeterminate(true);
        Q3().H.k.setText(TtmlNode.ANONYMOUS_REGION_ID);
    }

    private final void X4(String str, Context context) {
        u2.p pVar = new u2.p();
        AppCompatActivity activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        u2.p.q(pVar, (AbstractC0740a) activity, str, null, 4, null);
        U3().o0(context, P3().e());
    }

    private final void X5() {
        if (((CharSequence) U3().a0().getValue()).length() > 0) {
            W5((String) U3().a0().getValue());
            AbstractC0740a activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k22 = activity.k2();
            if (k22 != null) {
                k22.dismiss();
            }
        }
    }

    private final void Y2(C0609u0 c0609u0) {
        if (U3().z().compareAndSet(false, true)) {
            FragmentActivity requireActivity = requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            y2.n nVar = new y2.n(requireActivity);
            View vBackgroundRemoteInstallDevices = c0609u0.h;
            kotlin.jvm.internal.m.d(vBackgroundRemoteInstallDevices, "vBackgroundRemoteInstallDevices");
            nVar.d(vBackgroundRemoteInstallDevices, 0.0f);
            FragmentActivity requireActivity2 = requireActivity();
            kotlin.jvm.internal.m.d(requireActivity2, "requireActivity(...)");
            y2.n nVar2 = new y2.n(requireActivity2);
            RelativeLayout rlpRemoteInstallDevices = c0609u0.d;
            kotlin.jvm.internal.m.d(rlpRemoteInstallDevices, "rlpRemoteInstallDevices");
            nVar2.g(rlpRemoteInstallDevices, 2130772034, new AnimationAnimationListenerC0849l());
        }
    }

    private final void Y3(final Context context) {
        if (new u2.p().o(context)) {
            Q3().b0.setTitleTextColor(ContextCompat.getColor(requireActivity(), 2131100314));
        }
        Q3().b0.setNavigationIcon(ContextCompat.getDrawable(context, 2131231396));
        Q3().b0.setNavigationContentDescription(getString(2131951721));
        Q3().b0.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.Z3(C0837m1.this, view);
            }
        });
        Q3().b0.inflateMenu(2131689477);
        this.g = Q3().b0.getMenu();
        Q3().b0.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
            public final boolean onMenuItemClick(MenuItem menuItem) {
                boolean k4;
                k4 = C0837m1.k4(C0837m1.this, menuItem);
                return k4;
            }
        });
        CollapsingToolbarLayout collapsingToolbarLayout = Q3().d;
        k.a aVar = N1.k.g;
        collapsingToolbarLayout.setCollapsedTitleTypeface(aVar.w());
        Q3().b.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
            @Override
            public final void onOffsetChanged(AppBarLayout appBarLayout, int i) {
                C0837m1.v4(C0837m1.this, context, appBarLayout, i);
            }
        });
        Q3().a0.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
            public final void onScrollChange(NestedScrollView nestedScrollView, int i, int i4, int i5, int i6) {
                C0837m1.w4(C0837m1.this, nestedScrollView, i, i4, i5, i6);
            }
        });
        if (((Number) U3().C().getValue()).longValue() == -1) {
            if (getActivity() == null || !(getActivity() instanceof MainActivity)) {
                return;
            }
            MainActivity activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.MainActivity");
            activity.getOnBackPressedDispatcher().onBackPressed();
            return;
        }
        O3();
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        if (c0191a.K(context)) {
            ImageView imageView = Q3().O.b;
            kotlin.jvm.internal.F f = kotlin.jvm.internal.F.a;
            String format = String.format("%s%s", Arrays.copyOf(new Object[]{getString(2131952695), U3().C().getValue()}, 2));
            kotlin.jvm.internal.m.d(format, "format(...)");
            imageView.setTransitionName(format);
        }
        Q3().O.l.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.x4(C0837m1.this, view);
            }
        });
        Q3().f195t0.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.y4(C0837m1.this, view);
            }
        });
        Q3().O.v.setTypeface(aVar.w());
        Q3().O.u.setTypeface(aVar.x());
        Q3().O.n.setTypeface(aVar.x());
        Q3().O.t.setTypeface(aVar.x());
        Q3().O.w.setTypeface(aVar.x());
        Q3().L.i.setTypeface(aVar.w());
        Q3().L.j.setTypeface(aVar.w());
        Q3().O.n.setTypeface(aVar.w());
        Q3().O.o.setTypeface(aVar.x());
        Q3().O.p.setTypeface(aVar.w());
        Q3().O.q.setTypeface(aVar.x());
        Q3().d0.setTypeface(aVar.x());
        Q3().T.c.setTypeface(aVar.w());
        Q3().T.d.setTypeface(aVar.x());
        Q3().T.b.setTypeface(aVar.w());
        Q3().T.b.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.z4(C0837m1.this, view);
            }
        });
        Q3().f198w0.setTypeface(aVar.x());
        Q3().O.k.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.A4(C0837m1.this, view);
            }
        });
        Q3().O.k.setFocusable(true);
        if (!c0191a.M(context)) {
            b6();
        }
        Q3().O.g.setFocusable(true);
        Q3().O.g.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.B4(C0837m1.this, context, view);
            }
        });
        Q3().C.i.setTypeface(aVar.w());
        Q3().C.i.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.a4(C0837m1.this, context, view);
            }
        });
        Q3().C.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.b4(C0837m1.this, context, view);
            }
        });
        Q3().C.j.setTypeface(aVar.w());
        Q3().W.setLayoutManager(new LinearLayoutManager(context, 0, false));
        Q3().W.addItemDecoration(new w2.p((int) getResources().getDimension(2131166020)));
        Q3().f182C0.setTypeface(aVar.w());
        Q3().f183D0.setTypeface(aVar.x());
        Q3().f181B0.setTypeface(aVar.x());
        Q3().j0.setTypeface(aVar.w());
        Q3().f194s0.setTypeface(aVar.w());
        Q3().f186G0.getRoot().setVisibility(8);
        Q3().c0.setTypeface(aVar.w());
        Q3().I.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.c4(C0837m1.this, view);
            }
        });
        Q3().f188m0.setTypeface(aVar.x());
        Q3().f187l0.setTypeface(aVar.w());
        Q3().f192q0.setTypeface(aVar.x());
        Q3().f191p0.setTypeface(aVar.w());
        Q3().f190o0.setTypeface(aVar.x());
        Q3().f189n0.setTypeface(aVar.w());
        Q3().f193r0.setTypeface(aVar.w());
        Q3().x.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.d4(C0837m1.this, view);
            }
        });
        Q3().x.setFocusable(true);
        Q3().f0.setTypeface(aVar.w());
        Q3().q.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.e4(C0837m1.this, view);
            }
        });
        Q3().q.setFocusable(true);
        Q3().z.h.post(new Runnable() {
            @Override
            public final void run() {
                C0837m1.f4(C0837m1.this);
            }
        });
        Q3().f201z0.setTypeface(aVar.w());
        Q3().C.b.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.g4(C0837m1.this, context, view);
            }
        });
        Q3().C.b.setFocusable(true);
        Q3().C.c.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.h4(C0837m1.this, context, view);
            }
        });
        Q3().C.c.setFocusable(true);
        Q3().C.d.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.i4(C0837m1.this, context, view);
            }
        });
        Q3().C.d.setFocusable(true);
        Q3().C.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.j4(C0837m1.this, context, view);
            }
        });
        Q3().C.e.setFocusable(true);
        Q3().C.f.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.l4(C0837m1.this, context, view);
            }
        });
        Q3().C.f.setFocusable(true);
        Q3().K.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.m4(C0837m1.this, view);
            }
        });
        Q3().f199x0.setTypeface(aVar.w());
        Q3().O.r.setTypeface(aVar.w());
        Q3().O.x.setTypeface(aVar.x());
        Q3().O.s.setTypeface(aVar.x());
        Q3().O.l.setTypeface(aVar.x());
        Q3().O.m.setTypeface(aVar.x());
        Q3().O.m.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.n4(C0837m1.this, view);
            }
        });
        Q3().f200y0.setTypeface(aVar.w());
        Q3().f195t0.setTypeface(aVar.w());
        Q3().e0.setTypeface(aVar.x());
        Q3().i0.setTypeface(aVar.x());
        Q3().h0.setTypeface(aVar.w());
        Q3().g0.setTypeface(aVar.x());
        Q3().z.o.setTypeface(aVar.w());
        Q3().z.q.setTypeface(aVar.w());
        Q3().z.p.setTypeface(aVar.x());
        Q3().f196u0.setTypeface(aVar.w());
        Q3().f184E0.setTypeface(aVar.w());
        C0583h rlDownloadButtonRootAppDetail = Q3().L;
        kotlin.jvm.internal.m.d(rlDownloadButtonRootAppDetail, "rlDownloadButtonRootAppDetail");
        y2(rlDownloadButtonRootAppDetail);
        C0566A rlBottomDownloadButtonAppDetail = Q3().H;
        kotlin.jvm.internal.m.d(rlBottomDownloadButtonAppDetail, "rlBottomDownloadButtonAppDetail");
        C2(rlBottomDownloadButtonAppDetail);
        String R3 = P3().R();
        if (R3 == null || R3.length() == 0 || !new C1233m().v(P3().R(), context)) {
            Q3().L.i.setVisibility(8);
        } else {
            TextView tvOpenBad = Q3().L.i;
            kotlin.jvm.internal.m.d(tvOpenBad, "tvOpenBad");
            String string = getString(2131952446);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            a6(tvOpenBad, string);
            Q3().L.i.setVisibility(0);
        }
        if (((Number) U3().P().getValue()).intValue() > -1) {
            int intValue = ((Number) U3().P().getValue()).intValue();
            if (intValue == 0) {
                q6(context);
            } else if (intValue == 1) {
                g6(context);
            } else if (intValue == 2) {
                z6(context);
            } else if (intValue == 3) {
                m6();
            } else if (intValue == 4) {
                u6();
            } else if (intValue == 5) {
                i6(null);
            }
        }
        Q3().L.c.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.o4(C0837m1.this, view);
            }
        });
        Q3().L.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.p4(C0837m1.this, view);
            }
        });
        Q3().L.d.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.q4(C0837m1.this, view);
            }
        });
        Q3().P.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.r4(C0837m1.this, view);
            }
        });
        Q3().U.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.s4(C0837m1.this, view);
            }
        });
        Q3().F.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.t4(view);
            }
        });
        L4();
        n5(context);
        U3().L().setValue(Boolean.FALSE);
        Q3().Y.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                C0837m1.u4(C0837m1.this, compoundButton, z);
            }
        });
        R3();
        K4();
    }

    private final void Y4() {
        if (requireActivity().isFinishing()) {
            return;
        }
        Intent intent = new Intent((Context) requireActivity(), (Class<?>) InformationActivity.class);
        UptodownApp.a aVar = UptodownApp.F;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        startActivity(intent, aVar.a(requireActivity));
    }

    public final void Y6(g2.L l, int i) {
        int dimension = (int) getResources().getDimension(2131166020);
        LinearLayout llReviewListContainer = Q3().y;
        kotlin.jvm.internal.m.d(llReviewListContainer, "llReviewListContainer");
        if (llReviewListContainer.getChildCount() > i) {
            Q3().y.removeViewAt(i);
        }
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
        layoutParams.setMargins(dimension, dimension, dimension, dimension);
        if (l.o()) {
            LinearLayout linearLayout = Q3().y;
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            linearLayout.addView(G5(layoutParams, l, requireContext), i);
            return;
        }
        LinearLayout linearLayout2 = Q3().y;
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        linearLayout2.addView(z5(layoutParams, l, requireContext2), i);
    }

    private final void Z2() {
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
        final kotlin.jvm.internal.z zVar = new kotlin.jvm.internal.z();
        if (F4(this, null, 1, null)) {
            DownloadWorker.a aVar = DownloadWorker.d;
            zVar.a = aVar.h();
            aVar.n();
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
        C0599p c = C0599p.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        if (getActivity() != null && !requireActivity().isFinishing()) {
            TextView textView = c.d;
            k.a aVar2 = N1.k.g;
            textView.setTypeface(aVar2.x());
            c.d.setText(requireContext().getString(2131951957));
            c.c.setTypeface(aVar2.w());
            c.c.setText(requireContext().getString(2131951921));
            c.c.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.a3(kotlin.jvm.internal.z.this, this, view);
                }
            });
            c.e.setTypeface(aVar2.w());
            c.e.setText(requireContext().getString(2131951920));
            c.e.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.b3(C0837m1.this, view);
                }
            });
        }
        builder.setView(c.getRoot());
        builder.setCancelable(false);
        I6(builder);
    }

    public static final void Z3(C0837m1 c0837m1, View view) {
        if (c0837m1.getActivity() != null) {
            if (c0837m1.getActivity() instanceof MainActivity) {
                MainActivity activity = c0837m1.getActivity();
                kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.MainActivity");
                activity.Q6();
            } else if (c0837m1.getActivity() instanceof AppDetailActivity) {
                AppCompatActivity activity2 = c0837m1.getActivity();
                kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.AppDetailActivity");
                ((AppDetailActivity) activity2).finish();
            }
        }
    }

    private final void Z4() {
        if (getActivity() == null || requireActivity().isFinishing()) {
            return;
        }
        Intent intent = new Intent((Context) requireActivity(), (Class<?>) LoginActivity.class);
        ActivityResultLauncher activityResultLauncher = this.l;
        UptodownApp.a aVar = UptodownApp.F;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        activityResultLauncher.launch(intent, aVar.b(requireActivity));
    }

    public final void Z5(TextView textView, String str) {
        textView.setText(str);
        w2.v.a(textView);
    }

    public static final void a3(kotlin.jvm.internal.z zVar, C0837m1 c0837m1, View view) {
        if (!zVar.a) {
            DownloadWorker.d.o();
        }
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    public static final void a4(C0837m1 c0837m1, Context context, View view) {
        c0837m1.s3(context);
    }

    private final void a5(final View view) {
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view2) {
                C0837m1.b5(C0837m1.this, view, view2);
            }
        });
    }

    public final void a6(TextView textView, String str) {
        textView.setText(str);
        w2.v.b(textView);
    }

    public static final void b3(C0837m1 c0837m1, View view) {
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        c0837m1.H2(requireContext);
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    public static final void b4(C0837m1 c0837m1, Context context, View view) {
        c0837m1.s3(context);
    }

    public static final void b5(final C0837m1 c0837m1, View view, View view2) {
        if (UptodownApp.F.a0()) {
            AbstractC0740a activity = c0837m1.getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k22 = activity.k2();
            if (k22 != null) {
                k22.dismiss();
            }
            if (view.getContext() != null) {
                C0606t c = C0606t.c(c0837m1.getLayoutInflater());
                kotlin.jvm.internal.m.d(c, "inflate(...)");
                TextView textView = c.f;
                k.a aVar = N1.k.g;
                textView.setTypeface(aVar.w());
                c.d.setTypeface(aVar.x());
                c.e.setTypeface(aVar.w());
                c.e.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view3) {
                        C0837m1.c5(C0837m1.this, view3);
                    }
                });
                c.b.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view3) {
                        C0837m1.d5(C0837m1.this, view3);
                    }
                });
                AlertDialog.Builder builder = new AlertDialog.Builder(c0837m1.requireContext());
                builder.setView(c.getRoot());
                builder.setCancelable(true);
                c0837m1.I6(builder);
            }
        }
    }

    public final void b6() {
        if (Q3().e.getChildCount() == 0) {
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            g6(requireContext);
            C0587j c = C0587j.c(getLayoutInflater());
            kotlin.jvm.internal.m.d(c, "inflate(...)");
            c.b.setTypeface(N1.k.g.x());
            Q3().e.addView(c.getRoot());
        }
        P2();
    }

    private final void b7(int i, Context context) {
        g2.S e = g2.S.m.e(context);
        if ((e != null ? e.g() : null) != null) {
            String g = e.g();
            kotlin.jvm.internal.m.b(g);
            if (g.length() > 0) {
                U3().Y().setValue(Integer.valueOf(i));
                if (i == 1) {
                    Q3().C.b.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.c.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.d.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.e.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    return;
                }
                if (i == 2) {
                    Q3().C.b.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.c.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.d.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.e.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    return;
                }
                if (i == 3) {
                    Q3().C.b.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.c.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.d.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.e.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    return;
                }
                if (i == 4) {
                    Q3().C.b.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.c.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.d.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.e.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                    Q3().C.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    return;
                }
                if (i != 5) {
                    Q3().C.b.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.c.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.d.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.e.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    Q3().C.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
                    return;
                }
                Q3().C.b.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                Q3().C.c.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                Q3().C.d.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                Q3().C.e.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
                Q3().C.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
            }
        }
    }

    private final void c3(String str) {
        ArrayList i0;
        if (getActivity() != null) {
            AbstractC0740a activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k22 = activity.k2();
            if (k22 != null) {
                k22.dismiss();
            }
        }
        if (getContext() != null) {
            ArrayList arrayList = new ArrayList();
            String R3 = P3().R();
            if (R3 != null && R3.length() != 0 && (i0 = P3().i0()) != null && !i0.isEmpty()) {
                C0964o c0964o = new C0964o();
                ArrayList i02 = P3().i0();
                kotlin.jvm.internal.m.b(i02);
                Context requireContext = requireContext();
                kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
                arrayList = c0964o.e(i02, requireContext);
            }
            if (!arrayList.isEmpty()) {
                Iterator it = arrayList.iterator();
                kotlin.jvm.internal.m.d(it, "iterator(...)");
                String str2 = TtmlNode.ANONYMOUS_REGION_ID;
                while (it.hasNext()) {
                    Object next = it.next();
                    kotlin.jvm.internal.m.d(next, "next(...)");
                    String str3 = (String) next;
                    if (kotlin.jvm.internal.m.a(str3, AbstractC0525o.P(arrayList))) {
                        str2 = str2 + "- " + str3;
                    } else {
                        str2 = str2 + "- " + str3 + '\n';
                    }
                }
                str = str + "\n\n" + str2;
            }
            final 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(str);
            c.b.setVisibility(0);
            c.b.setTypeface(aVar.x());
            c.b.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                    C0837m1.d3(C0837m1.this, compoundButton, z);
                }
            });
            c.e.setTypeface(aVar.w());
            c.e.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.e3(C0837m1.this, view);
                }
            });
            c.c.setTypeface(aVar.w());
            c.c.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.f3(C0599p.this, this, view);
                }
            });
            AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
            builder.setView(c.getRoot());
            builder.setCancelable(false);
            I6(builder);
        }
    }

    public static final void c4(C0837m1 c0837m1, View view) {
        c0837m1.e5();
    }

    public static final void c5(C0837m1 c0837m1, View view) {
        c0837m1.Z4();
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    public final void c6(int i, String str) {
        Menu menu = this.g;
        if (menu != null) {
            kotlin.jvm.internal.m.b(menu);
            menu.findItem(i).setTitle(str);
        }
    }

    public static final void c7(C0837m1 c0837m1, ActivityResult activityResult) {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(c0837m1), o3.Y.b(), (o3.L) null, c0837m1.new Z(c0837m1.new a0(), null), 2, (Object) null);
    }

    public static final void d3(C0837m1 c0837m1, CompoundButton compoundButton, boolean z) {
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        c0191a.a1(requireContext, !z);
    }

    public static final void d4(C0837m1 c0837m1, View view) {
        c0837m1.f5();
    }

    public static final void d5(C0837m1 c0837m1, View view) {
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    private final void d6(int i) {
        Menu menu = this.g;
        kotlin.jvm.internal.m.b(menu);
        Drawable icon = menu.findItem(2131361887).getIcon();
        if (icon != null) {
            DrawableCompat.setTint(icon, i);
        }
    }

    private final void d7() {
        try {
            if (P3().Z() <= 0 || ((Number) U3().l0().getValue()).intValue() <= 0) {
                Q3().z.getRoot().setVisibility(8);
                Q3().z.q.setVisibility(8);
                return;
            }
            int dimension = (int) getResources().getDimension(2131166020);
            Q3().z.h.setLayoutParams(new RelativeLayout.LayoutParams((((Number) U3().l0().getValue()).intValue() * P3().e0()) / P3().Z(), dimension));
            Q3().z.g.setLayoutParams(new RelativeLayout.LayoutParams((((Number) U3().l0().getValue()).intValue() * P3().d0()) / P3().Z(), dimension));
            Q3().z.f.setLayoutParams(new RelativeLayout.LayoutParams((((Number) U3().l0().getValue()).intValue() * P3().c0()) / P3().Z(), dimension));
            Q3().z.e.setLayoutParams(new RelativeLayout.LayoutParams((((Number) U3().l0().getValue()).intValue() * P3().b0()) / P3().Z(), dimension));
            Q3().z.d.setLayoutParams(new RelativeLayout.LayoutParams((((Number) U3().l0().getValue()).intValue() * P3().a0()) / P3().Z(), dimension));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static final void e3(C0837m1 c0837m1, View view) {
        c0837m1.H3();
        if (c0837m1.getActivity() != null) {
            AbstractC0740a activity = c0837m1.getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k22 = activity.k2();
            if (k22 != null) {
                k22.dismiss();
            }
        }
    }

    public static final void e4(C0837m1 c0837m1, View view) {
        c0837m1.W4();
    }

    private final void e5() {
        if (requireActivity().isFinishing()) {
            return;
        }
        Intent intent = new Intent((Context) requireActivity(), (Class<?>) MoreInfo.class);
        intent.putExtra("appInfo", P3());
        UptodownApp.a aVar = UptodownApp.F;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        startActivity(intent, aVar.a(requireActivity));
    }

    public final void e6() {
        Q3().O.x.setVisibility(8);
        Q3().O.d.setVisibility(8);
        String string = getString(2131951960);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        f6(string);
        Q3().L.d.setVisibility(8);
        W3(2131361854);
    }

    private final void e7() {
        W1.E e = new W1.E();
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        ArrayList c = e.c(requireContext);
        this.f = c;
        kotlin.jvm.internal.m.b(c);
        if (c.size() > 0) {
            U3().b0().setValue(0);
            g3();
            return;
        }
        a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        c0191a.W0(requireContext2, false);
        k6();
    }

    public static final void f3(C0599p c0599p, C0837m1 c0837m1, View view) {
        if (c0599p.b.isChecked()) {
            a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
            Context requireContext = c0837m1.requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            c0191a.a1(requireContext, true);
        }
        Context requireContext2 = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        c0837m1.g6(requireContext2);
        if (c0837m1.getActivity() != null) {
            AbstractC0740a activity = c0837m1.getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k22 = activity.k2();
            if (k22 != null) {
                k22.dismiss();
            }
        }
    }

    public static final void f4(C0837m1 c0837m1) {
        c0837m1.U3().l0().setValue(Integer.valueOf(c0837m1.Q3().z.i.getMeasuredWidth()));
        if (((Boolean) c0837m1.U3().x().getValue()).booleanValue()) {
            c0837m1.d7();
        }
    }

    private final void f5() {
        if (requireActivity().isFinishing() || !P3().H0()) {
            return;
        }
        Intent intent = new Intent((Context) requireActivity(), (Class<?>) OldVersionsActivity.class);
        intent.putExtra("appInfo", P3());
        UptodownApp.a aVar = UptodownApp.F;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        startActivity(intent, aVar.a(requireActivity));
    }

    public final void f6(String str) {
        R6();
        U3().P().setValue(-1);
        Q3().O.e.setVisibility(0);
        Q3().O.c.setVisibility(8);
        Q3().L.h.setText(str);
        TextView tvDownloadCancelBad = Q3().L.h;
        kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
        w2.v.c(tvDownloadCancelBad);
        Q3().L.h.setOnClickListener(null);
        Q3().H.n.setText(str);
        TextView tvStatusDownload = Q3().H.n;
        kotlin.jvm.internal.m.d(tvStatusDownload, "tvStatusDownload");
        w2.v.c(tvStatusDownload);
        Q3().H.n.setOnClickListener(null);
    }

    private final void f7() {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new b0(null), 2, (Object) null);
    }

    private final void g3() {
        throw new UnsupportedOperationException("Method not decompiled: d2.C0837m1.g3():void");
    }

    public static final void g4(C0837m1 c0837m1, Context context, View view) {
        c0837m1.U3().Y().setValue(1);
        c0837m1.s3(context);
    }

    private final void g5() {
        if (requireActivity().isFinishing()) {
            return;
        }
        Intent intent = new Intent((Context) requireActivity(), (Class<?>) OrganizationActivity.class);
        intent.putExtra("organizationID", P3().Q());
        intent.putExtra("organizationName", P3().g());
        UptodownApp.a aVar = UptodownApp.F;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        startActivity(intent, aVar.a(requireActivity));
    }

    public final void g6(Context context) {
        String string;
        R6();
        C1254c c1254c = C1254c.a;
        ProgressBar pbProgressAppDetail = Q3().O.h;
        kotlin.jvm.internal.m.d(pbProgressAppDetail, "pbProgressAppDetail");
        ImageView ivLogoAppDetail = Q3().O.b;
        kotlin.jvm.internal.m.d(ivLogoAppDetail, "ivLogoAppDetail");
        c1254c.c(pbProgressAppDetail, ivLogoAppDetail);
        U3().P().setValue(-1);
        if (new P1.a(context).m()) {
            string = context.getString(2131952451);
        } else {
            String U3 = P3().U();
            if (U3 == null || U3.length() == 0) {
                string = context.getString(2131952451);
            } else {
                String v02 = P3().v0("try");
                string = (v02 == null || v02.length() == 0) ? context.getString(2131952451) : v02;
            }
        }
        if (((Boolean) U3().d0().getValue()).booleanValue() && P3().H0()) {
            Q3().L.b.setVisibility(0);
        } else {
            Q3().L.b.setVisibility(8);
        }
        Q3().L.i.setVisibility(8);
        Q3().O.e.setVisibility(0);
        Q3().O.c.setVisibility(8);
        TextView tvDownloadCancelBad = Q3().L.h;
        kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
        Z5(tvDownloadCancelBad, string);
        Q3().L.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.h6(C0837m1.this, view);
            }
        });
        Q3().H.b.setVisibility(4);
        TextView tvStatusDownload = Q3().H.n;
        kotlin.jvm.internal.m.d(tvStatusDownload, "tvStatusDownload");
        Z5(tvStatusDownload, string);
        if (U3().Q().getValue() == null) {
            W3(2131361892);
            W3(2131361856);
        }
    }

    public static final void h3(C0837m1 c0837m1, Map.Entry entry, View view) {
        c0837m1.U3().b0().setValue(entry.getKey());
    }

    public static final void h4(C0837m1 c0837m1, Context context, View view) {
        c0837m1.U3().Y().setValue(2);
        c0837m1.s3(context);
    }

    public final void h5(long j) {
        if (getActivity() != null && (getActivity() instanceof MainActivity)) {
            MainActivity activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.MainActivity");
            activity.D2(j);
        } else {
            if (getActivity() == null || !(getActivity() instanceof AppDetailActivity)) {
                return;
            }
            AppDetailActivity activity2 = getActivity();
            kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.AppDetailActivity");
            activity2.D2(j);
        }
    }

    public static final void h6(C0837m1 c0837m1, View view) {
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        c0837m1.E3(requireContext);
    }

    public static final void i3(C0837m1 c0837m1, View view) {
        if (((Number) c0837m1.U3().b0().getValue()).intValue() >= 0) {
            a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
            Context requireContext = c0837m1.requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            c0191a.W0(requireContext, ((Number) c0837m1.U3().b0().getValue()).intValue() > 0);
            AbstractC0740a activity = c0837m1.getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k22 = activity.k2();
            if (k22 != null) {
                k22.dismiss();
            }
            c0837m1.k6();
        }
    }

    public static final void i4(C0837m1 c0837m1, Context context, View view) {
        c0837m1.U3().Y().setValue(3);
        c0837m1.s3(context);
    }

    public final void i5(C0955f c0955f) {
        if (getActivity() != null && (getActivity() instanceof MainActivity)) {
            MainActivity activity = getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.MainActivity");
            activity.D2(c0955f.e());
        } else {
            if (getActivity() == null || !(getActivity() instanceof AppDetailActivity)) {
                return;
            }
            AppDetailActivity activity2 = getActivity();
            kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.AppDetailActivity");
            activity2.D2(c0955f.e());
        }
    }

    public final void i6(C0965p c0965p) {
        S6();
        C1254c c1254c = C1254c.a;
        ProgressBar pbProgressAppDetail = Q3().O.h;
        kotlin.jvm.internal.m.d(pbProgressAppDetail, "pbProgressAppDetail");
        ImageView ivLogoAppDetail = Q3().O.b;
        kotlin.jvm.internal.m.d(ivLogoAppDetail, "ivLogoAppDetail");
        c1254c.e(pbProgressAppDetail, ivLogoAppDetail);
        TextView tvDownloadCancelBad = Q3().L.h;
        kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
        String string = getString(N1.i.j0);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        a6(tvDownloadCancelBad, string);
        Q3().L.i.setVisibility(8);
        Q3().H.c.setVisibility(8);
        U3().P().setValue(5);
        if (c0965p == null && getContext() != null) {
            v.a aVar = u2.v.v;
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            u2.v a = aVar.a(requireContext);
            a.a();
            String R3 = P3().R();
            kotlin.jvm.internal.m.b(R3);
            C0965p g0 = a.g0(R3, P3().y0());
            a.i();
            c0965p = g0;
        }
        if (c0965p == null) {
            Q3().O.h.setIndeterminate(true);
            Q3().H.e.setIndeterminate(true);
            return;
        }
        Q3().L.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.j6(C0837m1.this, view);
            }
        });
        Q3().H.b.setVisibility(0);
        if (F4(this, null, 1, null)) {
            TextView tvPauseBad = Q3().L.j;
            kotlin.jvm.internal.m.d(tvPauseBad, "tvPauseBad");
            String string2 = getString(2131951655);
            kotlin.jvm.internal.m.d(string2, "getString(...)");
            a6(tvPauseBad, string2);
            String valueOf = String.valueOf(c0965p.x());
            if (isAdded() && getContext() != null) {
                valueOf = valueOf + requireContext().getString(2131952488);
            }
            Q3().O.h.setIndeterminate(false);
            Q3().O.h.setProgress(c0965p.x());
            if (c0965p.z() > 0) {
                TextView textView = Q3().O.t;
                Integer valueOf2 = Integer.valueOf(c0965p.x());
                W1.i iVar = new W1.i();
                long z = c0965p.z();
                Context requireContext2 = requireContext();
                kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
                textView.setText(getString(2131952489, new Object[]{valueOf2, iVar.d(z, requireContext2)}));
            }
            Q3().H.e.setIndeterminate(false);
            Q3().H.k.setVisibility(0);
            Q3().H.i.setVisibility(8);
            Q3().H.k.setText(valueOf);
            TextView textView2 = Q3().H.l;
            W1.i iVar2 = new W1.i();
            long y = c0965p.y();
            Context requireContext3 = requireContext();
            kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
            textView2.setText(iVar2.d(y, requireContext3));
            Q3().H.e.setProgress(c0965p.x());
        } else {
            Q3().O.t.setText(getString(2131952659));
            Q3().O.h.setIndeterminate(true);
            Q3().H.e.setIndeterminate(true);
            Q3().H.i.setVisibility(0);
            Q3().H.k.setVisibility(8);
        }
        TextView textView3 = Q3().H.m;
        kotlin.jvm.internal.F f = kotlin.jvm.internal.F.a;
        W1.i iVar3 = new W1.i();
        long z3 = c0965p.z();
        Context requireContext4 = requireContext();
        kotlin.jvm.internal.m.d(requireContext4, "requireContext(...)");
        String format = String.format("/%s", Arrays.copyOf(new Object[]{iVar3.d(z3, requireContext4)}, 1));
        kotlin.jvm.internal.m.d(format, "format(...)");
        textView3.setText(format);
    }

    public final void j3(String str) {
        if (getActivity() == null || requireActivity().isFinishing()) {
            return;
        }
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
        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(str);
        c.c.setVisibility(8);
        c.e.setTypeface(aVar.w());
        c.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.k3(C0837m1.this, view);
            }
        });
        builder.setView(c.getRoot());
        builder.setCancelable(false);
        I6(builder);
    }

    public static final void j4(C0837m1 c0837m1, Context context, View view) {
        c0837m1.U3().Y().setValue(4);
        c0837m1.s3(context);
    }

    private final void j5() {
        if (requireActivity().isFinishing()) {
            return;
        }
        Intent intent = new Intent((Context) requireActivity(), (Class<?>) ReviewsActivity.class);
        intent.putExtra("appInfo", P3());
        intent.putExtra("myReview", (Parcelable) U3().R().getValue());
        UptodownApp.a aVar = UptodownApp.F;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        startActivity(intent, aVar.a(requireActivity));
    }

    public static final void j6(C0837m1 c0837m1, View view) {
        c0837m1.Z2();
    }

    public static final void k3(C0837m1 c0837m1, View view) {
        if (c0837m1.getActivity() == null || c0837m1.requireActivity().isFinishing()) {
            return;
        }
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    public static final boolean k4(C0837m1 c0837m1, MenuItem item) {
        FragmentActivity activity;
        kotlin.jvm.internal.m.e(item, "item");
        if (!UptodownApp.F.a0()) {
            return true;
        }
        if (item.getItemId() == 2131361887) {
            c0837m1.k5();
            return true;
        }
        if (item.getItemId() == 2131361888) {
            c0837m1.E6();
            return true;
        }
        if (item.getItemId() == 2131361854) {
            c0837m1.m5();
            return true;
        }
        if (item.getItemId() == 2131361892) {
            String R3 = c0837m1.P3().R();
            if (R3 == null || R3.length() == 0 || (activity = c0837m1.getActivity()) == null) {
                return true;
            }
            N1.j jVar = new N1.j(activity);
            String R4 = c0837m1.P3().R();
            kotlin.jvm.internal.m.b(R4);
            jVar.h(R4);
            return true;
        }
        if (item.getItemId() == 2131361893) {
            c0837m1.u2();
            return true;
        }
        if (item.getItemId() == 2131361885) {
            c0837m1.t2();
            return true;
        }
        if (item.getItemId() == 2131361873) {
            c0837m1.s2();
            return true;
        }
        if (item.getItemId() == 2131361855) {
            c0837m1.T4();
            return true;
        }
        if (item.getItemId() == 2131361856) {
            c0837m1.U4();
            return true;
        }
        if (item.getItemId() != 2131361886) {
            return false;
        }
        if (!(c0837m1.U3().j0().getValue() instanceof H.c)) {
            return true;
        }
        Object value = c0837m1.U3().j0().getValue();
        kotlin.jvm.internal.m.c(value, "null cannot be cast to non-null type com.uptodown.util.Result.Success<java.util.ArrayList<com.uptodown.models.UserRemoteDevice>>");
        c0837m1.L6((ArrayList) ((H.c) value).a());
        return true;
    }

    private final void k5() {
        Intent intent = new Intent(getContext(), (Class<?>) SearchActivity.class);
        intent.setFlags(603979776);
        UptodownApp.a aVar = UptodownApp.F;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        startActivity(intent, aVar.a(requireActivity));
    }

    private final void k6() {
        i6(null);
        U3().P().setValue(5);
        long T3 = T3();
        u2.y yVar = new u2.y();
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        File e = yVar.e(requireContext);
        if (!e.exists() && !e.mkdirs()) {
            String string = getString(2131951999);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            j3(string);
            return;
        }
        if (!V3()) {
            Context requireContext2 = requireContext();
            kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
            o6(requireContext2, null);
            l3();
            return;
        }
        u2.p pVar = new u2.p();
        Q3().O.t.setVisibility(0);
        Q3().O.t.setText(getString(2131952659));
        Q3().O.h.setProgress(0);
        Q3().H.i.setVisibility(0);
        Q3().H.k.setVisibility(8);
        Q3().H.l.setText(2131952881);
        TextView textView = Q3().H.m;
        kotlin.jvm.internal.F f = kotlin.jvm.internal.F.a;
        W1.i iVar = new W1.i();
        Context requireContext3 = requireContext();
        kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
        String format = String.format("/%s", Arrays.copyOf(new Object[]{iVar.d(T3, requireContext3), requireContext()}, 2));
        kotlin.jvm.internal.m.d(format, "format(...)");
        textView.setText(format);
        Q3().H.e.setProgress(0);
        AlertDialog alertDialog = this.e;
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        AlertDialog e4 = pVar.e(alertDialog, requireActivity);
        this.e = e4;
        if (e4 == null) {
            S5();
            i6(null);
        }
    }

    private final void l3() {
        u2.y yVar = new u2.y();
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        File e = yVar.e(requireContext);
        u2.y yVar2 = new u2.y();
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        long j = yVar2.j(requireContext2, e);
        long totalSpace = e.getTotalSpace();
        Context requireContext3 = requireContext();
        kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
        String d = new W1.i().d((long) (T3() * 2.25d), requireContext3);
        long j4 = ((totalSpace - j) * 100) / totalSpace;
        AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
        c2.g1 c = c2.g1.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        TextView textView = c.e;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.x());
        c.b.setProgress((int) j4);
        c.f.setTypeface(aVar.x());
        c.f.setText(getString(2131952413, new Object[]{d}));
        c.d.setTypeface(aVar.w());
        c.d.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.m3(C0837m1.this, view);
            }
        });
        builder.setView(c.getRoot());
        I6(builder);
    }

    public static final void l4(C0837m1 c0837m1, Context context, View view) {
        c0837m1.U3().Y().setValue(5);
        c0837m1.s3(context);
    }

    private final void l5(g2.L l) {
        if (UptodownApp.F.a0()) {
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            C0563l c0563l = new C0563l(requireContext, LifecycleOwnerKt.getLifecycleScope(this));
            String l4 = l.l();
            kotlin.jvm.internal.m.b(l4);
            c0563l.c(l4, new D());
        }
    }

    public final void l6(String str) {
        X3();
        Q3().O.t.setText(str);
        Q3().H.l.setText(str);
    }

    public static final void m3(C0837m1 c0837m1, View view) {
        Intent intent = new Intent((Context) c0837m1.requireActivity(), (Class<?>) FreeUpSpaceActivity.class);
        intent.putExtra("appInfo", c0837m1.P3());
        UptodownApp.a aVar = UptodownApp.F;
        FragmentActivity requireActivity = c0837m1.requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        c0837m1.startActivity(intent, aVar.a(requireActivity));
    }

    public static final void m4(C0837m1 c0837m1, View view) {
        c0837m1.j5();
    }

    private final void m5() {
        if (getActivity() == null || requireActivity().isFinishing()) {
            return;
        }
        U3().k0().setValue(Boolean.TRUE);
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        new b2.m(requireActivity, String.valueOf(P3().A()), P3().l0(), new E(), LifecycleOwnerKt.getLifecycleScope(this));
    }

    public final void m6() {
        R6();
        C1254c c1254c = C1254c.a;
        ProgressBar pbProgressAppDetail = Q3().O.h;
        kotlin.jvm.internal.m.d(pbProgressAppDetail, "pbProgressAppDetail");
        ImageView ivLogoAppDetail = Q3().O.b;
        kotlin.jvm.internal.m.d(ivLogoAppDetail, "ivLogoAppDetail");
        c1254c.c(pbProgressAppDetail, ivLogoAppDetail);
        Q3().O.e.setVisibility(0);
        Q3().O.c.setVisibility(8);
        Q3().L.b.setVisibility(8);
        Q3().L.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.n6(C0837m1.this, view);
            }
        });
        U3().P().setValue(3);
        TextView tvDownloadCancelBad = Q3().L.h;
        kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
        String string = getString(2131952451);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        Z5(tvDownloadCancelBad, string);
        TextView tvStatusDownload = Q3().H.n;
        kotlin.jvm.internal.m.d(tvStatusDownload, "tvStatusDownload");
        String string2 = getString(2131952451);
        kotlin.jvm.internal.m.d(string2, "getString(...)");
        Z5(tvStatusDownload, string2);
        W3(2131361856);
        W3(2131361892);
    }

    public final void n3() {
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
        if (getContext() != null) {
            C0593m c = C0593m.c(getLayoutInflater());
            kotlin.jvm.internal.m.d(c, "inflate(...)");
            TextView textView = c.d;
            k.a aVar = N1.k.g;
            textView.setTypeface(aVar.w());
            c.c.setTypeface(aVar.x());
            TextView textView2 = c.c;
            u2.p pVar = new u2.p();
            String string = getString(2131952497, new Object[]{P3().M()});
            kotlin.jvm.internal.m.d(string, "getString(...)");
            String M3 = P3().M();
            kotlin.jvm.internal.m.b(M3);
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            textView2.setText(pVar.d(string, M3, requireContext));
            c.b.setTypeface(aVar.w());
            c.b.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.o3(C0837m1.this, view);
                }
            });
            AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
            builder.setView(c.getRoot());
            builder.setCancelable(true);
            I6(builder);
        }
    }

    public static final void n4(C0837m1 c0837m1, View view) {
        c0837m1.Y4();
    }

    private final void n5(Context context) {
        String w;
        String V3;
        if (new C1233m().v(P3().R(), context)) {
            Drawable k = u2.I.a.k(context, P3().R());
            Q3().O.b.setImageDrawable(k);
            Q3().C.g.setImageDrawable(k);
        } else {
            String D3 = P3().D();
            if (D3 == null || D3.length() == 0) {
                Q3().O.b.setImageDrawable(ContextCompat.getDrawable(context, 2131231390));
                Q3().C.g.setImageDrawable(ContextCompat.getDrawable(context, 2131231390));
            } else {
                com.squareup.picasso.w l = com.squareup.picasso.s.h().l(P3().F()).l(2131231321);
                UptodownApp.a aVar = UptodownApp.F;
                l.n(aVar.h0(context)).j(Q3().O.b, new F(context));
                com.squareup.picasso.s.h().l(P3().G()).l(2131231321).n(aVar.h0(context)).i(Q3().C.g);
            }
        }
        String D4 = P3().D();
        if ((D4 == null || D4.length() == 0) && ((w = P3().w()) == null || w.length() == 0)) {
            V6(context);
        }
        String M3 = P3().M();
        if (M3 != null && M3.length() != 0) {
            Q3().O.r.setText(P3().M());
            Q3().f201z0.setText(context.getString(2131952638, P3().M()));
        }
        String z02 = P3().z0();
        if (z02 != null && z02.length() != 0) {
            Q3().O.x.setText(P3().z0());
            Q3().O.x.setVisibility(0);
        }
        String U3 = P3().U();
        if (U3 != null && U3.length() != 0) {
            Q3().O.s.setText(P3().U());
            Q3().O.s.setVisibility(0);
        }
        String g = P3().g();
        if (g != null && g.length() != 0) {
            Q3().O.l.setText(P3().g());
        }
        if (P3().l() == 1) {
            Q3().O.m.setVisibility(0);
        }
        String m02 = P3().m0();
        if (m02 == null || m02.length() == 0) {
            Q3().f200y0.setVisibility(8);
        } else {
            Q3().f200y0.setVisibility(0);
            k.a aVar2 = w2.k.a;
            TextView tvShortDescAppDetail = Q3().f200y0;
            kotlin.jvm.internal.m.d(tvShortDescAppDetail, "tvShortDescAppDetail");
            aVar2.a(tvShortDescAppDetail);
            TextView textView = Q3().f200y0;
            C0963n.a aVar3 = C0963n.f;
            String m03 = P3().m0();
            kotlin.jvm.internal.m.b(m03);
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            textView.setText(aVar3.m(m03, requireContext, this.k));
        }
        String k4 = P3().k();
        if (k4 == null || k4.length() == 0) {
            Q3().J.setVisibility(8);
        } else {
            k.a aVar4 = w2.k.a;
            TextView tvDescAppDetail = Q3().e0;
            kotlin.jvm.internal.m.d(tvDescAppDetail, "tvDescAppDetail");
            aVar4.a(tvDescAppDetail);
            if (getResources().getConfiguration().getLayoutDirection() == 1) {
                Q3().e0.setTextDirection(2);
            }
            TextView textView2 = Q3().e0;
            C0963n.a aVar5 = C0963n.f;
            String k5 = P3().k();
            kotlin.jvm.internal.m.b(k5);
            Context requireContext2 = requireContext();
            kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
            textView2.setText(aVar5.m(k5, requireContext2, this.k));
            Q3().J.setVisibility(0);
            String n4 = P3().n();
            if (n4 == null || n4.length() == 0) {
                String t = P3().t();
                if (t != null && t.length() != 0) {
                    TextView textView3 = Q3().h0;
                    String t3 = P3().t();
                    kotlin.jvm.internal.m.b(t3);
                    Context requireContext3 = requireContext();
                    kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
                    textView3.setText(aVar5.m(t3, requireContext3, this.k));
                    String s = P3().s();
                    if (s == null || s.length() == 0) {
                        Q3().g0.setVisibility(8);
                    } else {
                        Q3().g0.setText(P3().s());
                    }
                    String r = P3().r();
                    if (r == null || r.length() == 0) {
                        Q3().h.setVisibility(8);
                    } else {
                        com.squareup.picasso.w l4 = com.squareup.picasso.s.h().l(P3().r()).l(2131231321);
                        UptodownApp.a aVar6 = UptodownApp.F;
                        Context requireContext4 = requireContext();
                        kotlin.jvm.internal.m.d(requireContext4, "requireContext(...)");
                        l4.n(aVar6.h0(requireContext4)).i(Q3().h);
                    }
                    if (P3().n0() == 1) {
                        Q3().i0.setVisibility(0);
                    } else {
                        Q3().i0.setVisibility(8);
                    }
                }
            } else {
                Q3().h0.setText(P3().n());
                Q3().i0.setVisibility(8);
                Q3().h.setVisibility(8);
            }
        }
        String w02 = P3().w0();
        if (w02 == null || w02.length() == 0) {
            W3(2131361888);
        } else {
            K6(2131361888);
        }
        String o02 = P3().o0();
        if (o02 == null || o02.length() == 0) {
            W3(2131361854);
            Q3().L.d.setVisibility(8);
        } else {
            K6(2131361854);
            Q3().L.d.setVisibility(0);
        }
        String j0 = P3().j0();
        if (j0 == null || j0.length() == 0) {
            Q3().Q.setVisibility(8);
        } else {
            Q3().Q.setVisibility(0);
            Q3().f198w0.setText(P3().j0());
        }
        if (P3().Y() == 0) {
            Q3().O.k.setVisibility(8);
            Q3().O.y.setVisibility(8);
        } else {
            Q3().O.v.setVisibility(0);
            Q3().O.v.setText(String.valueOf(P3().Y() / 10.0d));
            if (P3().Z() == 1) {
                Q3().O.u.setText(getString(2131952577));
            } else {
                TextView textView4 = Q3().O.u;
                kotlin.jvm.internal.F f = kotlin.jvm.internal.F.a;
                String string = getString(2131952576);
                kotlin.jvm.internal.m.d(string, "getString(...)");
                String format = String.format(string, Arrays.copyOf(new Object[]{new W1.i().b(P3().Z())}, 1));
                kotlin.jvm.internal.m.d(format, "format(...)");
                textView4.setText(format);
            }
        }
        if (!P3().K0() || (V3 = P3().V()) == null || V3.length() == 0) {
            Q3().O.n.setText(new W1.i().b(P3().q()));
            Q3().O.o.setText(getString(2131952274));
            String R3 = P3().R();
            if (R3 == null || R3.length() == 0) {
                Q3().v.setVisibility(8);
            } else {
                Q3().f189n0.setText(P3().R());
            }
            ArrayList p02 = P3().p0();
            if (p02 == null || p02.isEmpty()) {
                Q3().u.setVisibility(8);
            } else {
                TextView textView5 = Q3().f187l0;
                ArrayList p03 = P3().p0();
                kotlin.jvm.internal.m.b(p03);
                textView5.setText((CharSequence) AbstractC0525o.H(p03));
            }
            String S3 = P3().S();
            if (S3 == null || S3.length() == 0) {
                Q3().w.setVisibility(8);
            } else {
                Q3().f191p0.setText(getString(2131952487, new Object[]{P3().S()}));
            }
        } else {
            Q3().O.n.setText(P3().V());
            Q3().I.setVisibility(8);
        }
        String H3 = P3().H();
        if (H3 == null || H3.length() == 0 || P3().K0()) {
            Q3().O.f.setVisibility(8);
        } else {
            Q3().O.p.setText(P3().H());
        }
        Q3().z.o.setText(String.valueOf(P3().Y() / 10.0d));
        if (P3().Z() == 1) {
            Q3().z.p.setText(getString(2131951792));
        } else {
            TextView textView6 = Q3().z.p;
            kotlin.jvm.internal.F f4 = kotlin.jvm.internal.F.a;
            String string2 = getString(2131952576);
            kotlin.jvm.internal.m.d(string2, "getString(...)");
            String format2 = String.format(string2, Arrays.copyOf(new Object[]{new W1.i().b(P3().Z())}, 1));
            kotlin.jvm.internal.m.d(format2, "format(...)");
            textView6.setText(format2);
        }
        Q3().z.p.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.o5(C0837m1.this, view);
            }
        });
        String N3 = P3().N();
        if (N3 == null || N3.length() == 0) {
            Q3().T.getRoot().setVisibility(8);
        } else {
            Q3().T.d.setText(P3().N());
            Q3().T.d.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public final void onGlobalLayout() {
                    C0837m1.p5(C0837m1.this);
                }
            });
            Q3().T.getRoot().setVisibility(0);
        }
        String t02 = P3().t0();
        if (t02 == null || t02.length() == 0) {
            String A02 = P3().A0();
            if (A02 != null && A02.length() != 0) {
                Q3().f181B0.setText(P3().A0());
            }
        } else {
            Q3().f181B0.setText(P3().t0());
        }
        C0973y b = C0973y.f.b(context);
        if (b != null && b.b() == P3().e() && !b.g()) {
            b.p(context);
        }
        if (kotlin.jvm.internal.m.a(P3().R(), requireContext().getPackageName()) || kotlin.jvm.internal.m.a(P3().R(), "com.uptodown.installer")) {
            Q3().q.setVisibility(8);
        }
        ArrayList x02 = P3().x0();
        if (x02 == null || x02.isEmpty() || Q3().B.getVisibility() != 8) {
            return;
        }
        Q3().B.setVisibility(0);
        Q3().f180A0.setTypeface(N1.k.g.w());
        ArrayList x03 = P3().x0();
        kotlin.jvm.internal.m.b(x03);
        Iterator it = x03.iterator();
        kotlin.jvm.internal.m.d(it, "iterator(...)");
        while (it.hasNext()) {
            Object next = it.next();
            kotlin.jvm.internal.m.d(next, "next(...)");
            String str = (String) next;
            if (str.length() > 0) {
                c2.J0 c = c2.J0.c(getLayoutInflater());
                kotlin.jvm.internal.m.d(c, "inflate(...)");
                LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
                layoutParams.setMargins(0, (int) getResources().getDimension(2131166020), 0, 0);
                c.getRoot().setLayoutParams(layoutParams);
                c.c.setTypeface(N1.k.g.x());
                c.c.setText(str);
                Q3().B.addView(c.getRoot());
            }
        }
    }

    public static final void n6(C0837m1 c0837m1, View view) {
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        c0837m1.E3(requireContext);
    }

    public static final void o3(C0837m1 c0837m1, View view) {
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    public static final void o4(C0837m1 c0837m1, View view) {
        if (!UptodownApp.F.a0() || c0837m1.U3().Q().getValue() == null) {
            return;
        }
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        N1.j jVar = new N1.j(requireContext);
        Object value = c0837m1.U3().Q().getValue();
        kotlin.jvm.internal.m.b(value);
        String o = ((C0953d) value).o();
        kotlin.jvm.internal.m.b(o);
        jVar.h(o);
    }

    public static final void o5(C0837m1 c0837m1, View view) {
        c0837m1.j5();
    }

    public final void o6(Context context, C0965p c0965p) {
        long j;
        u2.y yVar = new u2.y();
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        File e = yVar.e(requireContext);
        u2.y yVar2 = new u2.y();
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        long j4 = yVar2.j(requireContext2, e);
        try {
            j = e.getTotalSpace();
        } catch (SecurityException unused) {
            j = 0;
        }
        if (j > 0) {
            Context requireContext3 = requireContext();
            kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
            String d = new W1.i().d(((long) (T3() * 2.25d)) - j4, requireContext3);
            long j5 = ((j - j4) * 100) / j;
            TextView textView = Q3().f186G0.g;
            k.a aVar = N1.k.g;
            textView.setTypeface(aVar.x());
            Q3().f186G0.d.setProgress((int) j5);
            Q3().f186G0.h.setTypeface(aVar.x());
            Q3().f186G0.h.setText(context.getString(2131952413, d));
            Q3().f186G0.f.setTypeface(aVar.w());
            Q3().f186G0.f.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.p6(C0837m1.this, view);
                }
            });
            Q3().f186G0.getRoot().setVisibility(0);
        }
        if (c0965p == null || !c0965p.f()) {
            g6(context);
        } else {
            m6();
        }
    }

    private final void p3(final d3.a aVar) {
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
        if (getContext() != null) {
            C0599p c = C0599p.c(getLayoutInflater());
            kotlin.jvm.internal.m.d(c, "inflate(...)");
            TextView textView = c.d;
            k.a aVar2 = N1.k.g;
            textView.setTypeface(aVar2.x());
            c.d.setText(getString(2131952570, new Object[]{P3().M()}));
            c.e.setTypeface(aVar2.w());
            c.e.setText(getString(2131952771));
            c.e.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.q3(d3.a.this, this, view);
                }
            });
            c.c.setTypeface(aVar2.w());
            TextView tvCancel = c.c;
            kotlin.jvm.internal.m.d(tvCancel, "tvCancel");
            w2.v.b(tvCancel);
            c.c.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.r3(C0837m1.this, view);
                }
            });
            AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
            builder.setView(c.getRoot());
            builder.setCancelable(false);
            I6(builder);
        }
    }

    public static final void p4(C0837m1 c0837m1, View view) {
        if (UptodownApp.F.a0()) {
            c0837m1.B3();
        }
    }

    public static final void p5(C0837m1 c0837m1) {
        TextView tvWhatsNewContent = c0837m1.Q3().T.d;
        kotlin.jvm.internal.m.d(tvWhatsNewContent, "tvWhatsNewContent");
        if (w2.s.a(tvWhatsNewContent) || c0837m1.Q3().T.d.getMaxLines() > 6) {
            return;
        }
        c0837m1.Q3().T.b.setVisibility(8);
        c0837m1.Q3().T.e.setVisibility(8);
    }

    public static final void p6(C0837m1 c0837m1, View view) {
        Intent intent = new Intent((Context) c0837m1.requireActivity(), (Class<?>) FreeUpSpaceActivity.class);
        intent.putExtra("appInfo", c0837m1.P3());
        UptodownApp.a aVar = UptodownApp.F;
        FragmentActivity requireActivity = c0837m1.requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        c0837m1.startActivity(intent, aVar.a(requireActivity));
    }

    public static final void q3(d3.a aVar, C0837m1 c0837m1, View view) {
        aVar.invoke();
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    public static final void q4(C0837m1 c0837m1, View view) {
        if (!UptodownApp.F.a0() || ((Boolean) c0837m1.U3().k0().getValue()).booleanValue()) {
            return;
        }
        c0837m1.m5();
    }

    private final View q5(C0968t c0968t, LinearLayout.LayoutParams layoutParams) {
        c2.D c = c2.D.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        c.getRoot().setLayoutParams(layoutParams);
        TextView textView = c.c;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        c.b.setTypeface(aVar.x());
        c.c.setText(c0968t.b());
        c.b.setText(c0968t.a());
        c.getRoot().setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.r5(view);
            }
        });
        LinearLayout root = c.getRoot();
        kotlin.jvm.internal.m.d(root, "getRoot(...)");
        return root;
    }

    public final void q6(Context context) {
        T6();
        C1254c c1254c = C1254c.a;
        ProgressBar pbProgressAppDetail = Q3().O.h;
        kotlin.jvm.internal.m.d(pbProgressAppDetail, "pbProgressAppDetail");
        ImageView ivLogoAppDetail = Q3().O.b;
        kotlin.jvm.internal.m.d(ivLogoAppDetail, "ivLogoAppDetail");
        c1254c.c(pbProgressAppDetail, ivLogoAppDetail);
        U3().P().setValue(0);
        C0957h h = P3().h();
        String string = (h == null || h.i() != 1) ? context.getString(2131952446) : context.getString(2131951689);
        Q3().H.j.setText(string);
        TextView tvOpenBad = Q3().L.i;
        kotlin.jvm.internal.m.d(tvOpenBad, "tvOpenBad");
        Z5(tvOpenBad, string);
        K6(2131361892);
        K6(2131361856);
        String R3 = P3().R();
        if (R3 == null || R3.length() == 0 || !m3.m.p(requireActivity().getPackageName(), P3().R(), true)) {
            return;
        }
        Q3().L.c.setVisibility(8);
        Q3().L.i.setVisibility(8);
        Q3().L.d.setVisibility(8);
        Q3().L.e.setVisibility(8);
        Q3().H.j.setVisibility(8);
        if (680 < P3().I()) {
            g2.P p = (g2.P) U3().h0().getValue();
            C0965p b = p != null ? p.b(context) : null;
            if (b == null && P3().A() > 0) {
                u2.v a = u2.v.v.a(context);
                a.a();
                C0965p d0 = a.d0(String.valueOf(P3().A()));
                a.i();
                b = d0;
            }
            if (b != null && b.f()) {
                z6(context);
                return;
            }
            r3.t h0 = U3().h0();
            String packageName = requireActivity().getPackageName();
            kotlin.jvm.internal.m.d(packageName, "getPackageName(...)");
            h0.setValue(new g2.P(packageName));
            g6(context);
        }
    }

    public static final void r3(C0837m1 c0837m1, View view) {
        AbstractC0740a activity = c0837m1.getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
    }

    public static final void r4(C0837m1 c0837m1, View view) {
        c0837m1.t2();
    }

    public final void r6(C0965p c0965p) {
        i6(c0965p);
        TextView tvDownloadCancelBad = Q3().L.h;
        kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
        String string = getString(N1.i.j0);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        a6(tvDownloadCancelBad, string);
        TextView tvPauseBad = Q3().L.j;
        kotlin.jvm.internal.m.d(tvPauseBad, "tvPauseBad");
        String string2 = getString(2131952771);
        kotlin.jvm.internal.m.d(string2, "getString(...)");
        Z5(tvPauseBad, string2);
        Q3().H.b.setVisibility(8);
        Q3().H.c.setVisibility(0);
    }

    private final void s2() {
        String R3 = P3().R();
        if (R3 == null || R3.length() == 0 || getContext() == null) {
            return;
        }
        v.a aVar = u2.v.v;
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        u2.v a = aVar.a(requireContext);
        a.a();
        String R4 = P3().R();
        kotlin.jvm.internal.m.b(R4);
        C0953d W3 = a.W(R4);
        if (W3 != null) {
            if (W3.e() == 0) {
                W3.N(1);
                C0953d.c w = W3.w();
                C0953d.c cVar = C0953d.c.b;
                if (w != cVar) {
                    W3.c0(cVar);
                    String o = W3.o();
                    kotlin.jvm.internal.m.b(o);
                    a.P(o);
                    u2.y yVar = new u2.y();
                    Context requireContext2 = requireContext();
                    kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
                    yVar.b(requireContext2);
                }
            } else {
                W3.N(0);
            }
            a.t1(W3);
            U3().Q().setValue(W3);
            C1233m c1233m = new C1233m();
            Context requireContext3 = requireContext();
            kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
            c1233m.E(requireContext3);
        }
        a.i();
        L3();
    }

    private final void s3(final Context context) {
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k22 = activity.k2();
        if (k22 != null) {
            k22.dismiss();
        }
        final Drawable drawable = ContextCompat.getDrawable(context, 2131231525);
        final Drawable drawable2 = ContextCompat.getDrawable(context, 2131231523);
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        final C0612w c = C0612w.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        String G3 = P3().G();
        if (G3 == null || G3.length() == 0) {
            c.d.setImageDrawable(ContextCompat.getDrawable(context, 2131231390));
        } else {
            com.squareup.picasso.s.h().l(P3().G()).n(UptodownApp.F.h0(context)).i(c.d);
        }
        TextView textView = c.j;
        k.a aVar = N1.k.g;
        textView.setTypeface(aVar.w());
        c.j.setText(P3().M());
        c.c.setText((CharSequence) U3().a0().getValue());
        int intValue = ((Number) U3().Y().getValue()).intValue();
        if (intValue == 1) {
            c.e.setImageDrawable(drawable);
            c.f.setImageDrawable(drawable2);
            c.g.setImageDrawable(drawable2);
            c.h.setImageDrawable(drawable2);
            c.i.setImageDrawable(drawable2);
        } else if (intValue == 2) {
            c.e.setImageDrawable(drawable);
            c.f.setImageDrawable(drawable);
            c.g.setImageDrawable(drawable2);
            c.h.setImageDrawable(drawable2);
            c.i.setImageDrawable(drawable2);
        } else if (intValue == 3) {
            c.e.setImageDrawable(drawable);
            c.f.setImageDrawable(drawable);
            c.g.setImageDrawable(drawable);
            c.h.setImageDrawable(drawable2);
            c.i.setImageDrawable(drawable2);
        } else if (intValue == 4) {
            c.e.setImageDrawable(drawable);
            c.f.setImageDrawable(drawable);
            c.g.setImageDrawable(drawable);
            c.h.setImageDrawable(drawable);
            c.i.setImageDrawable(drawable2);
        } else if (intValue != 5) {
            c.e.setImageDrawable(drawable2);
            c.f.setImageDrawable(drawable2);
            c.g.setImageDrawable(drawable2);
            c.h.setImageDrawable(drawable2);
            c.i.setImageDrawable(drawable2);
        } else {
            c.e.setImageDrawable(drawable);
            c.f.setImageDrawable(drawable);
            c.g.setImageDrawable(drawable);
            c.h.setImageDrawable(drawable);
            c.i.setImageDrawable(drawable);
        }
        c.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.t3(C0837m1.this, c, drawable, drawable2, view);
            }
        });
        c.f.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.u3(C0837m1.this, c, drawable, drawable2, view);
            }
        });
        c.g.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.v3(C0837m1.this, c, drawable, drawable2, view);
            }
        });
        c.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.w3(C0837m1.this, c, drawable, drawable2, view);
            }
        });
        c.i.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.x3(C0837m1.this, c, drawable, view);
            }
        });
        c.c.setTypeface(aVar.x());
        if (U3().R().getValue() != null) {
            Object value = U3().R().getValue();
            kotlin.jvm.internal.m.b(value);
            String i = ((g2.L) value).i();
            if (i != null && i.length() != 0) {
                EditText editText = c.c;
                Object value2 = U3().R().getValue();
                kotlin.jvm.internal.m.b(value2);
                editText.setText(String.valueOf(((g2.L) value2).i()));
            }
            Object value3 = U3().R().getValue();
            kotlin.jvm.internal.m.b(value3);
            if (((g2.L) value3).h() >= 1) {
                c.e.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
            }
            Object value4 = U3().R().getValue();
            kotlin.jvm.internal.m.b(value4);
            if (((g2.L) value4).h() >= 2) {
                c.f.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
            }
            Object value5 = U3().R().getValue();
            kotlin.jvm.internal.m.b(value5);
            if (((g2.L) value5).h() >= 3) {
                c.g.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
            }
            Object value6 = U3().R().getValue();
            kotlin.jvm.internal.m.b(value6);
            if (((g2.L) value6).h() >= 4) {
                c.h.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
            }
            Object value7 = U3().R().getValue();
            kotlin.jvm.internal.m.b(value7);
            if (((g2.L) value7).h() == 5) {
                c.i.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
            }
        }
        c.l.setTypeface(aVar.w());
        c.l.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.y3(context, this, c, view);
            }
        });
        c.k.setTypeface(aVar.w());
        c.k.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.z3(C0837m1.this, c, view);
            }
        });
        builder.setView(c.getRoot());
        AbstractC0740a activity2 = getActivity();
        kotlin.jvm.internal.m.c(activity2, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        AlertDialog k23 = activity2.k2();
        if (k23 != null) {
            k23.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public final void onDismiss(DialogInterface dialogInterface) {
                    C0837m1.A3(C0837m1.this, context, dialogInterface);
                }
            });
        }
        I6(builder);
    }

    public static final void s4(C0837m1 c0837m1, View view) {
        c0837m1.u2();
    }

    public final void s5(ArrayList arrayList) {
        if (arrayList.isEmpty()) {
            return;
        }
        int dimension = (int) getResources().getDimension(2131166020);
        int dimension2 = (int) getResources().getDimension(2131166019);
        Q3().j0.setVisibility(0);
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
            if (i == AbstractC0525o.j(arrayList)) {
                layoutParams.setMargins(0, dimension, 0, dimension2);
            } else {
                layoutParams.setMargins(0, dimension, 0, dimension);
            }
            LinearLayout linearLayout = Q3().r;
            Object obj = arrayList.get(i);
            kotlin.jvm.internal.m.d(obj, "get(...)");
            linearLayout.addView(q5((C0968t) obj, layoutParams));
        }
    }

    public final void s6() {
        U6();
        S.b bVar = g2.S.m;
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        if (bVar.e(requireContext) == null) {
            TextView tvDownloadCancelBad = Q3().L.h;
            kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
            String string = getString(2131952499);
            kotlin.jvm.internal.m.d(string, "getString(...)");
            Z5(tvDownloadCancelBad, string);
            Q3().H.o.setText(getString(2131952499));
            Q3().H.d.setVisibility(0);
            TextView tvDownloadCancelBad2 = Q3().L.h;
            kotlin.jvm.internal.m.d(tvDownloadCancelBad2, "tvDownloadCancelBad");
            a5(tvDownloadCancelBad2);
            RelativeLayout rlStatusPreRegister = Q3().H.h;
            kotlin.jvm.internal.m.d(rlStatusPreRegister, "rlStatusPreRegister");
            a5(rlStatusPreRegister);
        } else {
            U2();
        }
        Q3().O.e.setVisibility(0);
        Q3().O.c.setVisibility(8);
        Q3().O.o.setVisibility(8);
        Q3().L.d.setVisibility(8);
        Q3().x.setVisibility(8);
        W3(2131361854);
        W3(2131361892);
    }

    private final void t2() {
        if (getContext() != null) {
            S.b bVar = g2.S.m;
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            if (bVar.e(requireContext) == null) {
                Z4();
                return;
            }
            if (P3().g0() == 1) {
                C0880s1 U3 = U3();
                Context requireContext2 = requireContext();
                kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
                U3.r0(requireContext2, P3().e());
                return;
            }
            C0880s1 U32 = U3();
            Context requireContext3 = requireContext();
            kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
            U32.q0(requireContext3, P3().e());
        }
    }

    public static final void t3(C0837m1 c0837m1, C0612w c0612w, Drawable drawable, Drawable drawable2, View view) {
        if (UptodownApp.F.a0()) {
            c0837m1.U3().Y().setValue(1);
            c0612w.e.setImageDrawable(drawable);
            c0612w.f.setImageDrawable(drawable2);
            c0612w.g.setImageDrawable(drawable2);
            c0612w.h.setImageDrawable(drawable2);
            c0612w.i.setImageDrawable(drawable2);
        }
    }

    public final void t5(ArrayList arrayList) {
        LinearLayout llFloatingCategoriesAppDetail = Q3().s;
        kotlin.jvm.internal.m.d(llFloatingCategoriesAppDetail, "llFloatingCategoriesAppDetail");
        if (llFloatingCategoriesAppDetail.getChildCount() == 0) {
            Q3().k0.setTypeface(N1.k.g.w());
            if (getActivity() != null) {
                HorizontalScrollView horizontalScrollView = new HorizontalScrollView(requireContext());
                horizontalScrollView.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
                horizontalScrollView.setHorizontalScrollBarEnabled(false);
                LinearLayout linearLayout = new LinearLayout(requireContext());
                linearLayout.setOrientation(0);
                linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
                horizontalScrollView.addView(linearLayout);
                Q3().s.addView(horizontalScrollView);
                Iterator it = arrayList.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;
                    int dimension = (int) getResources().getDimension(2131166020);
                    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
                    if (kotlin.jvm.internal.m.a(c0957h, AbstractC0525o.P(arrayList))) {
                        layoutParams.setMargins(dimension, 0, dimension, 0);
                    } else {
                        layoutParams.setMargins(dimension, 0, 0, 0);
                    }
                    linearLayout.addView(u5(c0957h, layoutParams));
                }
            }
            Q3().t.setVisibility(0);
        }
    }

    public final void t6(Context context) {
        Q3().O.x.setVisibility(8);
        Q3().O.d.setVisibility(8);
        if (U3().Q().getValue() != null) {
            q6(context);
        } else {
            String f0 = P3().f0();
            if (f0 == null || f0.length() == 0) {
                String string = getString(2131951686);
                kotlin.jvm.internal.m.d(string, "getString(...)");
                f6(string);
            } else {
                String f02 = P3().f0();
                kotlin.jvm.internal.m.b(f02);
                f6(f02);
            }
        }
        Q3().L.d.setVisibility(8);
        W3(2131361854);
    }

    private final void u2() {
        if (getContext() != null) {
            S.b bVar = g2.S.m;
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            if (bVar.e(requireContext) == null) {
                Z4();
                return;
            }
            if (P3().D0() == 1) {
                C0880s1 U3 = U3();
                Context requireContext2 = requireContext();
                kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
                U3.y0(requireContext2, P3().e());
                return;
            }
            C0880s1 U32 = U3();
            Context requireContext3 = requireContext();
            kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
            U32.x0(requireContext3, P3().e());
        }
    }

    public static final void u3(C0837m1 c0837m1, C0612w c0612w, Drawable drawable, Drawable drawable2, View view) {
        if (UptodownApp.F.a0()) {
            c0837m1.U3().Y().setValue(2);
            c0612w.e.setImageDrawable(drawable);
            c0612w.f.setImageDrawable(drawable);
            c0612w.g.setImageDrawable(drawable2);
            c0612w.h.setImageDrawable(drawable2);
            c0612w.i.setImageDrawable(drawable2);
        }
    }

    public static final void u4(C0837m1 c0837m1, CompoundButton compoundButton, boolean z) {
        C0880s1 U3 = c0837m1.U3();
        Context requireContext = c0837m1.requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        U3.w0(requireContext, c0837m1.P3().e(), z);
    }

    private final View u5(final C0957h c0957h, LinearLayout.LayoutParams layoutParams) {
        C0573c c = C0573c.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        c.getRoot().setLayoutParams(layoutParams);
        c.getRoot().setTypeface(N1.k.g.w());
        c.getRoot().setText(String.valueOf(c0957h.d()));
        c.getRoot().setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.v5(C0837m1.this, c0957h, view);
            }
        });
        TextView root = c.getRoot();
        kotlin.jvm.internal.m.d(root, "getRoot(...)");
        return root;
    }

    private final void u6() {
        R6();
        U3().P().setValue(4);
        Q3().L.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.v6(C0837m1.this, view);
            }
        });
        TextView tvDownloadCancelBad = Q3().L.h;
        kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
        String string = getString(N1.i.j0);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        a6(tvDownloadCancelBad, string);
        TextView tvPauseBad = Q3().L.j;
        kotlin.jvm.internal.m.d(tvPauseBad, "tvPauseBad");
        String string2 = getString(2131952771);
        kotlin.jvm.internal.m.d(string2, "getString(...)");
        Z5(tvPauseBad, string2);
        TextView tvStatusDownload = Q3().H.n;
        kotlin.jvm.internal.m.d(tvStatusDownload, "tvStatusDownload");
        String string3 = getString(2131952771);
        kotlin.jvm.internal.m.d(string3, "getString(...)");
        Z5(tvStatusDownload, string3);
    }

    public final void v2(View view) {
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view2) {
                C0837m1.w2(C0837m1.this, view2);
            }
        });
    }

    public static final void v3(C0837m1 c0837m1, C0612w c0612w, Drawable drawable, Drawable drawable2, View view) {
        if (UptodownApp.F.a0()) {
            c0837m1.U3().Y().setValue(3);
            c0612w.e.setImageDrawable(drawable);
            c0612w.f.setImageDrawable(drawable);
            c0612w.g.setImageDrawable(drawable);
            c0612w.h.setImageDrawable(drawable2);
            c0612w.i.setImageDrawable(drawable2);
        }
    }

    public static final void v4(C0837m1 c0837m1, Context context, AppBarLayout appBarLayout, int i) {
        kotlin.jvm.internal.m.e(appBarLayout, "appBarLayout");
        if (Math.abs(i) == appBarLayout.getTotalScrollRange()) {
            c0837m1.U3().g0().setValue(Boolean.TRUE);
        } else if (i == 0) {
            c0837m1.U3().g0().setValue(Boolean.FALSE);
            c0837m1.W6(context);
        } else {
            c0837m1.U3().g0().setValue(Boolean.FALSE);
            c0837m1.V6(context);
        }
    }

    public static final void v5(C0837m1 c0837m1, C0957h c0957h, View view) {
        if (UptodownApp.F.a0()) {
            c0837m1.V4(c0957h);
        }
    }

    public static final void v6(C0837m1 c0837m1, View view) {
        c0837m1.Z2();
    }

    public static final void w2(C0837m1 c0837m1, View view) {
        if (UptodownApp.F.a0()) {
            C0880s1 U3 = c0837m1.U3();
            Context requireContext = c0837m1.requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            long e = c0837m1.P3().e();
            String M3 = c0837m1.P3().M();
            kotlin.jvm.internal.m.b(M3);
            U3.t(requireContext, e, M3, c0837m1.P3().G(), System.currentTimeMillis(), c0837m1.Q3().Y.isChecked());
        }
    }

    public static final void w3(C0837m1 c0837m1, C0612w c0612w, Drawable drawable, Drawable drawable2, View view) {
        if (UptodownApp.F.a0()) {
            c0837m1.U3().Y().setValue(4);
            c0612w.e.setImageDrawable(drawable);
            c0612w.f.setImageDrawable(drawable);
            c0612w.g.setImageDrawable(drawable);
            c0612w.h.setImageDrawable(drawable);
            c0612w.i.setImageDrawable(drawable2);
        }
    }

    public static final void w4(C0837m1 c0837m1, NestedScrollView nestedScrollView, int i, int i4, int i5, int i6) {
        boolean z;
        Rect rect = new Rect();
        c0837m1.Q3().a0.getHitRect(rect);
        c0837m1.H6(rect);
        if (c0837m1.Q3().O.r.getLocalVisibleRect(rect)) {
            c0837m1.Q3().d.setTitle(TtmlNode.ANONYMOUS_REGION_ID);
            c0837m1.U3().F().setValue(Boolean.TRUE);
            return;
        }
        boolean booleanValue = ((Boolean) c0837m1.U3().F().getValue()).booleanValue();
        c0837m1.U3().F().setValue(Boolean.FALSE);
        String M3 = c0837m1.P3().M();
        if (M3 == null || M3.length() == 0) {
            return;
        }
        ArrayList B02 = c0837m1.P3().B0();
        if (B02 == null || B02.isEmpty()) {
            String z3 = c0837m1.P3().z();
            if (z3 == null || z3.length() == 0) {
                c0837m1.Q3().d.setTitleEnabled(false);
                z = true;
            } else {
                z = ((Boolean) c0837m1.U3().g0().getValue()).booleanValue();
            }
        } else {
            z = ((Boolean) c0837m1.U3().g0().getValue()).booleanValue();
        }
        if (booleanValue && z) {
            if (c0837m1.getResources().getConfiguration().getLayoutDirection() == 1) {
                String M4 = c0837m1.P3().M();
                kotlin.jvm.internal.m.b(M4);
                int length = M4.length() - 1;
                int i7 = 0;
                for (int i8 = 0; i8 < length; i8++) {
                    String M5 = c0837m1.P3().M();
                    kotlin.jvm.internal.m.b(M5);
                    char charAt = M5.charAt(i8);
                    if (charAt != ' ' && !u2.I.a.j(charAt)) {
                        i7++;
                    }
                }
                if (i7 > 0) {
                    c0837m1.Q3().d.setRtlTextDirectionHeuristicsEnabled(false);
                    c0837m1.Q3().d.setLayoutDirection(0);
                }
            }
            CollapsingToolbarLayout collapsingToolbarLayout = c0837m1.Q3().d;
            String M6 = c0837m1.P3().M();
            kotlin.jvm.internal.m.b(M6);
            collapsingToolbarLayout.setTitle(M6);
        }
    }

    public final void w5() {
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        n5(requireContext);
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        Q6(requireContext2);
        f7();
        T5();
        U3().x().setValue(Boolean.TRUE);
        if (((Number) U3().l0().getValue()).intValue() > 0) {
            d7();
        }
        L3();
    }

    public final void w6(int i) {
        X3();
        Q3().O.t.setText(getString(N1.i.f156q0, new Object[]{Integer.valueOf(i)}));
        Q3().H.l.setText(getString(N1.i.f156q0, new Object[]{Integer.valueOf(i)}));
    }

    public final void x2() {
        if (D4()) {
            C0958i m = UptodownApp.F.m();
            kotlin.jvm.internal.m.b(m);
            if (m.b() != -1 || getContext() == null) {
                return;
            }
            a.C0191a c0191a = com.uptodown.activities.preferences.a.a;
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            if (c0191a.M(requireContext)) {
                Context requireContext2 = requireContext();
                kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
                if (!c0191a.Y(requireContext2)) {
                    Context requireContext3 = requireContext();
                    kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
                    c0191a.W0(requireContext3, false);
                }
                Context requireContext4 = requireContext();
                kotlin.jvm.internal.m.d(requireContext4, "requireContext(...)");
                E3(requireContext4);
            }
        }
    }

    public static final void x3(C0837m1 c0837m1, C0612w c0612w, Drawable drawable, View view) {
        if (UptodownApp.F.a0()) {
            c0837m1.U3().Y().setValue(5);
            c0612w.e.setImageDrawable(drawable);
            c0612w.f.setImageDrawable(drawable);
            c0612w.g.setImageDrawable(drawable);
            c0612w.h.setImageDrawable(drawable);
            c0612w.i.setImageDrawable(drawable);
        }
    }

    public static final void x4(C0837m1 c0837m1, View view) {
        c0837m1.g5();
    }

    public final void x5(g2.L l) {
        if (getActivity() == null || requireActivity().isFinishing() || l == null) {
            return;
        }
        if (l.h() >= 1) {
            Q3().C.b.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
        }
        if (l.h() >= 2) {
            Q3().C.c.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
        }
        if (l.h() >= 3) {
            Q3().C.d.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
        }
        if (l.h() >= 4) {
            Q3().C.e.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
        }
        if (l.h() == 5) {
            Q3().C.f.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231525));
        }
        Q3().C.i.setText(getString(2131951990));
    }

    public final void x6(g2.P p) {
        C0965p c0965p;
        S6();
        C1254c c1254c = C1254c.a;
        ProgressBar pbProgressAppDetail = Q3().O.h;
        kotlin.jvm.internal.m.d(pbProgressAppDetail, "pbProgressAppDetail");
        ImageView ivLogoAppDetail = Q3().O.b;
        kotlin.jvm.internal.m.d(ivLogoAppDetail, "ivLogoAppDetail");
        c1254c.e(pbProgressAppDetail, ivLogoAppDetail);
        U3().P().setValue(5);
        if (p != null) {
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            c0965p = p.b(requireContext);
        } else {
            c0965p = null;
        }
        if (c0965p == null) {
            Q3().O.h.setIndeterminate(true);
            Q3().H.e.setIndeterminate(true);
            return;
        }
        Q3().O.e.setVisibility(8);
        Q3().O.c.setVisibility(0);
        Q3().L.i.setVisibility(8);
        TextView tvDownloadCancelBad = Q3().L.h;
        kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
        String string = getString(N1.i.j0);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        a6(tvDownloadCancelBad, string);
        Q3().L.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.y6(C0837m1.this, view);
            }
        });
        if (DownloadWorker.d.h()) {
            TextView tvPauseBad = Q3().L.j;
            kotlin.jvm.internal.m.d(tvPauseBad, "tvPauseBad");
            String string2 = getString(2131952771);
            kotlin.jvm.internal.m.d(string2, "getString(...)");
            Z5(tvPauseBad, string2);
        } else {
            TextView tvPauseBad2 = Q3().L.j;
            kotlin.jvm.internal.m.d(tvPauseBad2, "tvPauseBad");
            String string3 = getString(2131951655);
            kotlin.jvm.internal.m.d(string3, "getString(...)");
            a6(tvPauseBad2, string3);
        }
        if (c0965p.x() > 0) {
            Q3().O.h.setIndeterminate(false);
            Q3().O.h.setProgress(c0965p.x());
            Q3().H.e.setIndeterminate(false);
        } else {
            Q3().O.h.setIndeterminate(true);
            Q3().H.e.setIndeterminate(true);
        }
        TextView textView = Q3().O.t;
        Integer valueOf = Integer.valueOf(c0965p.x());
        W1.i iVar = new W1.i();
        long z = c0965p.z();
        Context requireContext2 = requireContext();
        kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
        textView.setText(getString(2131952489, new Object[]{valueOf, iVar.d(z, requireContext2)}));
        Q3().H.b.setVisibility(0);
        TextView textView2 = Q3().H.l;
        W1.i iVar2 = new W1.i();
        long z3 = (c0965p.z() * c0965p.x()) / 100;
        Context requireContext3 = requireContext();
        kotlin.jvm.internal.m.d(requireContext3, "requireContext(...)");
        textView2.setText(iVar2.d(z3, requireContext3));
        Q3().H.e.setProgress(c0965p.x());
        Q3().H.i.setVisibility(8);
        Q3().H.k.setVisibility(0);
        Q3().H.k.setText(c0965p.x() + getString(2131952488));
        TextView textView3 = Q3().H.m;
        kotlin.jvm.internal.F f = kotlin.jvm.internal.F.a;
        W1.i iVar3 = new W1.i();
        long z4 = c0965p.z();
        Context requireContext4 = requireContext();
        kotlin.jvm.internal.m.d(requireContext4, "requireContext(...)");
        String format = String.format("/%s", Arrays.copyOf(new Object[]{iVar3.d(z4, requireContext4)}, 1));
        kotlin.jvm.internal.m.d(format, "format(...)");
        textView3.setText(format);
    }

    private final void y2(C0583h c0583h) {
        c0583h.h.setTypeface(N1.k.g.w());
        c0583h.i.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.z2(C0837m1.this, view);
            }
        });
        c0583h.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.A2(C0837m1.this, view);
            }
        });
        c0583h.i.setFocusable(true);
        c0583h.j.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.B2(C0837m1.this, view);
            }
        });
    }

    public static final void y3(Context context, C0837m1 c0837m1, C0612w c0612w, View view) {
        if (UptodownApp.F.a0()) {
            g2.S e = g2.S.m.e(context);
            r3.t a02 = c0837m1.U3().a0();
            Editable text = c0612w.c.getText();
            kotlin.jvm.internal.m.d(text, "getText(...)");
            a02.setValue(m3.m.u0(text).toString());
            if ((e != null ? e.g() : null) != null) {
                String g = e.g();
                kotlin.jvm.internal.m.b(g);
                if (g.length() > 0) {
                    c0837m1.W5((String) c0837m1.U3().a0().getValue());
                    AbstractC0740a activity = c0837m1.getActivity();
                    kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                    AlertDialog k22 = activity.k2();
                    if (k22 != null) {
                        k22.dismiss();
                        return;
                    }
                    return;
                }
            }
            c0837m1.Z4();
        }
    }

    public static final void y4(C0837m1 c0837m1, View view) {
        c0837m1.M3();
    }

    public final void y5(ArrayList arrayList) {
        if (Q3().p.getVisibility() != 8 || arrayList.isEmpty()) {
            return;
        }
        M1.I i = new M1.I(new G(), new H(), 8);
        this.i = i;
        kotlin.jvm.internal.m.b(i);
        i.d(arrayList);
        Q3().V.setAdapter(this.i);
        Q3().V.setNestedScrollingEnabled(false);
        Q3().V.setLayoutManager(new LinearLayoutManager(getContext(), 0, false));
        DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
        defaultItemAnimator.setSupportsChangeAnimations(false);
        Q3().V.setItemAnimator(defaultItemAnimator);
        Q3().p.setVisibility(0);
    }

    public static final void y6(C0837m1 c0837m1, View view) {
        c0837m1.Z2();
    }

    public static final void z2(C0837m1 c0837m1, View view) {
        c0837m1.S4();
    }

    public static final void z3(C0837m1 c0837m1, C0612w c0612w, View view) {
        if (UptodownApp.F.a0()) {
            r3.t a02 = c0837m1.U3().a0();
            Editable text = c0612w.c.getText();
            kotlin.jvm.internal.m.d(text, "getText(...)");
            a02.setValue(m3.m.u0(text).toString());
            c0612w.c.setText((CharSequence) c0837m1.U3().a0().getValue());
            AbstractC0740a activity = c0837m1.getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            AlertDialog k22 = activity.k2();
            if (k22 != null) {
                k22.dismiss();
            }
        }
    }

    public static final void z4(C0837m1 c0837m1, View view) {
        c0837m1.N3();
    }

    private final View z5(LinearLayout.LayoutParams layoutParams, final g2.L l, Context context) {
        final C0613w0 c = C0613w0.c(getLayoutInflater());
        kotlin.jvm.internal.m.d(c, "inflate(...)");
        c.getRoot().setLayoutParams(layoutParams);
        c.e.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
        c.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
        c.g.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
        c.h.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
        c.i.setImageDrawable(ContextCompat.getDrawable(context, 2131231523));
        if (l.h() >= 2) {
            c.f.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
        }
        if (l.h() >= 3) {
            c.g.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
        }
        if (l.h() >= 4) {
            c.h.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
        }
        if (l.h() == 5) {
            c.i.setImageDrawable(ContextCompat.getDrawable(context, 2131231525));
        }
        AppCompatTextView appCompatTextView = c.t;
        k.a aVar = N1.k.g;
        appCompatTextView.setTypeface(aVar.w());
        c.o.setTypeface(aVar.x());
        c.n.setTypeface(aVar.x());
        c.q.setTypeface(aVar.x());
        c.r.setTypeface(aVar.x());
        S.b bVar = g2.S.m;
        String c4 = bVar.c(l.e());
        if (c4 != null && c4.length() != 0) {
            com.squareup.picasso.s.h().l(bVar.c(l.e())).n(UptodownApp.F.h0(context)).i(c.c);
        }
        String l4 = l.l();
        if (l4 != null && l4.length() != 0) {
            c.c.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.A5(C0837m1.this, l, view);
                }
            });
            c.t.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.B5(C0837m1.this, l, view);
                }
            });
        }
        String m = l.m();
        if (m != null && m.length() != 0) {
            c.t.setText(l.m());
            UsernameTextView.a aVar2 = UsernameTextView.k;
            UsernameTextView tvUsernameReview = c.t;
            kotlin.jvm.internal.m.d(tvUsernameReview, "tvUsernameReview");
            aVar2.a(tvUsernameReview, l.o(), l.n());
        }
        String k = l.k();
        if (k != null && k.length() != 0) {
            c.o.setText(l.k());
        }
        if (l.a() > 0) {
            c.r.setText(String.valueOf(l.a()));
        }
        String i = l.i();
        if (i == null || i.length() == 0) {
            c.n.setVisibility(8);
            c.l.setVisibility(8);
            c.k.setVisibility(8);
        } else {
            c.q.setFocusable(true);
            TextView textView = c.n;
            Spanned j = l.j();
            textView.setText(j != null ? m3.m.u0(j) : null);
            c.n.getViewTreeObserver().addOnPreDrawListener(new I(c));
            c.s.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.C5(C0613w0.this, this, view);
                }
            });
            c.l.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.D5(C0837m1.this, l, view);
                }
            });
            c.l.setFocusable(true);
            c.p.setTypeface(aVar.x());
            c.p.setText(String.valueOf(l.g()));
            if (u2.I.a.i(l.f())) {
                c.d.setImageDrawable(ContextCompat.getDrawable(requireContext(), 2131231426));
            }
            c.k.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    C0837m1.E5(C0837m1.this, c, l, view);
                }
            });
        }
        c.q.setFocusable(true);
        RelativeLayout root = c.getRoot();
        kotlin.jvm.internal.m.d(root, "getRoot(...)");
        return root;
    }

    public final void z6(final Context context) {
        R6();
        C1254c c1254c = C1254c.a;
        ProgressBar pbProgressAppDetail = Q3().O.h;
        kotlin.jvm.internal.m.d(pbProgressAppDetail, "pbProgressAppDetail");
        ImageView ivLogoAppDetail = Q3().O.b;
        kotlin.jvm.internal.m.d(ivLogoAppDetail, "ivLogoAppDetail");
        c1254c.c(pbProgressAppDetail, ivLogoAppDetail);
        U3().P().setValue(2);
        TextView tvDownloadCancelBad = Q3().L.h;
        kotlin.jvm.internal.m.d(tvDownloadCancelBad, "tvDownloadCancelBad");
        String string = getString(2131952772);
        kotlin.jvm.internal.m.d(string, "getString(...)");
        Z5(tvDownloadCancelBad, string);
        Q3().L.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                C0837m1.A6(C0837m1.this, context, view);
            }
        });
        Q3().H.n.setText(getString(2131952772));
        TextView tvStatusDownload = Q3().H.n;
        kotlin.jvm.internal.m.d(tvStatusDownload, "tvStatusDownload");
        String string2 = getString(2131952772);
        kotlin.jvm.internal.m.d(string2, "getString(...)");
        Z5(tvStatusDownload, string2);
        K6(2131361856);
    }

    public final void O2(Context context) {
        kotlin.jvm.internal.m.e(context, "context");
        Q6(context);
    }

    public final C0955f P3() {
        C0955f c0955f = this.a;
        if (c0955f != null) {
            return c0955f;
        }
        kotlin.jvm.internal.m.u("appInfo");
        return null;
    }

    public final void U5() {
        R3();
    }

    public final void X6(String str) {
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new X(str, this, null), 2, (Object) null);
    }

    public final void Y5(C0955f c0955f) {
        kotlin.jvm.internal.m.e(c0955f, "<set-?>");
        this.a = c0955f;
    }

    public final void Z6(String packagename) {
        kotlin.jvm.internal.m.e(packagename, "packagename");
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new Y(packagename, this, null), 2, (Object) null);
    }

    public final void a7(String packagename) {
        kotlin.jvm.internal.m.e(packagename, "packagename");
        if (getContext() == null || P3().R() == null || m3.m.p(P3().R(), packagename, true)) {
            return;
        }
        Context requireContext = requireContext();
        kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
        Q6(requireContext);
        if (getActivity() == null || requireActivity().isFinishing() || !(getActivity() instanceof AbstractC0740a)) {
            return;
        }
        AbstractC0740a activity = getActivity();
        kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
        String string = getString(2131952082, new Object[]{P3().M()});
        kotlin.jvm.internal.m.d(string, "getString(...)");
        activity.r0(string);
    }

    public void onCreate(android.os.Bundle r8) {
        throw new UnsupportedOperationException("Method not decompiled: d2.C0837m1.onCreate(android.os.Bundle):void");
    }

    public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
        kotlin.jvm.internal.m.e(inflater, "inflater");
        if (getActivity() == null) {
            return super.onCreateView(inflater, viewGroup, bundle);
        }
        this.b = C0571b.c(inflater, viewGroup, false);
        FragmentActivity requireActivity = requireActivity();
        kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
        Y3(requireActivity);
        return Q3().getRoot();
    }

    public void onDestroy() {
        try {
            MBBannerView mbBannerView = Q3().D;
            kotlin.jvm.internal.m.d(mbBannerView, "mbBannerView");
            mbBannerView.release();
        } catch (Exception unused) {
        }
        super.onDestroy();
    }

    public void onPause() {
        super.onPause();
        U3().J().setValue(Boolean.valueOf(!((Boolean) U3().J().getValue()).booleanValue()));
        MBBannerView mbBannerView = Q3().D;
        kotlin.jvm.internal.m.d(mbBannerView, "mbBannerView");
        mbBannerView.onPause();
    }

    public void onResume() {
        String o;
        super.onResume();
        u2.z zVar = this.d;
        if (zVar != null) {
            zVar.e("AppDetailsFragment");
        }
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new C0860w(null), 2, (Object) null);
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new C0861x(null), 2, (Object) null);
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new C0862y(null), 2, (Object) null);
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new C0863z(null), 2, (Object) null);
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new A(null), 2, (Object) null);
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new B(null), 2, (Object) null);
        if (!((Boolean) U3().O().getValue()).booleanValue()) {
            Rect rect = new Rect();
            Q3().a0.getHitRect(rect);
            H6(rect);
        }
        if (((Boolean) U3().O().getValue()).booleanValue() || (o = P3().o()) == null || o.length() == 0) {
            U3().O().setValue(Boolean.FALSE);
        } else {
            Context requireContext = requireContext();
            kotlin.jvm.internal.m.d(requireContext, "requireContext(...)");
            Q6(requireContext);
        }
        String o02 = P3().o0();
        int i = 0;
        if (o02 == null || o02.length() == 0 || V3()) {
            Q3().f186G0.getRoot().setVisibility(8);
        } else {
            Q3().f186G0.getRoot().setVisibility(0);
        }
        L3();
        if (Q3().a0.getScrollY() > 0) {
            Context requireContext2 = requireContext();
            kotlin.jvm.internal.m.d(requireContext2, "requireContext(...)");
            V6(requireContext2);
            String z = P3().z();
            if (z == null || z.length() == 0) {
                Q3().d.setTitle(TtmlNode.ANONYMOUS_REGION_ID);
            }
        }
        M1.I i4 = this.h;
        if (i4 != null) {
            i4.notifyDataSetChanged();
        }
        M1.I i5 = this.i;
        if (i5 != null) {
            i5.notifyDataSetChanged();
        }
        ArrayList arrayList = this.j;
        int size = arrayList.size();
        while (i < size) {
            Object obj = arrayList.get(i);
            i++;
            ((M1.I) obj).notifyDataSetChanged();
        }
        o3.g.d(LifecycleOwnerKt.getLifecycleScope(this), o3.Y.c(), (o3.L) null, new C(null), 2, (Object) null);
        Q4();
        MBBannerView mbBannerView = Q3().D;
        kotlin.jvm.internal.m.d(mbBannerView, "mbBannerView");
        mbBannerView.onResume();
    }

    public static final class D implements f2.J {
        D() {
        }

        @Override
        public void a(g2.S user) {
            kotlin.jvm.internal.m.e(user, "user");
            Intent intent = new Intent(C0837m1.this.requireContext(), (Class<?>) PublicProfileActivity.class);
            intent.putExtra("user", user);
            C0837m1 c0837m1 = C0837m1.this;
            UptodownApp.a aVar = UptodownApp.F;
            FragmentActivity requireActivity = c0837m1.requireActivity();
            kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
            c0837m1.startActivity(intent, aVar.a(requireActivity));
        }

        @Override
        public void b() {
        }
    }

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

        @Override
        public void onAnimationEnd(Animation animation) {
            C0837m1.this.Q3().f.removeAllViews();
            C0837m1.this.U3().z().set(false);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

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

    public static final class C0855r implements S1.m {

        public static final class a implements S1.h {
            final C0837m1 a;

            a(C0837m1 c0837m1) {
                this.a = c0837m1;
            }

            @Override
            public void a() {
                C0837m1 c0837m1 = this.a;
                String string = c0837m1.getString(N1.i.T);
                kotlin.jvm.internal.m.d(string, "getString(...)");
                c0837m1.l6(string);
            }

            @Override
            public void b(String str) {
                if (str != null) {
                    this.a.j3(str);
                    return;
                }
                C0837m1 c0837m1 = this.a;
                String string = c0837m1.getString(2131952006);
                kotlin.jvm.internal.m.d(string, "getString(...)");
                c0837m1.j3(string);
            }
        }

        C0855r() {
        }

        @Override
        public void a(File fileZipped, ArrayList files) {
            kotlin.jvm.internal.m.e(fileZipped, "fileZipped");
            kotlin.jvm.internal.m.e(files, "files");
            a aVar = new a(C0837m1.this);
            if (C0837m1.this.getActivity() != null) {
                FragmentActivity activity = C0837m1.this.getActivity();
                kotlin.jvm.internal.m.b(activity);
                if (activity.isFinishing()) {
                    return;
                }
                FragmentActivity activity2 = C0837m1.this.getActivity();
                kotlin.jvm.internal.m.b(activity2);
                W1.C c = new W1.C(activity2);
                c.x(files);
                ArrayList y = c.y();
                FragmentActivity requireActivity = C0837m1.this.requireActivity();
                kotlin.jvm.internal.m.d(requireActivity, "requireActivity(...)");
                new W1.j(requireActivity, aVar).w(y, false);
                if (C0837m1.this.getActivity() instanceof AbstractC0740a) {
                    v.a aVar2 = u2.v.v;
                    FragmentActivity activity3 = C0837m1.this.getActivity();
                    kotlin.jvm.internal.m.b(activity3);
                    u2.v a4 = aVar2.a(activity3);
                    a4.a();
                    String name = fileZipped.getName();
                    kotlin.jvm.internal.m.d(name, "getName(...)");
                    C0965p b0 = a4.b0(name);
                    a4.i();
                    if (b0 != null) {
                        AbstractC0740a activity4 = C0837m1.this.getActivity();
                        kotlin.jvm.internal.m.c(activity4, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
                        activity4.A2(b0);
                    }
                }
            }
        }

        @Override
        public void b(int i) {
            C0837m1.this.w6(i);
        }

        @Override
        public void e() {
            if (C0837m1.this.getContext() != null) {
                C0837m1 c0837m1 = C0837m1.this;
                String string = c0837m1.getString(N1.i.b0, new Object[]{c0837m1.getString(N1.i.b)});
                kotlin.jvm.internal.m.d(string, "getString(...)");
                C0837m1.this.j3(string);
            }
        }

        @Override
        public void f() {
            if (C0837m1.this.getContext() != null) {
                C0837m1 c0837m1 = C0837m1.this;
                String string = c0837m1.getString(N1.i.v, new Object[]{c0837m1.getString(N1.i.b)});
                kotlin.jvm.internal.m.d(string, "getString(...)");
                C0837m1.this.j3(string);
            }
        }

        @Override
        public void g() {
            C0837m1.this.w6(0);
        }

        @Override
        public void h() {
            if (C0837m1.this.getContext() != null) {
                String string = C0837m1.this.getString(N1.i.K);
                kotlin.jvm.internal.m.d(string, "getString(...)");
                C0837m1.this.j3(string);
            }
        }

        @Override
        public void i() {
            if (C0837m1.this.getActivity() == null || !(C0837m1.this.getActivity() instanceof AbstractC0740a)) {
                return;
            }
            AbstractC0740a activity = C0837m1.this.getActivity();
            kotlin.jvm.internal.m.c(activity, "null cannot be cast to non-null type com.uptodown.activities.BaseActivity");
            activity.K();
        }

        @Override
        public void c(File file) {
        }

        @Override
        public void d(File file) {
        }
    }

    public static final void r5(View view) {
    }

    public static final void t4(View view) {
    }
}