Fixed current version showing null when magisk is not installed

This commit is contained in:
Viktor De Pasquale 2019-04-15 15:57:23 +02:00
parent b2fa5b551e
commit f332746188
2 changed files with 8 additions and 3 deletions

View File

@ -129,9 +129,13 @@ class HomeViewModel(
else -> MagiskState.UP_TO_DATE else -> MagiskState.UP_TO_DATE
} }
if (magiskState.value != MagiskState.NOT_INSTALLED) {
magiskCurrentVersion.value = version magiskCurrentVersion.value = version
.format(Config.magiskVersionString, Config.magiskVersionCode) .format(Config.magiskVersionString, Config.magiskVersionCode)
.let { current.format(it) } .let { current.format(it) }
} else {
magiskCurrentVersion.value = ""
}
magiskLatestVersion.value = version magiskLatestVersion.value = version
.format(Config.remoteMagiskVersionString, Config.remoteMagiskVersionCode) .format(Config.remoteMagiskVersionString, Config.remoteMagiskVersionCode)
.let { latest.format(it) } .let { latest.format(it) }

View File

@ -106,6 +106,7 @@
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/current_version" android:id="@+id/current_version"
gone="@{state == MagiskState.LOADING || currentVersion.length == 0}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"