Move dock settings to home screen settings
This commit is contained in:
parent
01ea2a2862
commit
8193324b39
@ -285,7 +285,6 @@ fun ConfigureClockWidgetSheet(
|
|||||||
val style by viewModel.clockStyle.collectAsState()
|
val style by viewModel.clockStyle.collectAsState()
|
||||||
val fillHeight by viewModel.fillHeight.collectAsState()
|
val fillHeight by viewModel.fillHeight.collectAsState()
|
||||||
val alignment by viewModel.alignment.collectAsState()
|
val alignment by viewModel.alignment.collectAsState()
|
||||||
val dock by viewModel.dock.collectAsState()
|
|
||||||
val parts by viewModel.parts.collectAsState()
|
val parts by viewModel.parts.collectAsState()
|
||||||
|
|
||||||
BottomSheetDialog(onDismissRequest = onDismiss) {
|
BottomSheetDialog(onDismissRequest = onDismiss) {
|
||||||
@ -469,23 +468,6 @@ fun ConfigureClockWidgetSheet(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutlinedCard(
|
|
||||||
modifier = Modifier.padding(top = 16.dp),
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
) {
|
|
||||||
SwitchPreference(
|
|
||||||
title = stringResource(R.string.preference_clockwidget_favorites_part),
|
|
||||||
summary = stringResource(R.string.preference_clockwidget_favorites_part_summary),
|
|
||||||
icon = Icons.Rounded.Star,
|
|
||||||
value = dock == true,
|
|
||||||
onValueChanged = {
|
|
||||||
viewModel.setFavoritesPart(it)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.padding(top = 16.dp, bottom = 8.dp),
|
modifier = Modifier.padding(top = 16.dp, bottom = 8.dp),
|
||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
|
|||||||
@ -40,9 +40,6 @@ class ClockWidgetSettingsScreenVM : ViewModel(), KoinComponent {
|
|||||||
settings.setFillHeight(fillHeight)
|
settings.setFillHeight(fillHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
val dock = settings.dock
|
|
||||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
|
||||||
|
|
||||||
val parts = settings.parts
|
val parts = settings.parts
|
||||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||||
|
|
||||||
@ -50,10 +47,6 @@ class ClockWidgetSettingsScreenVM : ViewModel(), KoinComponent {
|
|||||||
settings.setDatePart(datePart)
|
settings.setDatePart(datePart)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setFavoritesPart(favoritesPart: Boolean) {
|
|
||||||
settings.setDock(favoritesPart)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setBatteryPart(batteryPart: Boolean) {
|
fun setBatteryPart(batteryPart: Boolean) {
|
||||||
settings.setBatteryPart(batteryPart)
|
settings.setBatteryPart(batteryPart)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,7 @@ fun HomescreenSettingsScreen() {
|
|||||||
|
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
val dock by viewModel.dock.collectAsStateWithLifecycle(null)
|
||||||
val fixedRotation by viewModel.fixedRotation.collectAsStateWithLifecycle(null)
|
val fixedRotation by viewModel.fixedRotation.collectAsStateWithLifecycle(null)
|
||||||
val editButton by viewModel.widgetEditButton.collectAsStateWithLifecycle(null)
|
val editButton by viewModel.widgetEditButton.collectAsStateWithLifecycle(null)
|
||||||
val searchBarStyle by viewModel.searchBarStyle.collectAsStateWithLifecycle(null)
|
val searchBarStyle by viewModel.searchBarStyle.collectAsStateWithLifecycle(null)
|
||||||
@ -81,6 +82,18 @@ fun HomescreenSettingsScreen() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
item {
|
||||||
|
PreferenceCategory(stringResource(R.string.preference_clockwidget_favorites_part)) {
|
||||||
|
SwitchPreference(
|
||||||
|
title = stringResource(R.string.preference_clockwidget_favorites_part),
|
||||||
|
summary = stringResource(R.string.preference_clockwidget_favorites_part_summary),
|
||||||
|
value = dock == true,
|
||||||
|
onValueChanged = {
|
||||||
|
viewModel.setDock(it)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
item {
|
item {
|
||||||
PreferenceCategory(
|
PreferenceCategory(
|
||||||
title = stringResource(id = R.string.preference_category_widgets)
|
title = stringResource(id = R.string.preference_category_widgets)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import de.mm20.launcher2.preferences.ScreenOrientation
|
|||||||
import de.mm20.launcher2.preferences.SearchBarColors
|
import de.mm20.launcher2.preferences.SearchBarColors
|
||||||
import de.mm20.launcher2.preferences.SearchBarStyle
|
import de.mm20.launcher2.preferences.SearchBarStyle
|
||||||
import de.mm20.launcher2.preferences.SystemBarColors
|
import de.mm20.launcher2.preferences.SystemBarColors
|
||||||
|
import de.mm20.launcher2.preferences.ui.ClockWidgetSettings
|
||||||
import de.mm20.launcher2.preferences.ui.UiSettings
|
import de.mm20.launcher2.preferences.ui.UiSettings
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
@ -28,6 +29,7 @@ import org.koin.core.component.get
|
|||||||
|
|
||||||
class HomescreenSettingsScreenVM(
|
class HomescreenSettingsScreenVM(
|
||||||
private val uiSettings: UiSettings,
|
private val uiSettings: UiSettings,
|
||||||
|
private val clockWidgetSettings: ClockWidgetSettings,
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
var showClockWidgetSheet by mutableStateOf(false)
|
var showClockWidgetSheet by mutableStateOf(false)
|
||||||
@ -119,6 +121,13 @@ class HomescreenSettingsScreenVM(
|
|||||||
uiSettings.setBottomSearchBar(bottomSearchBar)
|
uiSettings.setBottomSearchBar(bottomSearchBar)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val dock = clockWidgetSettings.dock
|
||||||
|
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||||
|
|
||||||
|
fun setDock(dock: Boolean) {
|
||||||
|
clockWidgetSettings.setDock(dock)
|
||||||
|
}
|
||||||
|
|
||||||
val fixedRotation = uiSettings.orientation.map { it != ScreenOrientation.Auto }
|
val fixedRotation = uiSettings.orientation.map { it != ScreenOrientation.Auto }
|
||||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||||
|
|
||||||
@ -144,7 +153,8 @@ class HomescreenSettingsScreenVM(
|
|||||||
val Factory = viewModelFactory {
|
val Factory = viewModelFactory {
|
||||||
initializer {
|
initializer {
|
||||||
HomescreenSettingsScreenVM(
|
HomescreenSettingsScreenVM(
|
||||||
uiSettings = get()
|
uiSettings = get(),
|
||||||
|
clockWidgetSettings = get(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user