From 1a32aaea6f5a632e656666bfba3d66215ccb0802 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 17 Nov 2017 12:36:19 +0800 Subject: [PATCH] Drawer rearrangement --- .../com/topjohnwu/magisk/MagiskManager.java | 9 ++----- .../com/topjohnwu/magisk/MainActivity.java | 10 ++++--- app/src/main/res/menu/drawer.xml | 26 +++++++++---------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java b/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java index 588875e84..d0ae1fcdc 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java +++ b/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java @@ -49,7 +49,6 @@ public class MagiskManager extends Application { public int remoteManagerVersionCode = -1; public String managerLink; public String bootBlock = null; - public boolean disabled; public int snet_version; public int updateServiceVersion; @@ -65,6 +64,7 @@ public class MagiskManager extends Application { public boolean isDarkTheme; public boolean updateNotification; public boolean suReauth; + public boolean coreOnly; public int suRequestTimeout; public int suLogTimeout = 14; public int suAccessState; @@ -146,6 +146,7 @@ public class MagiskManager extends Application { multiuserMode = suDB.getSettings(Const.Key.SU_MULTIUSER_MODE, Const.Value.MULTIUSER_MODE_OWNER_ONLY); suNamespaceMode = suDB.getSettings(Const.Key.SU_MNT_NS, Const.Value.NAMESPACE_MODE_REQUESTER); + coreOnly = prefs.getBoolean(Const.Key.DISABLE, false); updateNotification = prefs.getBoolean(Const.Key.UPDATE_NOTIFICATION, true); updateChannel = Utils.getPrefsInt(prefs, Const.Key.UPDATE_CHANNEL, Const.Value.STABLE_CHANNEL); bootFormat = prefs.getString(Const.Key.BOOT_FORMAT, ".img"); @@ -179,12 +180,6 @@ public class MagiskManager extends Application { magiskVersionCode = Integer.parseInt(ret.get(0)); } catch (NumberFormatException ignored) {} } - ret = Shell.sh("getprop " + Const.DISABLE_INDICATION_PROP); - try { - disabled = Utils.isValidShellResponse(ret) && Integer.parseInt(ret.get(0)) != 0; - } catch (NumberFormatException e) { - disabled = false; - } if (magiskVersionCode > 1435) { ret = Shell.su("resetprop -p " + Const.MAGISKHIDE_PROP); } else { diff --git a/app/src/main/java/com/topjohnwu/magisk/MainActivity.java b/app/src/main/java/com/topjohnwu/magisk/MainActivity.java index 048ea0957..61f91aa90 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MainActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/MainActivity.java @@ -129,14 +129,16 @@ public class MainActivity extends Activity } public void checkHideSection() { + MagiskManager mm = getMagiskManager(); Menu menu = navigationView.getMenu(); menu.findItem(R.id.magiskhide).setVisible( - Shell.rootAccess() && getMagiskManager().magiskVersionCode >= 1300 + Shell.rootAccess() && mm.magiskVersionCode >= 1300 && prefs.getBoolean(Const.Key.MAGISKHIDE, false)); menu.findItem(R.id.modules).setVisible( - Shell.rootAccess() && getMagiskManager().magiskVersionCode >= 0); + Shell.rootAccess() && mm.magiskVersionCode >= 0); menu.findItem(R.id.downloads).setVisible(Utils.checkNetworkStatus() && - Shell.rootAccess() && getMagiskManager().magiskVersionCode >= 0); + Shell.rootAccess() && mm.magiskVersionCode >= 0); + menu.setGroupVisible(R.id.second_group, !mm.coreOnly); menu.findItem(R.id.log).setVisible(Shell.rootAccess()); menu.findItem(R.id.superuser).setVisible(Shell.rootAccess()); } @@ -157,7 +159,7 @@ public class MainActivity extends Activity case "downloads": itemId = R.id.downloads; break; - case Const.Key.MAGISKHIDE: + case "magiskhide": itemId = R.id.magiskhide; break; case "log": diff --git a/app/src/main/res/menu/drawer.xml b/app/src/main/res/menu/drawer.xml index 98c4ae8e7..847612d5a 100644 --- a/app/src/main/res/menu/drawer.xml +++ b/app/src/main/res/menu/drawer.xml @@ -15,6 +15,10 @@ android:icon="@drawable/ic_superuser" android:title="@string/superuser" android:visible="false"/> + @@ -32,32 +36,28 @@ android:icon="@drawable/ic_cloud_download" android:title="@string/downloads"/> - + + + - - - - - + android:title="@string/log" /> - \ No newline at end of file +