Fixed magisk button states
This commit is contained in:
parent
17fb8f2298
commit
067cb0cd9d
@ -140,15 +140,12 @@ class HomeViewModel(
|
|||||||
fun onManagerPressed() = ManagerInstallDialog().publish()
|
fun onManagerPressed() = ManagerInstallDialog().publish()
|
||||||
|
|
||||||
fun onMagiskPressed() {
|
fun onMagiskPressed() {
|
||||||
//pre-fix so user doesn't click twice accidentally
|
|
||||||
stateMagiskProgress.value = 1
|
|
||||||
|
|
||||||
withPermissions(
|
withPermissions(
|
||||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||||
).map { check(it);it }.subscribeK(onError = {
|
).map { check(it);it }.subscribeK {
|
||||||
stateManagerProgress.value = 0
|
//pre-fix so user doesn't click twice accidentally
|
||||||
}) {
|
stateMagiskProgress.value = 1
|
||||||
DownloadService(get()) {
|
DownloadService(get()) {
|
||||||
subject = Magisk(Configuration.Download)
|
subject = Magisk(Configuration.Download)
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
style="?styleButtonDefault"
|
style="?styleButtonDefault"
|
||||||
gone="@{viewModel.stateMagisk != MagiskState.OBSOLETE}"
|
gone="@{viewModel.stateMagisk != MagiskState.OBSOLETE}"
|
||||||
isEnabled="@{viewModel.stateManager == MagiskState.UP_TO_DATE}"
|
isEnabled="@{viewModel.stateManager == MagiskState.UP_TO_DATE && (viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100)}"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
Loading…
Reference in New Issue
Block a user