package com.sjm.sjmsdk.c; import android.app.Activity; import android.content.Context; import android.os.Build; import android.text.TextUtils; 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 e { public static float a(Activity activity) { b(activity); float b = (float) b((Context) activity); if (c(activity)) { b -= c((Context) activity); } return (float) a(activity, b); } public static float a(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 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 String a(String str) { String str2; if (TextUtils.isEmpty(str)) { return ""; } String str3 = "KLLK"; if (str.contains(str3)) { str2 = "OPPO"; } else { str3 = "kllk"; if (!str.contains(str3)) { return ""; } str2 = "oppo"; } return str.replace(str3, str2); } public static boolean a() { try { return Class.forName("miui.os.Build") != null; } catch (Exception unused) { return false; } } public static int b(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 void b(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 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 boolean c(Activity activity) { return d(activity) || a("ro.miui.notch", activity) == 1 || d(activity) || f(activity) || e(activity); } 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; } } public static boolean d(Context context) { try { Class<?> loadClass = context.getClassLoader().loadClass("com.huawei.android.util.HwNotchSizeUtil"); return ((Boolean) loadClass.getMethod("hasNotchInScreen", new Class[0]).invoke(loadClass, new Object[0])).booleanValue(); } catch (ClassNotFoundException | Exception | NoSuchMethodException unused) { return false; } } public static boolean e(Context context) { try { Class<?> loadClass = context.getClassLoader().loadClass("android.util.FtFeature"); return ((Boolean) loadClass.getMethod("isFeatureSupport", Integer.TYPE).invoke(loadClass, 32)).booleanValue(); } catch (ClassNotFoundException | Exception | NoSuchMethodException unused) { return false; } } public static boolean f(Context context) { return context.getPackageManager().hasSystemFeature(a("com.kllk.feature.screen.heteromorphism")); } public static int g(Context context) { return context.getApplicationContext().getResources().getDisplayMetrics().widthPixels; } public static int h(Context context) { return context.getApplicationContext().getResources().getDisplayMetrics().heightPixels; } public static int i(Context context) { return (int) (((float) h(context)) + c(context)); } }