Fixed checkboxes on homescreen not writing values to static fields
This commit is contained in:
parent
cbe64fd559
commit
e426090a18
@ -1,6 +1,7 @@
|
|||||||
package com.topjohnwu.magisk.ui.home
|
package com.topjohnwu.magisk.ui.home
|
||||||
|
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
|
import com.skoumal.teanity.extensions.addOnPropertyChangedCallback
|
||||||
import com.skoumal.teanity.util.KObservableField
|
import com.skoumal.teanity.util.KObservableField
|
||||||
import com.topjohnwu.magisk.*
|
import com.topjohnwu.magisk.*
|
||||||
import com.topjohnwu.magisk.model.events.*
|
import com.topjohnwu.magisk.model.events.*
|
||||||
@ -24,11 +25,6 @@ class HomeViewModel(
|
|||||||
val isForceEncryption = KObservableField(Config.keepEnc)
|
val isForceEncryption = KObservableField(Config.keepEnc)
|
||||||
val isKeepVerity = KObservableField(Config.keepVerity)
|
val isKeepVerity = KObservableField(Config.keepVerity)
|
||||||
|
|
||||||
private val prefsObserver = Observer(isForceEncryption, isKeepVerity) {
|
|
||||||
Config.keepEnc = isForceEncryption.value
|
|
||||||
Config.keepVerity = isKeepVerity.value
|
|
||||||
}
|
|
||||||
|
|
||||||
val magiskState = KObservableField(MagiskState.LOADING)
|
val magiskState = KObservableField(MagiskState.LOADING)
|
||||||
val magiskStateText = Observer(magiskState) {
|
val magiskStateText = Observer(magiskState) {
|
||||||
when (magiskState.value) {
|
when (magiskState.value) {
|
||||||
@ -90,6 +86,14 @@ class HomeViewModel(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
Event.register(this)
|
Event.register(this)
|
||||||
|
|
||||||
|
isForceEncryption.addOnPropertyChangedCallback {
|
||||||
|
Config.keepEnc = it ?: return@addOnPropertyChangedCallback
|
||||||
|
}
|
||||||
|
isKeepVerity.addOnPropertyChangedCallback {
|
||||||
|
Config.keepVerity = it ?: return@addOnPropertyChangedCallback
|
||||||
|
}
|
||||||
|
|
||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user