mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-17 23:45:22 +01:00
Feat: Instantly update customization menu theme on selection
This commit is contained in:
parent
2e2cd92192
commit
2edac3138c
1 changed files with 16 additions and 5 deletions
|
@ -308,16 +308,25 @@ class MainActivity : AppCompatActivity(),
|
||||||
|
|
||||||
// Set up theme selector
|
// Set up theme selector
|
||||||
themeSelector.onThemeSelected = { themeId: String ->
|
themeSelector.onThemeSelected = { themeId: String ->
|
||||||
// Apply the new theme
|
// Apply the new theme globally
|
||||||
applyTheme(themeId)
|
applyTheme(themeId)
|
||||||
|
|
||||||
// Provide haptic feedback as a cue that the theme changed
|
// Provide haptic feedback as a cue that the theme changed
|
||||||
gameHaptics.vibrateForPieceLock()
|
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
|
binding.customizationContainer.setBackgroundColor(backgroundColor)
|
||||||
if (binding.pauseContainer.visibility == View.VISIBLE) {
|
binding.customizationLevelBadge.setThemeColor(themeColor)
|
||||||
showPauseMenu()
|
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
|
// Set up title screen
|
||||||
|
@ -719,6 +728,8 @@ class MainActivity : AppCompatActivity(),
|
||||||
private fun hideCustomizationMenu() {
|
private fun hideCustomizationMenu() {
|
||||||
binding.customizationContainer.visibility = View.GONE
|
binding.customizationContainer.visibility = View.GONE
|
||||||
binding.pauseContainer.visibility = View.VISIBLE
|
binding.pauseContainer.visibility = View.VISIBLE
|
||||||
|
// Refresh the pause menu to apply theme changes
|
||||||
|
showPauseMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue