From 16de4674ec89e9574ffe59938fdfbf497023ed71 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 13 Sep 2021 00:33:36 -0700 Subject: [PATCH] Move denylist fragment to settings --- .../com/topjohnwu/magisk/ui/MainActivity.kt | 2 -- .../magisk/ui/settings/SettingsItems.kt | 8 +++++++- .../magisk/ui/settings/SettingsViewModel.kt | 3 ++- app/src/main/res/layout/fragment_deny_md2.xml | 2 +- app/src/main/res/menu/menu_bottom_nav.xml | 6 ------ app/src/main/res/navigation/main.xml | 17 ++++++++--------- app/src/main/res/values/strings.xml | 3 +++ 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt index 274fae8ff..4562bb740 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt @@ -60,7 +60,6 @@ open class MainActivity : BaseUIActivity( R.id.homeFragment, R.id.modulesFragment, R.id.superuserFragment, - R.id.denyFragment, R.id.logFragment -> true else -> false } @@ -182,7 +181,6 @@ open class MainActivity : BaseUIActivity( R.id.modulesFragment -> MainDirections.actionModuleFragment() R.id.superuserFragment -> MainDirections.actionSuperuserFragment() R.id.logFragment -> MainDirections.actionLogFragment() - R.id.denyFragment -> MainDirections.actionDenylistFragment() else -> null } } diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt index 26e43a0ba..614efbacc 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt @@ -253,7 +253,7 @@ object Magisk : BaseSettingsItem.Section() { } object DenyList : BaseSettingsItem.Toggle() { - override val title = R.string.denylist.asText() + override val title = R.string.settings_denylist_title.asText() override val description = R.string.settings_denylist_summary.asText() override var value = Info.env.denyListEnforced set(value) = setV(value, field, { field = it }) { @@ -262,9 +262,15 @@ object DenyList : BaseSettingsItem.Toggle() { if (cb.isSuccess) Info.env.denyListEnforced = it else field = !it } + DenyListConfig.isEnabled = it } } +object DenyListConfig : BaseSettingsItem.Blank() { + override val title = R.string.settings_denylist_config_title.asText() + override val description = R.string.settings_denylist_config_summary.asText() +} + // --- Superuser object Superuser : BaseSettingsItem.Section() { diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt index acde7f228..22ed209a0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt @@ -73,7 +73,7 @@ class SettingsViewModel( SystemlessHosts )) if (Const.Version.isCanary()) { - list.add(DenyList) + list.addAll(listOf(DenyList, DenyListConfig)) } } @@ -105,6 +105,7 @@ class SettingsViewModel( is DownloadPath -> withExternalRW(callback) is Biometrics -> authenticate(callback) is Theme -> SettingsFragmentDirections.actionSettingsFragmentToThemeFragment().navigate() + is DenyListConfig -> SettingsFragmentDirections.actionSettingsFragmentToDenyFragment().navigate() is ClearRepoCache -> clearRepoCache() is SystemlessHosts -> createHosts() is Restore -> HideAPK.restore(view.activity) diff --git a/app/src/main/res/layout/fragment_deny_md2.xml b/app/src/main/res/layout/fragment_deny_md2.xml index d79e240d4..8a28e88ce 100644 --- a/app/src/main/res/layout/fragment_deny_md2.xml +++ b/app/src/main/res/layout/fragment_deny_md2.xml @@ -38,7 +38,7 @@ android:layout_gravity="bottom|end" android:layout_marginStart="@dimen/l1" android:layout_marginEnd="@dimen/l1" - android:layout_marginBottom="72dp" + android:layout_marginBottom="@dimen/l1" app:backgroundTint="?colorSurfaceSurfaceVariant" app:layout_fitsSystemWindowsInsets="bottom" app:srcCompat="@drawable/ic_search_md2" diff --git a/app/src/main/res/menu/menu_bottom_nav.xml b/app/src/main/res/menu/menu_bottom_nav.xml index 4804b7e6c..06d1937f1 100644 --- a/app/src/main/res/menu/menu_bottom_nav.xml +++ b/app/src/main/res/menu/menu_bottom_nav.xml @@ -14,12 +14,6 @@ android:title="@string/superuser" tools:showAsAction="always" /> - - + + - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3d8a567a4..e10433230 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -147,7 +147,10 @@ Beta Custom Channel Insert a custom URL + Enforce DenyList Processes on the denylist will have all Magisk modifications reverted + Configure DenyList + Select the processes to be included on the denylist Systemless hosts Systemless hosts support for Adblock apps Added systemless hosts module