mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2026-10-18 21:42:35 +00:00
add appearance settings screen
This commit is contained in:
committed by
Aayush Gupta
parent
5a1dd5be4a
commit
d45382ba9e
-8
@@ -9,16 +9,10 @@ import androidx.lifecycle.ViewModel
|
||||
import com.russhwolf.settings.Settings
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import net.newpipe.app.platform.AppearanceActions
|
||||
import net.newpipe.app.preferences.AppearancePreferences
|
||||
import org.koin.core.annotation.KoinViewModel
|
||||
|
||||
|
||||
@KoinViewModel
|
||||
class AppearanceSettingsViewModel(
|
||||
private val settings: Settings,
|
||||
private val appearanceActions: AppearanceActions,
|
||||
) : ViewModel() {
|
||||
|
||||
val theme: StateFlow<String>
|
||||
field = MutableStateFlow(
|
||||
@@ -68,13 +62,11 @@ class AppearanceSettingsViewModel(
|
||||
fun setTheme(value: String) {
|
||||
settings.putString(AppearancePreferences.KEY_THEME, value)
|
||||
theme.value = value
|
||||
appearanceActions.applyThemeChange(value)
|
||||
}
|
||||
|
||||
fun setNightTheme(value: String) {
|
||||
settings.putString(AppearancePreferences.KEY_NIGHT_THEME, value)
|
||||
nightTheme.value = value
|
||||
appearanceActions.applyThemeChange(theme.value)
|
||||
}
|
||||
|
||||
fun setHoldToAppend(value: Boolean) {
|
||||
|
||||
Reference in New Issue
Block a user