翰林优商.apk(点击下载) / p.java


package com.tb.tb_lib.l;

import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import com.baidu.idl.face.platform.FaceEnvironment;
import java.lang.reflect.InvocationTargetException;

public class p {
    public static float a(Activity activity) {
        c(activity);
        float a = (float) a((Context) activity);
        if (b(activity)) {
            a -= c((Context) activity);
        }
        return (float) a(activity, a);
    }

    public static int a(Context context) {
        Display defaultDisplay = ((WindowManager) context.getSystemService("window")).getDefaultDisplay();
        DisplayMetrics displayMetrics = new DisplayMetrics();
        if (Build.VERSION.SDK_INT >= 17) {
            defaultDisplay.getRealMetrics(displayMetrics);
        } else {
            defaultDisplay.getMetrics(displayMetrics);
        }
        return displayMetrics.heightPixels;
    }

    public static int a(Context context, float f) {
        float f2 = context.getResources().getDisplayMetrics().density;
        if (f2 <= 0.0f) {
            f2 = 1.0f;
        }
        return (int) ((f / f2) + 0.5f);
    }

    public static int a(String str, Activity activity) {
        if (!a()) {
            return 0;
        }
        try {
            Class<?> loadClass = activity.getClassLoader().loadClass("android.os.SystemProperties");
            return ((Integer) loadClass.getMethod("getInt", String.class, Integer.TYPE).invoke(loadClass, new String(str), new Integer(0))).intValue();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            return 0;
        } catch (NoSuchMethodException e2) {
            e2.printStackTrace();
            return 0;
        } catch (IllegalAccessException e3) {
            e3.printStackTrace();
            return 0;
        } catch (IllegalArgumentException e4) {
            e4.printStackTrace();
            return 0;
        } catch (InvocationTargetException e5) {
            e5.printStackTrace();
            return 0;
        }
    }

    public static boolean a() {
        try {
            return Class.forName("miui.os.Build") != null;
        } catch (Exception unused) {
            return false;
        }
    }

    public static float b(Context context) {
        float f = context.getResources().getDisplayMetrics().density;
        float f2 = (float) context.getResources().getDisplayMetrics().widthPixels;
        if (f <= 0.0f) {
            f = 1.0f;
        }
        return (f2 / f) + 0.5f;
    }

    public static boolean b(Activity activity) {
        return a("ro.miui.notch", activity) == 1 || d(activity) || e(activity) || f(activity) || d(activity);
    }

    public static float c(Context context) {
        int identifier = context.getApplicationContext().getResources().getIdentifier("status_bar_height", "dimen", FaceEnvironment.OS);
        if (identifier > 0) {
            return (float) context.getApplicationContext().getResources().getDimensionPixelSize(identifier);
        }
        return 0.0f;
    }

    public static void c(Activity activity) {
        if (activity != null) {
            try {
                if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) {
                    activity.getWindow().getDecorView().setSystemUiVisibility(8);
                } else if (Build.VERSION.SDK_INT >= 19) {
                    activity.getWindow().getDecorView().setSystemUiVisibility(3842);
                    activity.getWindow().addFlags(134217728);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public static boolean d(Activity activity) {
        if (Build.VERSION.SDK_INT < 28) {
            return false;
        }
        try {
            Class<?> cls = Class.forName("android.view.WindowInsets");
            return cls.getMethod("getDisplayCutout", new Class[0]).invoke(cls, new Object[0]) != null;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:4:0x0020, code lost:
        return false;
     */
    /* JADX WARNING: Removed duplicated region for block: B:5:? A[ExcHandler: ClassNotFoundException | Exception | NoSuchMethodException (unused java.lang.Throwable), SYNTHETIC, Splitter:B:1:0x000d] */
    public static boolean d(Context context) {
        Class<?> loadClass = context.getClassLoader().loadClass("com.huawei.android.util.HwNotchSizeUtil");
        try {
            return ((Boolean) loadClass.getMethod("hasNotchInScreen", new Class[0]).invoke(loadClass, new Object[0])).booleanValue();
        } catch (ClassNotFoundException | Exception | NoSuchMethodException unused) {
        }
    }

    public static boolean e(Context context) {
        return context.getPackageManager().hasSystemFeature("com.oppo.feature.screen.heteromorphism");
    }

    /* JADX WARNING: Code restructure failed: missing block: B:4:0x002d, code lost:
        return false;
     */
    /* JADX WARNING: Removed duplicated region for block: B:5:? A[ExcHandler: ClassNotFoundException | Exception | NoSuchMethodException (unused java.lang.Throwable), SYNTHETIC, Splitter:B:1:0x000e] */
    public static boolean f(Context context) {
        Class<?> loadClass = context.getClassLoader().loadClass("android.util.FtFeature");
        try {
            return ((Boolean) loadClass.getMethod("isFeatureSupport", Integer.TYPE).invoke(loadClass, 32)).booleanValue();
        } catch (ClassNotFoundException | Exception | NoSuchMethodException unused) {
        }
    }
}