From f3327461887ba9c2776cd4042ff3a667b47a21ca Mon Sep 17 00:00:00 2001 From: Viktor De Pasquale Date: Mon, 15 Apr 2019 15:57:23 +0200 Subject: [PATCH] Fixed current version showing null when magisk is not installed --- .../java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt | 10 +++++++--- app/src/main/res/layout/include_update_card.xml | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt index ad92ab119..4eef9a973 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt @@ -129,9 +129,13 @@ class HomeViewModel( else -> MagiskState.UP_TO_DATE } - magiskCurrentVersion.value = version - .format(Config.magiskVersionString, Config.magiskVersionCode) - .let { current.format(it) } + if (magiskState.value != MagiskState.NOT_INSTALLED) { + magiskCurrentVersion.value = version + .format(Config.magiskVersionString, Config.magiskVersionCode) + .let { current.format(it) } + } else { + magiskCurrentVersion.value = "" + } magiskLatestVersion.value = version .format(Config.remoteMagiskVersionString, Config.remoteMagiskVersionCode) .let { latest.format(it) } diff --git a/app/src/main/res/layout/include_update_card.xml b/app/src/main/res/layout/include_update_card.xml index 68c7d9f3d..a337a0edf 100644 --- a/app/src/main/res/layout/include_update_card.xml +++ b/app/src/main/res/layout/include_update_card.xml @@ -106,6 +106,7 @@