Use new clock widget configuration sheet in settings
This commit is contained in:
parent
b518e1713c
commit
3516597d10
@ -36,6 +36,7 @@ import de.mm20.launcher2.ui.component.preferences.PreferenceCategory
|
||||
import de.mm20.launcher2.ui.component.preferences.PreferenceScreen
|
||||
import de.mm20.launcher2.ui.component.preferences.SliderPreference
|
||||
import de.mm20.launcher2.ui.component.preferences.SwitchPreference
|
||||
import de.mm20.launcher2.ui.launcher.widgets.clock.ConfigureClockWidgetSheet
|
||||
import de.mm20.launcher2.ui.locals.LocalNavController
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
@ -85,7 +86,7 @@ fun HomescreenSettingsScreen() {
|
||||
title = stringResource(R.string.preference_screen_clockwidget),
|
||||
summary = stringResource(R.string.preference_screen_clockwidget_summary),
|
||||
onClick = {
|
||||
navController?.navigate("settings/homescreen/clock")
|
||||
viewModel.showClockWidgetSheet = true
|
||||
}
|
||||
)
|
||||
SwitchPreference(
|
||||
@ -244,6 +245,10 @@ fun HomescreenSettingsScreen() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (viewModel.showClockWidgetSheet) {
|
||||
ConfigureClockWidgetSheet(onDismiss = { viewModel.showClockWidgetSheet = false })
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@ -4,6 +4,9 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.WindowManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
@ -23,6 +26,8 @@ class HomescreenSettingsScreenVM(
|
||||
private val dataStore: LauncherDataStore,
|
||||
) : ViewModel() {
|
||||
|
||||
var showClockWidgetSheet by mutableStateOf(false)
|
||||
|
||||
|
||||
val dimWallpaper = dataStore.data.map { it.appearance.dimWallpaper }
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), false)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user