H07000223 / FlycoSystemBar

A Helper for SystemBar include StatusBar and NavigationBar.
http://app.bilibili.com
MIT License
1.02k stars 109 forks source link

MIUI 9之后,以前的方法无效,统一成原生的方法了 #7

Open ditclear opened 5 years ago

ditclear commented 5 years ago

见文档:https://dev.mi.com/console/doc/detail?pId=1159 代码修改如下


//    /**
////     * 判断是否为MIUI6以上
////     */
////    public static boolean isMIUI6Later() {
////        try {
////            Class<?> clz = Class.forName("android.os.SystemProperties");
////            Method mtd = clz.getMethod("get", String.class);
////            String val = (String) mtd.invoke(null, "ro.miui.ui.version.name");
////            val = val.replaceAll("[vV]", "");
////            int version = Integer.parseInt(val);
////            return version >= 6;
////        } catch (Exception e) {
////            return false;
////        }
////    }

   /**
     * 判断是否为MIUI6以上9以下
     */
    public static boolean isMIUI6LaterAnd9Before() {
        try {
            Class<?> clz = Class.forName("android.os.SystemProperties");
            Method mtd = clz.getMethod("get", String.class);
            String val = (String) mtd.invoke(null, "ro.miui.ui.version.name");
            val = val.replaceAll("[vV]", "");
            int version = Integer.parseInt(val);
            return version >= 6 && version < 9;
        } catch (Exception e) {
            return false;
        }
    }