From 2edac3138c6feaf8479a00c89a3dc178ee8f1cf3 Mon Sep 17 00:00:00 2001 From: cmclark00 Date: Tue, 1 Apr 2025 15:41:26 -0400 Subject: [PATCH] Feat: Instantly update customization menu theme on selection --- .../java/com/pixelmintdrop/MainActivity.kt | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/pixelmintdrop/MainActivity.kt b/app/src/main/java/com/pixelmintdrop/MainActivity.kt index e353ce2..e837a91 100644 --- a/app/src/main/java/com/pixelmintdrop/MainActivity.kt +++ b/app/src/main/java/com/pixelmintdrop/MainActivity.kt @@ -308,16 +308,25 @@ class MainActivity : AppCompatActivity(), // Set up theme selector themeSelector.onThemeSelected = { themeId: String -> - // Apply the new theme + // Apply the new theme globally applyTheme(themeId) // Provide haptic feedback as a cue that the theme changed gameHaptics.vibrateForPieceLock() + + // --- Re-apply theme to the currently visible Customization Menu --- + val themeColor = getThemeColor(themeId) + val backgroundColor = getThemeBackgroundColor(themeId) - // Refresh the pause menu to immediately show theme changes - if (binding.pauseContainer.visibility == View.VISIBLE) { - showPauseMenu() - } + binding.customizationContainer.setBackgroundColor(backgroundColor) + binding.customizationLevelBadge.setThemeColor(themeColor) + applyThemeColorToTextViews(binding.customizationContainer, themeColor) + // ------------------------------------------------------------------ + + // // Refreshing pause menu here is not needed for instant update of customization menu + // if (binding.pauseContainer.visibility == View.VISIBLE) { + // showPauseMenu() + // } } // Set up title screen @@ -719,6 +728,8 @@ class MainActivity : AppCompatActivity(), private fun hideCustomizationMenu() { binding.customizationContainer.visibility = View.GONE binding.pauseContainer.visibility = View.VISIBLE + // Refresh the pause menu to apply theme changes + showPauseMenu() } /**