Skip to content

Commit f2ea327

Browse files
Refactor(Settings): Remove redundant theme logic in SettingsFragment
The `SettingsFragment` has been updated to simplify the theme-switching logic. Previously, it contained code to determine the dark mode status and manually apply the theme. This logic is now handled elsewhere, so the redundant `isDark` variable, the `when` statement, and the calls to `setThemeMode` and `reloadLauncher` have been removed. The fragment now only calls `resetThemeColors` when the theme preference is changed, streamlining the settings update process.
1 parent 1726177 commit f2ea327

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

app/src/main/java/com/github/codeworkscreativehub/mlauncher/ui/SettingsFragment.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,6 @@ class SettingsFragment : BaseFragment() {
353353
var toggledLockOrientation by remember { mutableStateOf(prefs.lockOrientation) }
354354
var toggledHapticFeedback by remember { mutableStateOf(prefs.hapticFeedback) }
355355

356-
357-
358356
Column(
359357
modifier = Modifier
360358
.fillMaxSize()
@@ -551,14 +549,7 @@ class SettingsFragment : BaseFragment() {
551549
val newTheme = themeEntries[newThemeIndex]
552550
selectedTheme = newTheme
553551
prefs.appTheme = newTheme
554-
555-
val isDark = when (newTheme) {
556-
Constants.Theme.Light -> false
557-
Constants.Theme.Dark -> true
558-
Constants.Theme.System -> isSystemInDarkMode(requireContext())
559-
}
560-
setThemeMode(requireContext(), isDark, binding.settingsView)
561-
reloadLauncher()
552+
resetThemeColors()
562553
}
563554
}
564555
)

0 commit comments

Comments
 (0)