diff options
author | Torsten Grote <t@grobox.de> | 2020-09-03 13:27:05 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-09-03 13:27:05 -0300 |
commit | 1cb91611af564116e75384f17bc5af97b1ed2d12 (patch) | |
tree | 375c7eff8efd4ee0e6359005bd10c826745a0af7 | |
parent | 85c344b358e13d5b78647d191d6129dd11f8bdaf (diff) | |
download | taler-android-1cb91611af564116e75384f17bc5af97b1ed2d12.tar.gz taler-android-1cb91611af564116e75384f17bc5af97b1ed2d12.tar.bz2 taler-android-1cb91611af564116e75384f17bc5af97b1ed2d12.zip |
[pos] make app work on API 24+
-rw-r--r-- | merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt | 4 | ||||
-rw-r--r-- | taler-kotlin-android/src/main/java/net/taler/common/ContractTerms.kt | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt index cc8caf6..7def7cc 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt @@ -16,6 +16,7 @@ package net.taler.merchantpos.config +import android.os.Build.VERSION.SDK_INT import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import net.taler.common.ContractProduct @@ -49,7 +50,8 @@ data class Category( val nameI18n: Map<String, String>? = null ) { var selected: Boolean = false - val localizedName: String get() = TalerUtils.getLocalizedString(nameI18n, name) + val localizedName: String + get() = if (SDK_INT >= 26) TalerUtils.getLocalizedString(nameI18n, name) else name } @Serializable diff --git a/taler-kotlin-android/src/main/java/net/taler/common/ContractTerms.kt b/taler-kotlin-android/src/main/java/net/taler/common/ContractTerms.kt index d22eaa0..fb30692 100644 --- a/taler-kotlin-android/src/main/java/net/taler/common/ContractTerms.kt +++ b/taler-kotlin-android/src/main/java/net/taler/common/ContractTerms.kt @@ -16,7 +16,7 @@ package net.taler.common -import androidx.annotation.RequiresApi +import android.os.Build import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import net.taler.common.TalerUtils.getLocalizedString @@ -48,8 +48,11 @@ abstract class Product { abstract val location: String? abstract val image: String? val localizedDescription: String - @RequiresApi(26) - get() = getLocalizedString(descriptionI18n, description) + get() = if (Build.VERSION.SDK_INT >= 26) { + getLocalizedString(descriptionI18n, description) + } else { + description + } } @Serializable |