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 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)
} }

View File

@ -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 &amp;&amp; (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"