From 5c3a86c084898e1fe9e6b693376b3f6d7b0632ac Mon Sep 17 00:00:00 2001 From: oleksandrsarapulovgl <82441124+oleksandrsarapulovgl@users.noreply.github.com> Date: Wed, 14 Jul 2021 16:44:04 +0300 Subject: [PATCH] Fixed crash related to type of object accepted by an interface (#148) * Fixed crash related to type of object accepted by an interface * Version update --- .../main/java/dgca/verifier/app/android/CodeReaderFragment.kt | 2 +- .../java/dgca/verifier/app/android/CodeReaderViewModel.kt | 4 +++- buildSrc/src/main/java/AppConfig.kt | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/dgca/verifier/app/android/CodeReaderFragment.kt b/app/src/main/java/dgca/verifier/app/android/CodeReaderFragment.kt index 157c9348..62e2fa5a 100644 --- a/app/src/main/java/dgca/verifier/app/android/CodeReaderFragment.kt +++ b/app/src/main/java/dgca/verifier/app/android/CodeReaderFragment.kt @@ -147,7 +147,7 @@ class CodeReaderFragment : Fragment(), NavController.OnDestinationChangedListene binding.countrySelector.onItemSelectedListener = object : OnItemSelectedListener { override fun onItemSelected( parentView: AdapterView<*>?, - selectedItemView: View, + selectedItemView: View?, position: Int, id: Long ) { diff --git a/app/src/main/java/dgca/verifier/app/android/CodeReaderViewModel.kt b/app/src/main/java/dgca/verifier/app/android/CodeReaderViewModel.kt index e097bb4c..595de90d 100644 --- a/app/src/main/java/dgca/verifier/app/android/CodeReaderViewModel.kt +++ b/app/src/main/java/dgca/verifier/app/android/CodeReaderViewModel.kt @@ -49,7 +49,9 @@ class CodeReaderViewModel @Inject constructor( } _countries.addSource(_selectedCountry) { - _countries.value = Pair(_countries.value?.first ?: emptyList(), it ?: "") + if (_countries.value?.second == null || _countries.value?.second != it) { + _countries.value = Pair(_countries.value?.first ?: emptyList(), it ?: "") + } } } } \ No newline at end of file diff --git a/buildSrc/src/main/java/AppConfig.kt b/buildSrc/src/main/java/AppConfig.kt index eea7f729..c7c57628 100644 --- a/buildSrc/src/main/java/AppConfig.kt +++ b/buildSrc/src/main/java/AppConfig.kt @@ -28,8 +28,8 @@ object Config { const val targetSdk = 29 val javaVersion = JavaVersion.VERSION_1_8 - const val versionCode = 14 - const val versionName = "1.1.6" + const val versionCode = 15 + const val versionName = "1.1.7" const val androidTestInstrumentation = "androidx.test.runner.AndroidJUnitRunner" const val proguardConsumerRules = "consumer-rules.pro"