package com.seewo.ota.activity;

import android.app.Dialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.x;
import com.seewo.ota.R;
import com.seewo.ota.activity.n2.b;
import d.e.h.a.b;
import java.text.DecimalFormat;

/* JADX INFO: compiled from: UpdateInfoSettings3.kt */
/* JADX INFO: loaded from: classes.dex */
public final class m2 extends Fragment implements g.a.h0 {
    private com.seewo.ota.l.c e0;
    private Dialog g0;
    private androidx.activity.result.c<Intent> i0;
    private final /* synthetic */ g.a.h0 d0 = g.a.i0.b();
    private final f.e f0 = androidx.fragment.app.a0.a(this, f.z.d.v.b(com.seewo.ota.activity.n2.b.class), new g(this), new h(this));
    private final DecimalFormat h0 = new DecimalFormat("0.0");

    /* JADX INFO: compiled from: UpdateInfoSettings3.kt */
    public /* synthetic */ class a {
        public static final /* synthetic */ int[] a;

        static {
            int[] iArr = new int[b.a.values().length];
            iArr[b.a.DOWNLOADING.ordinal()] = 1;
            iArr[b.a.DOWNLOADED.ordinal()] = 2;
            iArr[b.a.DOWNLOAD_PAUSED.ordinal()] = 3;
            a = iArr;
        }
    }

    /* JADX INFO: compiled from: UpdateInfoSettings3.kt */
    static final class b extends f.z.d.l implements f.z.c.p<DialogInterface, Integer, f.t> {
        b() {
            super(2);
        }

        public final void b(DialogInterface dialogInterface, int i2) {
            f.z.d.k.e(dialogInterface, "dialogInterface");
            m2.this.E1();
        }

        @Override // f.z.c.p
        public /* bridge */ /* synthetic */ f.t invoke(DialogInterface dialogInterface, Integer num) {
            b(dialogInterface, num.intValue());
            return f.t.a;
        }
    }

    /* JADX INFO: compiled from: UpdateInfoSettings3.kt */
    static final class c extends f.z.d.l implements f.z.c.p<DialogInterface, Integer, f.t> {
        c() {
            super(2);
        }

        public final void b(DialogInterface dialogInterface, int i2) {
            f.z.d.k.e(dialogInterface, "dialogInterface");
            m2.this.G1().K();
            m2.this.E1();
        }

        @Override // f.z.c.p
        public /* bridge */ /* synthetic */ f.t invoke(DialogInterface dialogInterface, Integer num) {
            b(dialogInterface, num.intValue());
            return f.t.a;
        }
    }

    /* JADX INFO: compiled from: UpdateInfoSettings3.kt */
    static final class d extends f.z.d.l implements f.z.c.p<DialogInterface, Integer, f.t> {
        d() {
            super(2);
        }

        public final void b(DialogInterface dialogInterface, int i2) {
            f.z.d.k.e(dialogInterface, "dialogInterface");
            com.seewo.ota.l.c cVar = m2.this.e0;
            if (cVar == null) {
                f.z.d.k.p("binding");
                throw null;
            }
            cVar.f2145b.setEnabled(true);
            m2.this.E1();
        }

        @Override // f.z.c.p
        public /* bridge */ /* synthetic */ f.t invoke(DialogInterface dialogInterface, Integer num) {
            b(dialogInterface, num.intValue());
            return f.t.a;
        }
    }

    /* JADX INFO: compiled from: UpdateInfoSettings3.kt */
    static final class e extends f.z.d.l implements f.z.c.p<DialogInterface, Integer, f.t> {
        e() {
            super(2);
        }

        public final void b(DialogInterface dialogInterface, int i2) {
            f.z.d.k.e(dialogInterface, "dialogInterface");
            m2.this.E1();
        }

        @Override // f.z.c.p
        public /* bridge */ /* synthetic */ f.t invoke(DialogInterface dialogInterface, Integer num) {
            b(dialogInterface, num.intValue());
            return f.t.a;
        }
    }

    /* JADX INFO: compiled from: UpdateInfoSettings3.kt */
    static final class f extends f.z.d.l implements f.z.c.p<DialogInterface, Integer, f.t> {
        f() {
            super(2);
        }

        public final void b(DialogInterface dialogInterface, int i2) {
            f.z.d.k.e(dialogInterface, "dialogInterface");
            m2.this.E1();
        }

        @Override // f.z.c.p
        public /* bridge */ /* synthetic */ f.t invoke(DialogInterface dialogInterface, Integer num) {
            b(dialogInterface, num.intValue());
            return f.t.a;
        }
    }

    /* JADX INFO: compiled from: FragmentViewModelLazy.kt */
    public static final class g extends f.z.d.l implements f.z.c.a<androidx.lifecycle.y> {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ Fragment f2060b;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public g(Fragment fragment) {
            super(0);
            this.f2060b = fragment;
        }

        @Override // f.z.c.a
        /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
        public final androidx.lifecycle.y invoke() {
            androidx.fragment.app.d dVarI1 = this.f2060b.i1();
            f.z.d.k.d(dVarI1, "requireActivity()");
            androidx.lifecycle.y yVarJ = dVarI1.j();
            f.z.d.k.d(yVarJ, "requireActivity().viewModelStore");
            return yVarJ;
        }
    }

    /* JADX INFO: compiled from: FragmentViewModelLazy.kt */
    public static final class h extends f.z.d.l implements f.z.c.a<x.b> {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ Fragment f2061b;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public h(Fragment fragment) {
            super(0);
            this.f2061b = fragment;
        }

        @Override // f.z.c.a
        /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
        public final x.b invoke() {
            androidx.fragment.app.d dVarI1 = this.f2061b.i1();
            f.z.d.k.d(dVarI1, "requireActivity()");
            return dVarI1.o();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void E1() {
        Dialog dialog = this.g0;
        if (dialog != null) {
            f.z.d.k.c(dialog);
            if (dialog.isShowing()) {
                Log.d("UpdateInfoSettings3", "dismissDialog: ");
                Dialog dialog2 = this.g0;
                f.z.d.k.c(dialog2);
                dialog2.dismiss();
            }
        }
    }

    private final Intent F1() {
        ComponentName componentName = new ComponentName("com.seewo.easifinder", "com.seewo.easifinder.FileRetrieverActivity");
        Intent intent = new Intent();
        intent.setType("application/zip");
        intent.setAction("android.intent.action.GET_CONTENT");
        intent.addCategory("android.intent.category.OPENABLE");
        intent.setComponent(componentName);
        intent.putExtra("key_is_forbid_cloud_driver", true);
        return intent;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final com.seewo.ota.activity.n2.b G1() {
        return (com.seewo.ota.activity.n2.b) this.f0.getValue();
    }

    private final void H1() {
        G1().o().g(Q(), new androidx.lifecycle.r() { // from class: com.seewo.ota.activity.u1
            @Override // androidx.lifecycle.r
            public final void a(Object obj) {
                m2.I1(this.a, (String) obj);
            }
        });
        com.seewo.ota.l.c cVar = this.e0;
        if (cVar != null) {
            cVar.f2145b.setOnClickListener(new View.OnClickListener() { // from class: com.seewo.ota.activity.x1
                @Override // android.view.View.OnClickListener
                public final void onClick(View view) {
                    m2.J1(this.f2104b, view);
                }
            });
        } else {
            f.z.d.k.p("binding");
            throw null;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void I1(m2 m2Var, String str) {
        f.z.d.k.e(m2Var, "this$0");
        if (str.length() > 12) {
            f.z.d.k.d(str, "it");
            str = str.substring(0, 12);
            f.z.d.k.d(str, "this as java.lang.String…ing(startIndex, endIndex)");
        }
        com.seewo.ota.l.c cVar = m2Var.e0;
        if (cVar != null) {
            cVar.f2146c.setText(str);
        } else {
            f.z.d.k.p("binding");
            throw null;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void J1(m2 m2Var, View view) {
        f.z.d.k.e(m2Var, "this$0");
        m2Var.G1().J(true);
        com.seewo.ota.l.c cVar = m2Var.e0;
        if (cVar == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        cVar.f2145b.setEnabled(false);
        m2Var.t2();
    }

    private final void K1() {
        if (!G1().B() && !G1().C()) {
            com.seewo.ota.l.c cVar = this.e0;
            if (cVar != null) {
                cVar.f2154k.setVisibility(8);
                return;
            } else {
                f.z.d.k.p("binding");
                throw null;
            }
        }
        com.seewo.ota.l.c cVar2 = this.e0;
        if (cVar2 == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        cVar2.f2154k.setVisibility(0);
        com.seewo.ota.l.c cVar3 = this.e0;
        if (cVar3 != null) {
            cVar3.f2153j.setOnClickListener(new View.OnClickListener() { // from class: com.seewo.ota.activity.p1
                @Override // android.view.View.OnClickListener
                public final void onClick(View view) {
                    m2.L1(this.f2085b, view);
                }
            });
        } else {
            f.z.d.k.p("binding");
            throw null;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void L1(m2 m2Var, View view) {
        f.z.d.k.e(m2Var, "this$0");
        if (m2Var.G1().C()) {
            m2Var.G1().N();
            return;
        }
        m2Var.y1(m2Var.F1(), 10002);
        androidx.activity.result.c<Intent> cVar = m2Var.i0;
        if (cVar != null) {
            cVar.a(m2Var.F1());
        }
    }

    private final void M1() {
        G1().m().g(Q(), new androidx.lifecycle.r() { // from class: com.seewo.ota.activity.r1
            @Override // androidx.lifecycle.r
            public final void a(Object obj) {
                m2.N1(this.a, (Integer) obj);
            }
        });
        G1().x().g(Q(), new androidx.lifecycle.r() { // from class: com.seewo.ota.activity.s1
            @Override // androidx.lifecycle.r
            public final void a(Object obj) {
                m2.O1(this.a, (b.C0053b) obj);
            }
        });
        G1().r().g(Q(), new androidx.lifecycle.r() { // from class: com.seewo.ota.activity.z1
            @Override // androidx.lifecycle.r
            public final void a(Object obj) {
                m2.P1(this.a, (f.k) obj);
            }
        });
        G1().n().g(Q(), new androidx.lifecycle.r() { // from class: com.seewo.ota.activity.y1
            @Override // androidx.lifecycle.r
            public final void a(Object obj) {
                m2.Q1(this.a, (b.a) obj);
            }
        });
        com.seewo.ota.l.c cVar = this.e0;
        if (cVar == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        cVar.f2147d.setOnClickListener(new View.OnClickListener() { // from class: com.seewo.ota.activity.q1
            @Override // android.view.View.OnClickListener
            public final void onClick(View view) {
                m2.R1(this.f2088b, view);
            }
        });
        G1().A().g(Q(), new androidx.lifecycle.r() { // from class: com.seewo.ota.activity.a2
            @Override // androidx.lifecycle.r
            public final void a(Object obj) {
                m2.S1(this.a, (Boolean) obj);
            }
        });
        G1().y().g(Q(), new androidx.lifecycle.r() { // from class: com.seewo.ota.activity.v1
            @Override // androidx.lifecycle.r
            public final void a(Object obj) {
                m2.T1(this.a, (Boolean) obj);
            }
        });
        com.seewo.ota.l.c cVar2 = this.e0;
        if (cVar2 != null) {
            cVar2.f2151h.setOnClickListener(new View.OnClickListener() { // from class: com.seewo.ota.activity.t1
                @Override // android.view.View.OnClickListener
                public final void onClick(View view) {
                    m2.U1(this.f2094b, view);
                }
            });
        } else {
            f.z.d.k.p("binding");
            throw null;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void N1(m2 m2Var, Integer num) {
        f.z.d.k.e(m2Var, "this$0");
        Log.d("UpdateInfoSettings3", "initNewVersion: " + num + ", " + m2Var.G1().z());
        if ((num != null && num.intValue() == 0) || (num != null && num.intValue() == 3)) {
            return;
        }
        com.seewo.ota.l.c cVar = m2Var.e0;
        if (cVar == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        cVar.f2145b.setEnabled(true);
        if (m2Var.G1().z()) {
            if (d.e.c.a.b.a(m2Var.i1())) {
                String strM = m2Var.M(R.string.system_update_check_result_no_need_update);
                f.z.d.k.d(strM, "getString(R.string.syste…ck_result_no_need_update)");
                m2Var.q2(strM);
            } else {
                m2Var.E1();
                com.seewo.ota.util.s.a().d(m2Var.i(), m2Var.M(R.string.system_update_check_result_error));
            }
        }
        m2Var.G1().I(false);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void O1(m2 m2Var, b.C0053b c0053b) {
        String strC;
        f.z.d.k.e(m2Var, "this$0");
        String strN = m2Var.N(R.string.system_update_size, m2Var.h0.format(c0053b.b() / 1048576));
        f.z.d.k.d(strN, "getString(R.string.syste…t(it.size/ MB_PARAMETER))");
        if (c0053b.c().length() > 12) {
            strC = c0053b.c().substring(0, 12);
            f.z.d.k.d(strC, "this as java.lang.String…ing(startIndex, endIndex)");
        } else {
            strC = c0053b.c();
        }
        com.seewo.ota.l.c cVar = m2Var.e0;
        if (cVar == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        cVar.l.setText(strC + " | " + strN);
        com.seewo.ota.l.c cVar2 = m2Var.e0;
        if (cVar2 == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        cVar2.f2152i.setText(c0053b.a());
        Log.d("UpdateInfoSettings3", "versionInfo: isManualCheck=" + m2Var.G1().z());
        Log.d("UpdateInfoSettings3", "versionInfo: isForceUpdate=" + c0053b.d());
        if (c0053b.e()) {
            com.seewo.ota.l.c cVar3 = m2Var.e0;
            if (cVar3 == null) {
                f.z.d.k.p("binding");
                throw null;
            }
            cVar3.f2150g.setVisibility(0);
            if (!c0053b.d() && !c0053b.f()) {
                m2Var.r2(c0053b.c());
                return;
            }
            if (!c0053b.d()) {
                if (!c0053b.f()) {
                    m2Var.E1();
                    return;
                }
                com.seewo.ota.l.c cVar4 = m2Var.e0;
                if (cVar4 == null) {
                    f.z.d.k.p("binding");
                    throw null;
                }
                cVar4.f2145b.setEnabled(false);
                m2Var.G1().K();
                return;
            }
            m2Var.E1();
            com.seewo.ota.l.c cVar5 = m2Var.e0;
            if (cVar5 == null) {
                f.z.d.k.p("binding");
                throw null;
            }
            cVar5.f2151h.setEnabled(false);
            com.seewo.ota.l.c cVar6 = m2Var.e0;
            if (cVar6 == null) {
                f.z.d.k.p("binding");
                throw null;
            }
            cVar6.f2151h.setSelected(true);
            m2Var.G1().H(true);
            m2Var.G1().K();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void P1(m2 m2Var, f.k kVar) {
        f.z.d.k.e(m2Var, "this$0");
        m2Var.E1();
        int iIntValue = ((Number) kVar.c()).intValue();
        if (iIntValue == 0) {
            com.seewo.ota.l.c cVar = m2Var.e0;
            if (cVar == null) {
                f.z.d.k.p("binding");
                throw null;
            }
            cVar.f2145b.setEnabled(true);
            if (!d.e.c.a.b.a(m2Var.i())) {
                m2Var.s2(R.string.ota_net_error);
            }
            m2Var.G1().I(false);
            return;
        }
        if (iIntValue == 1) {
            m2Var.o2(((Number) kVar.d()).intValue());
            return;
        }
        if (iIntValue == 2) {
            m2Var.o2(((Number) kVar.d()).intValue());
            com.seewo.ota.l.c cVar2 = m2Var.e0;
            if (cVar2 == null) {
                f.z.d.k.p("binding");
                throw null;
            }
            cVar2.f2145b.setEnabled(true);
            m2Var.G1().L();
            return;
        }
        if (iIntValue != 3) {
            return;
        }
        com.seewo.ota.l.c cVar3 = m2Var.e0;
        if (cVar3 == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        cVar3.f2145b.setEnabled(true);
        m2Var.o2(((Number) kVar.d()).intValue());
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void Q1(m2 m2Var, b.a aVar) {
        f.z.d.k.e(m2Var, "this$0");
        Log.d("UpdateInfoSettings3", "currentOTAState: " + aVar);
        int i2 = aVar == null ? -1 : a.a[aVar.ordinal()];
        if (i2 != 1) {
            if (i2 == 2) {
                com.seewo.ota.l.c cVar = m2Var.e0;
                if (cVar == null) {
                    f.z.d.k.p("binding");
                    throw null;
                }
                cVar.f2150g.setVisibility(0);
                m2Var.o2(100);
                return;
            }
            if (i2 != 3) {
                return;
            }
            com.seewo.ota.l.c cVar2 = m2Var.e0;
            if (cVar2 != null) {
                cVar2.f2150g.setVisibility(0);
                return;
            } else {
                f.z.d.k.p("binding");
                throw null;
            }
        }
        com.seewo.ota.l.c cVar3 = m2Var.e0;
        if (cVar3 == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        if (cVar3.f2145b.isEnabled()) {
            com.seewo.ota.l.c cVar4 = m2Var.e0;
            if (cVar4 == null) {
                f.z.d.k.p("binding");
                throw null;
            }
            cVar4.f2145b.setEnabled(false);
        }
        com.seewo.ota.l.c cVar5 = m2Var.e0;
        if (cVar5 != null) {
            cVar5.f2150g.setVisibility(0);
        } else {
            f.z.d.k.p("binding");
            throw null;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void R1(m2 m2Var, View view) {
        f.z.d.k.e(m2Var, "this$0");
        com.seewo.ota.l.c cVar = m2Var.e0;
        if (cVar == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        if (cVar.f2147d.isSelected()) {
            m2Var.G1().F();
            return;
        }
        m2Var.G1().K();
        com.seewo.ota.l.c cVar2 = m2Var.e0;
        if (cVar2 != null) {
            cVar2.f2145b.setEnabled(false);
        } else {
            f.z.d.k.p("binding");
            throw null;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void S1(m2 m2Var, Boolean bool) {
        f.z.d.k.e(m2Var, "this$0");
        com.seewo.ota.l.c cVar = m2Var.e0;
        if (cVar == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        ImageView imageView = cVar.f2147d;
        f.z.d.k.d(bool, "it");
        imageView.setSelected(bool.booleanValue());
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void T1(m2 m2Var, Boolean bool) {
        f.z.d.k.e(m2Var, "this$0");
        com.seewo.ota.l.c cVar = m2Var.e0;
        if (cVar == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        ImageView imageView = cVar.f2151h;
        f.z.d.k.d(bool, "it");
        imageView.setSelected(bool.booleanValue());
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void U1(m2 m2Var, View view) {
        f.z.d.k.e(m2Var, "this$0");
        com.seewo.ota.activity.n2.b bVarG1 = m2Var.G1();
        if (m2Var.e0 != null) {
            bVarG1.H(!r0.f2151h.isSelected());
        } else {
            f.z.d.k.p("binding");
            throw null;
        }
    }

    private final void V1() {
        com.seewo.ota.l.c cVar = this.e0;
        if (cVar != null) {
            cVar.f2146c.setOnClickListener(new com.seewo.ota.p.e(0, 1, null));
        } else {
            f.z.d.k.p("binding");
            throw null;
        }
    }

    private final void W1() {
        if (G1().E()) {
            Context applicationContext = j1().getApplicationContext();
            f.z.d.k.d(applicationContext, "requireContext().applicationContext");
            final com.seewo.ota.view.h hVar = new com.seewo.ota.view.h(applicationContext);
            G1().v().g(Q(), new androidx.lifecycle.r() { // from class: com.seewo.ota.activity.o1
                @Override // androidx.lifecycle.r
                public final void a(Object obj) {
                    m2.X1(hVar, (Integer) obj);
                }
            });
            G1().u().g(Q(), new androidx.lifecycle.r() { // from class: com.seewo.ota.activity.w1
                @Override // androidx.lifecycle.r
                public final void a(Object obj) {
                    m2.Y1(hVar, (Integer) obj);
                }
            });
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void X1(com.seewo.ota.view.h hVar, Integer num) {
        f.z.d.k.e(hVar, "$dialog");
        if (num != null && num.intValue() == 6) {
            if (hVar.isShowing()) {
                return;
            }
            hVar.show();
        } else if (num != null && num.intValue() == 5) {
            if (hVar.isShowing()) {
                hVar.dismiss();
            }
        } else if (hVar.isShowing()) {
            hVar.dismiss();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void Y1(com.seewo.ota.view.h hVar, Integer num) {
        f.z.d.k.e(hVar, "$dialog");
        f.z.d.k.d(num, "it");
        hVar.b(num.intValue());
    }

    private final void Z1() {
        H1();
        M1();
        K1();
        W1();
        V1();
    }

    private final void n2(Window window, boolean z) {
        if (Build.VERSION.SDK_INT >= 26) {
            int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
            window.getDecorView().setSystemUiVisibility(z ? systemUiVisibility & (-17) : systemUiVisibility | 16);
        }
    }

    private final void o2(int i2) {
        com.seewo.ota.l.c cVar = this.e0;
        if (cVar == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        cVar.f2148e.setText(N(R.string.system_update_progress, Integer.valueOf(i2)));
        com.seewo.ota.l.c cVar2 = this.e0;
        if (cVar2 != null) {
            cVar2.f2149f.setProgress(i2);
        } else {
            f.z.d.k.p("binding");
            throw null;
        }
    }

    private final void p2() {
        Window window = i1().getWindow();
        f.z.d.k.d(window, "requireActivity().window");
        if (Build.VERSION.SDK_INT >= 29) {
            window.setNavigationBarContrastEnforced(false);
        }
        n2(window, false);
    }

    private final void q2(String str) {
        Log.d("UpdateInfoSettings3", "showDialog: " + str);
        E1();
        Context applicationContext = i1().getApplicationContext();
        f.z.d.k.d(applicationContext, "requireActivity().applicationContext");
        com.seewo.ota.view.g gVar = new com.seewo.ota.view.g(applicationContext);
        Window window = gVar.getWindow();
        if (window != null) {
            window.setType(2003);
        }
        gVar.setTitle(R.string.system_update_check_result_title);
        gVar.r(str);
        gVar.t(R.string.btn_ok, new b());
        this.g0 = gVar;
        if (gVar != null) {
            gVar.show();
        }
    }

    private final void r2(String str) {
        Log.d("UpdateInfoSettings3", "showDownloadDialog: " + str);
        E1();
        Context applicationContext = i1().getApplicationContext();
        f.z.d.k.d(applicationContext, "requireActivity().applicationContext");
        com.seewo.ota.view.g gVar = new com.seewo.ota.view.g(applicationContext);
        gVar.setTitle(R.string.system_update_check_result_title);
        Window window = gVar.getWindow();
        if (window != null) {
            window.setType(2003);
        }
        gVar.r(M(R.string.system_update_new_version_message) + '\n' + N(R.string.system_update_new_version_info, str));
        gVar.t(R.string.system_update_download_and_update, new c());
        gVar.s(R.string.button_cancel, new d());
        this.g0 = gVar;
        if (gVar != null) {
            gVar.show();
        }
    }

    private final void s2(int i2) {
        Log.d("UpdateInfoSettings3", "showDownloadErrorDialog: " + M(i2));
        E1();
        Context applicationContext = i1().getApplicationContext();
        f.z.d.k.d(applicationContext, "requireActivity().applicationContext");
        com.seewo.ota.view.g gVar = new com.seewo.ota.view.g(applicationContext);
        Window window = gVar.getWindow();
        if (window != null) {
            window.setType(2003);
        }
        gVar.setTitle(R.string.system_update_check_result_title);
        gVar.q(i2);
        gVar.t(R.string.password_setting_ok, new e());
        this.g0 = gVar;
        if (gVar != null) {
            gVar.show();
        }
    }

    private final void t2() {
        Log.d("UpdateInfoSettings3", "showLoadingDialog: ");
        E1();
        Context applicationContext = i1().getApplicationContext();
        f.z.d.k.d(applicationContext, "requireActivity().applicationContext");
        com.seewo.ota.view.g gVar = new com.seewo.ota.view.g(applicationContext);
        Window window = gVar.getWindow();
        if (window != null) {
            window.setType(2003);
        }
        gVar.setTitle(R.string.system_update_check_result_title);
        gVar.p();
        gVar.s(R.string.button_cancel, new f());
        this.g0 = gVar;
        if (gVar != null) {
            gVar.show();
        }
    }

    @Override // androidx.fragment.app.Fragment
    public void e0(int i2, int i3, Intent intent) {
        if (i2 == 10002 && i3 == -1) {
            f.z.d.k.c(intent);
            Uri data = intent.getData();
            Log.d("UpdateInfoSettings3", "onActivityResult:" + data);
            if (data != null) {
                String path = data.getPath();
                com.seewo.ota.activity.n2.b bVarG1 = G1();
                f.z.d.k.d(path, "path");
                bVarG1.M(path);
            }
        }
    }

    @Override // g.a.h0
    public f.w.g getCoroutineContext() {
        return this.d0.getCoroutineContext();
    }

    @Override // androidx.fragment.app.Fragment
    public View n0(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        f.z.d.k.e(layoutInflater, "inflater");
        super.n0(layoutInflater, viewGroup, bundle);
        p2();
        com.seewo.ota.l.c cVarC = com.seewo.ota.l.c.c(layoutInflater, viewGroup, false);
        f.z.d.k.d(cVarC, "inflate(inflater, container, false)");
        this.e0 = cVarC;
        Z1();
        com.seewo.ota.l.c cVar = this.e0;
        if (cVar == null) {
            f.z.d.k.p("binding");
            throw null;
        }
        NestedScrollView nestedScrollViewB = cVar.b();
        f.z.d.k.d(nestedScrollViewB, "binding.root");
        return nestedScrollViewB;
    }
}
