From bf5fb5f6236511b7098f5d7296ba8fe7f3120a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Sat, 27 Mar 2021 14:06:30 +0100 Subject: [PATCH] [UI] Update main activity badge. --- app/build.gradle | 2 +- .../pl/szczodrzynski/edziennik/MainActivity.kt | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c39adb71..c9751c52 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,7 +19,7 @@ android { buildConfigField "java.util.Map", "GIT_INFO", gitInfoMap buildConfigField "long", "BUILD_TIMESTAMP", String.valueOf(System.currentTimeMillis()) - buildConfigField "String", "VERSION_BASE", release.versionName + buildConfigField "String", "VERSION_BASE", "\"${release.versionName}\"" multiDexEnabled = true diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt index de9b5f85..3e953239 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt @@ -302,21 +302,9 @@ class MainActivity : AppCompatActivity(), CoroutineScope { mainSnackbar.setCoordinator(b.navView.coordinator, b.navView.bottomBar) errorSnackbar.setCoordinator(b.navView.coordinator, b.navView.bottomBar) - when { - BuildConfig.VERSION_NAME.contains("nightly") -> { - b.nightlyText.isVisible = true - b.nightlyText.text = "Nightly\n"+BuildConfig.VERSION_NAME.substringAfterLast(".") - } - BuildConfig.VERSION_NAME.contains("daily") -> { - b.nightlyText.isVisible = true - b.nightlyText.text = "Daily\n"+BuildConfig.VERSION_NAME.substringAfterLast(".") - } - BuildConfig.DEBUG -> { - b.nightlyText.isVisible = true - b.nightlyText.text = "Debug\n"+BuildConfig.VERSION_NAME - } - else -> b.nightlyText.isVisible = false - } + val versionBadge = app.buildManager.versionBadge + b.nightlyText.isVisible = versionBadge != null + b.nightlyText.text = versionBadge navLoading = true