Apply spotless

pull/1718/head
Andrea Severi 9 months ago
parent 0f89417af2
commit 6ffbe18bc5
No known key found for this signature in database
GPG Key ID: BF5DFA9B836FBEC3

@ -105,7 +105,7 @@ class MainActivity : ComponentActivity() {
darkTheme = uiState.shouldUseDarkTheme(systemDark),
androidTheme = uiState.shouldUseAndroidTheme,
disableDynamicTheming = uiState.shouldDisableDynamicTheming,
shouldFollowSystemTheme = uiState.shouldFollowSystemTheme
shouldFollowSystemTheme = uiState.shouldFollowSystemTheme,
)
}
.onEach { themeSettings = it }
@ -130,7 +130,7 @@ class MainActivity : ComponentActivity() {
)
setAppTheme(
uiModeManager = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager,
themeSettings = themeSettings
themeSettings = themeSettings,
)
}
}
@ -182,28 +182,26 @@ class MainActivity : ComponentActivity() {
*/
private fun setAppTheme(
uiModeManager: UiModeManager,
themeSettings: ThemeSettings
themeSettings: ThemeSettings,
) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
uiModeManager.setApplicationNightMode(
if (themeSettings.shouldFollowSystemTheme) {
val mode = if (themeSettings.shouldFollowSystemTheme) {
UiModeManager.MODE_NIGHT_AUTO
} else if (themeSettings.darkTheme) {
UiModeManager.MODE_NIGHT_YES
} else {
UiModeManager.MODE_NIGHT_NO
}
)
uiModeManager.setApplicationNightMode(mode)
} else {
AppCompatDelegate.setDefaultNightMode(
if (themeSettings.shouldFollowSystemTheme) {
val mode = if (themeSettings.shouldFollowSystemTheme) {
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
} else if (themeSettings.darkTheme) {
AppCompatDelegate.MODE_NIGHT_YES
} else {
AppCompatDelegate.MODE_NIGHT_NO
}
)
AppCompatDelegate.setDefaultNightMode(mode)
}
}

Loading…
Cancel
Save