@@ -53,6 +53,9 @@ class LauncherScaffoldVM : ViewModel(), KoinComponent {
|
||||
val navBarColor = dataStore.data.map { it.systemBars.statusBarColor }
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||
|
||||
val chargingAnimation = dataStore.data.map { it.animations.charging }
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||
|
||||
val hideNavBar = dataStore.data.map { it.systemBars.hideNavBar }
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), false)
|
||||
val hideStatusBar = dataStore.data.map { it.systemBars.hideStatusBar }
|
||||
|
||||
@@ -105,6 +105,8 @@ abstract class SharedLauncherActivity(
|
||||
val statusBarColor by viewModel.statusBarColor.collectAsState()
|
||||
val navBarColor by viewModel.navBarColor.collectAsState()
|
||||
|
||||
val chargingAnimation by viewModel.chargingAnimation.collectAsState()
|
||||
|
||||
val lightStatus =
|
||||
!dimBackground && (statusBarColor == SystemBarColors.Dark || statusBarColor == SystemBarColors.Auto && wallpaperColors.supportsDarkText)
|
||||
val lightNav =
|
||||
@@ -164,7 +166,9 @@ abstract class SharedLauncherActivity(
|
||||
.background(if (dimBackground) Color.Black.copy(alpha = 0.30f) else Color.Transparent),
|
||||
contentAlignment = Alignment.BottomCenter
|
||||
) {
|
||||
NavBarEffects(modifier = Modifier.fillMaxSize())
|
||||
if (chargingAnimation == true) {
|
||||
NavBarEffects(modifier = Modifier.fillMaxSize())
|
||||
}
|
||||
if (mode == LauncherActivityMode.Assistant) {
|
||||
key(bottomSearchBar, reverseSearchResults) {
|
||||
AssistantScaffold(
|
||||
|
||||
+13
@@ -60,6 +60,7 @@ fun HomescreenSettingsScreen() {
|
||||
val lightNavBar by viewModel.navBarIcons.collectAsStateWithLifecycle(null)
|
||||
val hideStatusBar by viewModel.hideStatusBar.collectAsStateWithLifecycle(null)
|
||||
val hideNavBar by viewModel.hideNavBar.collectAsStateWithLifecycle(null)
|
||||
val chargingAnimation by viewModel.chargingAnimation.collectAsStateWithLifecycle(null)
|
||||
|
||||
PreferenceScreen(title = stringResource(id = R.string.preference_screen_homescreen)) {
|
||||
item {
|
||||
@@ -173,6 +174,18 @@ fun HomescreenSettingsScreen() {
|
||||
)
|
||||
}
|
||||
}
|
||||
item {
|
||||
PreferenceCategory(stringResource(R.string.preference_category_animations)) {
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.preference_charging_animation),
|
||||
summary = stringResource(R.string.preference_charging_animation_summary),
|
||||
value = chargingAnimation == true,
|
||||
onValueChanged = {
|
||||
viewModel.setChargingAnimation(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item {
|
||||
|
||||
PreferenceCategory(stringResource(R.string.preference_category_system_bars)) {
|
||||
|
||||
+15
@@ -202,6 +202,21 @@ class HomescreenSettingsScreenVM(
|
||||
}
|
||||
}
|
||||
|
||||
val chargingAnimation = dataStore.data.map { it.animations.charging }
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||
|
||||
fun setChargingAnimation(chargingAnimation: Boolean) {
|
||||
viewModelScope.launch {
|
||||
dataStore.updateData {
|
||||
it.toBuilder()
|
||||
.setAnimations(
|
||||
it.animations.toBuilder()
|
||||
.setCharging(chargingAnimation)
|
||||
)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object : KoinComponent {
|
||||
val Factory = viewModelFactory {
|
||||
|
||||
Reference in New Issue
Block a user