Improve: Ask for root only when clicked(Closes #82)

This commit is contained in:
LooKeR 2021-10-27 16:43:51 +05:30
parent a6cd0f1ff4
commit b10fd0725e

View File

@ -185,9 +185,13 @@ class SettingsFragment : ScreenFragment() {
preferences[Preferences.Key.ProxyHost]?.setEnabled(enabled)
preferences[Preferences.Key.ProxyPort]?.setEnabled(enabled)
}
preferences[Preferences.Key.RootPermission]?.setEnabled(
Shell.getCachedShell()?.isRoot ?: Shell.getShell().isRoot
)
if (key != null && !(Shell.getCachedShell()?.isRoot ?: Shell.getShell().isRoot)
) {
Preferences[Preferences.Key.RootPermission] = false
preferences[Preferences.Key.RootPermission]?.setEnabled(false)
} else if (Shell.getCachedShell()?.isRoot ?: Shell.getShell().isRoot) {
preferences[Preferences.Key.RootPermission]?.setEnabled(true)
}
if (key == Preferences.Key.Theme) {
requireActivity().recreate()
}