APKPure.apk(点击下载) / h.java


package e.g.a.e.h;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.provider.Settings;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AlertController;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.apkpure.aegon.R;
import com.apkpure.aegon.app.newcard.model.AppCardData;
import com.apkpure.aegon.application.RealApplicationLike;
import e.g.a.i0.d2.b;
import e.g.a.i0.p1;
import e.g.a.i0.t;
import e.g.a.t.d.l;
import e.g.a.z.d;
import i.b.c.h;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import s.e.a;
import s.e.c;

public class h {

    /* renamed from: a  reason: collision with root package name */
    public static final a f5457a = new c("MIUIOptNoticeShowHelperLog");

    public static boolean a(FragmentManager fragmentManager) {
        Fragment I = fragmentManager.I("MIUIOptNoticeDialogTag");
        return I != null && I.isVisible() && (I instanceof e);
    }

    public static void b(FragmentManager fragmentManager) {
        Fragment I = fragmentManager.I("MIUIOptNoticeDialogTag");
        if (a(fragmentManager)) {
            try {
                ((e) I).dismissAllowingStateLoss();
            } catch (Exception e2) {
                ((c) f5457a).f("miui Dialog Dismiss Exception", e2);
            }
        }
    }

    public static SharedPreferences c() {
        Application application = RealApplicationLike.getApplication();
        if (application != null) {
            return application.getSharedPreferences("miui_opt", 0);
        }
        i.i.g.c.d0(((c) f5457a).f16991a, "miui opt get sp context is null");
        return null;
    }

    /* JADX WARNING: Removed duplicated region for block: B:17:0x0060  */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x006a A[RETURN] */
    public static boolean d(boolean z) {
        boolean z2;
        a aVar = f5457a;
        if (!z) {
            i.i.g.c.d0(((c) aVar).f16991a, "Don't need show, is not apks");
            return false;
        } else if (!b.b()) {
            i.i.g.c.d0(((c) aVar).f16991a, "Don't need show, is not miui");
            return false;
        } else {
            if (b.b()) {
                try {
                    z2 = ((Boolean) Class.forName("android.os.SystemProperties").getDeclaredMethod("getBoolean", String.class, Boolean.TYPE).invoke(null, "persist.sys.miui_optimization", Boolean.FALSE)).booleanValue();
                } catch (Exception e2) {
                    ((c) b.f6499a).f("Unable to use SystemProperties.getBoolean", e2);
                }
                if (!z2) {
                    return true;
                }
                i.i.g.c.d0(((c) aVar).f16991a, "Don't need show, is not open miui opt");
                return false;
            }
            z2 = false;
            if (!z2) {
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:15:0x0077  */
    /* JADX WARNING: Removed duplicated region for block: B:18:0x0097  */
    public static void e(Context context, String str, t tVar, t tVar2) {
        int i2;
        TextView textView;
        if (str == null) {
            str = "";
        }
        HashMap hashMap = new HashMap();
        if (context instanceof e.g.a.t.b.a) {
            e.g.a.t.b.a aVar = (e.g.a.t.b.a) context;
            hashMap.put(AppCardData.KEY_SCENE, Long.valueOf(aVar.v1()));
            hashMap.put("source_scene", Long.valueOf(aVar.f7122e.sourceScene));
        }
        hashMap.put("pop_type", "xiaomi_miui_help_pop");
        hashMap.put("related_package_name", str);
        i.i.g.c.b(i.i.g.c.A("report map info : {}", hashMap));
        i.b.c.h a2 = new h.a(context).a();
        String string = context.getString(R.string.arg_RES_2131821361);
        String str2 = "Check FAQ page";
        if (!string.contains(str2)) {
            str2 = "查看帮助";
            if (!string.contains(str2)) {
                str2 = "查看幫助";
                if (!string.contains(str2)) {
                    i2 = -1;
                    SpannableString spannableString = new SpannableString(string);
                    if (i2 != -1) {
                        spannableString.setSpan(new g(context, a2, hashMap), i2, string.length(), 33);
                    }
                    a2.setCanceledOnTouchOutside(false);
                    a2.setTitle(R.string.arg_RES_2131821363);
                    AlertController alertController = a2.d;
                    alertController.f30f = spannableString;
                    textView = alertController.F;
                    if (textView != null) {
                        textView.setText(spannableString);
                    }
                    a2.f(-2, context.getString(17039360), new b(tVar2));
                    a2.f(-1, context.getString(R.string.arg_RES_2131821362), new c(tVar));
                    a2.show();
                    g(context, hashMap, a2);
                }
            }
        }
        i2 = string.indexOf(str2);
        SpannableString spannableString2 = new SpannableString(string);
        if (i2 != -1) {
        }
        a2.setCanceledOnTouchOutside(false);
        a2.setTitle(R.string.arg_RES_2131821363);
        AlertController alertController2 = a2.d;
        alertController2.f30f = spannableString2;
        textView = alertController2.F;
        if (textView != null) {
        }
        a2.f(-2, context.getString(17039360), new b(tVar2));
        a2.f(-1, context.getString(R.string.arg_RES_2131821362), new c(tVar));
        try {
            a2.show();
            g(context, hashMap, a2);
        } catch (Exception e2) {
            ((c) f5457a).f("miui opt dialog show error", e2);
        }
    }

    public static void f(Context context) {
        if (context == null) {
            i.i.g.c.d0(((c) f5457a).f16991a, "startCloseMIUIOptGuide context is null");
            return;
        }
        Locale c = d.c();
        if (c != null) {
            i.i.g.c.b(i.i.g.c.A("language name: {}", c.getLanguage()));
        }
        StringBuilder d0 = e.d.a.a.a.d0((c == null || c.getLanguage() == null || !"zh".equals(c.getLanguage())) ? "https://tapi.pureapk.com/" : "https://tapi.pureapk.com/zh/", "help/how-to-disable-miui-optimization?enabled=");
        boolean z = false;
        if (Settings.Secure.getInt(context.getContentResolver(), "development_settings_enabled", 0) != 0) {
            z = true;
        }
        d0.append(z ? "1" : "0");
        String sb = d0.toString();
        i.i.g.c.b(i.i.g.c.A("miui helper page url : {}", sb));
        l.a aVar = new l.a(sb);
        if (context instanceof e.g.a.t.b.a) {
            e.g.a.t.b.a aVar2 = (e.g.a.t.b.a) context;
            aVar2.Y1(new e.g.a.h0.b.o.a());
            aVar.f7145g = aVar2.f7122e;
        }
        l.b(context, aVar, Boolean.FALSE);
    }

    public static void g(Context context, Map<String, Object> map, i.b.c.h hVar) {
        View findViewById = hVar.findViewById(R.id.arg_RES_2131297990);
        if (findViewById == null) {
            i.i.g.c.d0(((c) f.f5456a).f16991a, "MIUIOptNoticeReport reportDialogShow view is null.");
        } else {
            e.g.a.h0.b.h.t(findViewById, "pop", false);
            e.g.a.h0.b.h.o("imp", findViewById, map);
        }
        TextView textView = (TextView) hVar.findViewById(16908310);
        if (textView != null) {
            textView.setTextSize(20.0f);
        }
        TextView textView2 = (TextView) hVar.findViewById(16908299);
        if (textView2 != null) {
            textView2.setMovementMethod(LinkMovementMethod.getInstance());
            textView2.setTextSize(16.0f);
        }
        Button d = hVar.d(-1);
        e.g.a.h0.b.h.s(d, "close_button", map, false);
        Button d2 = hVar.d(-2);
        e.g.a.h0.b.h.s(d2, "cancel_button", map, false);
        d2.setTextColor(p1.i(context, R.attr.arg_RES_2130968870));
        d2.setTextSize(14.0f);
        d.setTextColor(p1.i(context, R.attr.arg_RES_2130968870));
        d.setTextSize(14.0f);
    }
}