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