You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Added theme mode picker dialog
Redesigned settings' selector for dark mode a bit
This commit is contained in:
@@ -4,14 +4,13 @@ import com.topjohnwu.magisk.Config
|
||||
import com.topjohnwu.magisk.extensions.addOnPropertyChangedCallback
|
||||
import com.topjohnwu.magisk.extensions.toggle
|
||||
import com.topjohnwu.magisk.model.events.DieEvent
|
||||
import com.topjohnwu.magisk.model.events.RecreateEvent
|
||||
import com.topjohnwu.magisk.model.events.dialog.DarkThemeDialog
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||
import com.topjohnwu.magisk.utils.KObservableField
|
||||
|
||||
class SettingsViewModel : CompatViewModel() {
|
||||
|
||||
val redesign = KObservableField(Config.redesign)
|
||||
val darkTheme = KObservableField(Config.darkTheme)
|
||||
|
||||
init {
|
||||
//todo make observable preference
|
||||
@@ -19,12 +18,9 @@ class SettingsViewModel : CompatViewModel() {
|
||||
Config.redesign = redesign.value
|
||||
DieEvent().publish()
|
||||
}
|
||||
darkTheme.addOnPropertyChangedCallback {
|
||||
Config.darkTheme = darkTheme.value
|
||||
RecreateEvent().publish()
|
||||
}
|
||||
}
|
||||
|
||||
fun toggle(item: KObservableField<Boolean>) = item.toggle()
|
||||
fun darkModePressed() = DarkThemeDialog().publish()
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user