Fixed magisk button states

This commit is contained in:
Viktor De Pasquale 2019-10-23 16:20:01 +02:00
parent 17fb8f2298
commit 067cb0cd9d
2 changed files with 4 additions and 7 deletions

View File

@ -140,15 +140,12 @@ class HomeViewModel(
fun onManagerPressed() = ManagerInstallDialog().publish()
fun onMagiskPressed() {
//pre-fix so user doesn't click twice accidentally
stateMagiskProgress.value = 1
withPermissions(
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
).map { check(it);it }.subscribeK(onError = {
stateManagerProgress.value = 0
}) {
).map { check(it);it }.subscribeK {
//pre-fix so user doesn't click twice accidentally
stateMagiskProgress.value = 1
DownloadService(get()) {
subject = Magisk(Configuration.Download)
}

View File

@ -118,7 +118,7 @@
<com.google.android.material.button.MaterialButton
style="?styleButtonDefault"
gone="@{viewModel.stateMagisk != MagiskState.OBSOLETE}"
isEnabled="@{viewModel.stateManager == MagiskState.UP_TO_DATE}"
isEnabled="@{viewModel.stateManager == MagiskState.UP_TO_DATE &amp;&amp; (viewModel.stateMagiskProgress == 0 || viewModel.stateMagiskProgress == 100)}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"