Drawer rearrangement

This commit is contained in:
topjohnwu 2017-11-17 12:36:19 +08:00
parent 4635883dec
commit 1a32aaea6f
3 changed files with 21 additions and 24 deletions

View File

@ -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 {

View File

@ -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":

View File

@ -15,6 +15,10 @@
android:icon="@drawable/ic_superuser"
android:title="@string/superuser"
android:visible="false"/>
<item
android:id="@+id/magiskhide"
android:icon="@drawable/ic_autoroot"
android:title="@string/magiskhide" />
</group>
@ -32,32 +36,28 @@
android:icon="@drawable/ic_cloud_download"
android:title="@string/downloads"/>
<item
android:id="@+id/magiskhide"
android:icon="@drawable/ic_autoroot"
android:title="@string/magiskhide"/>
</group>
<group
android:checkableBehavior="single"
android:id="@+id/third_group">
<item
android:id="@+id/log"
android:icon="@drawable/ic_bug_report"
android:title="@string/log"/>
</group>
<group
android:checkableBehavior="none"
android:id="@+id/third_group">
android:title="@string/log" />
<item
android:checkable="false"
android:id="@+id/settings"
android:icon="@drawable/ic_settings"
android:title="@string/settings"/>
<item
android:checkable="false"
android:id="@+id/app_about"
android:icon="@drawable/ic_info_outline"
android:title="@string/about"/>
</group>
</menu>
</menu>