From 106be9169e21d163837b13220904bd23887a8a50 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 20 May 2022 16:37:44 +0200 Subject: [PATCH] allow hiding the Shared Theme button with a boolean --- .../commons/activities/CustomizationActivity.kt | 14 +++++++++++--- commons/src/main/res/values/bools.xml | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/CustomizationActivity.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/CustomizationActivity.kt index ea3765111..90c7b8b36 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/CustomizationActivity.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/CustomizationActivity.kt @@ -73,7 +73,11 @@ class CustomizationActivity : BaseSimpleActivity() { runOnUiThread { setupThemes() val hideGoogleRelations = resources.getBoolean(R.bool.hide_google_relations) - apply_to_all_holder.beVisibleIf(storedSharedTheme == null && curSelectedThemeId != THEME_AUTO && curSelectedThemeId != THEME_SYSTEM && !hideGoogleRelations) + val hideSharedThemeButton = resources.getBoolean(R.bool.hide_shared_theme_button) + apply_to_all_holder.beVisibleIf( + storedSharedTheme == null && curSelectedThemeId != THEME_AUTO && curSelectedThemeId != THEME_SYSTEM + && !hideGoogleRelations && !hideSharedThemeButton + ) } } catch (e: Exception) { toast(R.string.update_thank_you) @@ -94,7 +98,7 @@ class CustomizationActivity : BaseSimpleActivity() { updateLabelColors(textColor) originalAppIconColor = baseConfig.appIconColor - if (resources.getBoolean(R.bool.hide_google_relations)) { + if (resources.getBoolean(R.bool.hide_google_relations) || resources.getBoolean(R.bool.hide_shared_theme_button)) { apply_to_all_holder.beGone() } } @@ -222,7 +226,11 @@ class CustomizationActivity : BaseSimpleActivity() { } val hideGoogleRelations = resources.getBoolean(R.bool.hide_google_relations) - apply_to_all_holder.beVisibleIf(curSelectedThemeId != THEME_AUTO && curSelectedThemeId != THEME_SYSTEM && curSelectedThemeId != THEME_SHARED && !hideGoogleRelations) + val hideSharedThemeButton = resources.getBoolean(R.bool.hide_shared_theme_button) + apply_to_all_holder.beVisibleIf( + curSelectedThemeId != THEME_AUTO && curSelectedThemeId != THEME_SYSTEM && curSelectedThemeId != THEME_SHARED + && !hideGoogleRelations && !hideSharedThemeButton + ) updateMenuItemColors(menu, true, getCurrentStatusBarColor()) } } diff --git a/commons/src/main/res/values/bools.xml b/commons/src/main/res/values/bools.xml index 6f3bf1148..ca3dfc9fc 100644 --- a/commons/src/main/res/values/bools.xml +++ b/commons/src/main/res/values/bools.xml @@ -6,4 +6,5 @@ false false false + false