File tree Expand file tree Collapse file tree 4 files changed +16
-10
lines changed
src/main/java/io/snabble/sdk
ui/src/main/java/io/snabble/sdk/ui Expand file tree Collapse file tree 4 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ allprojects {
2424 }
2525
2626 project. ext {
27- sdkVersion= ' 0.6.15 '
27+ sdkVersion= ' 0.6.16 '
2828 versionCode= 1
2929
3030 compileSdkVersion= 27
Original file line number Diff line number Diff line change @@ -42,8 +42,6 @@ dependencies {
4242 implementation " com.squareup.okhttp3:logging-interceptor:${ project.okhttpVersion} "
4343 implementation ' com.google.code.gson:gson:2.8.2'
4444
45- api ' com.ibm.icu:icu4j:61.1'
46-
4745 testImplementation ' junit:junit:4.12'
4846
4947 androidTestImplementation ' com.android.support.test:rules:1.0.1'
Original file line number Diff line number Diff line change 44import android .app .Application ;
55import android .os .Bundle ;
66
7- import com .ibm .icu .util .Currency ;
8-
97import java .io .File ;
108import java .math .RoundingMode ;
119import java .util .Arrays ;
10+ import java .util .Currency ;
1211import java .util .List ;
1312import java .util .Locale ;
1413import java .util .Map ;
Original file line number Diff line number Diff line change 11package io .snabble .sdk .ui ;
22
3-
4- import com .ibm .icu .text .NumberFormat ;
5- import com .ibm .icu .util .Currency ;
6-
73import java .math .BigDecimal ;
4+ import java .text .NumberFormat ;
5+ import java .util .Currency ;
86
97import io .snabble .sdk .Product ;
108import io .snabble .sdk .SnabbleSdk ;
@@ -29,7 +27,18 @@ public String format(int price) {
2927 BigDecimal divider = new BigDecimal (10 ).pow (fractionDigits );
3028 BigDecimal dividedPrice = bigDecimal .divide (divider , fractionDigits , sdkInstance .getRoundingMode ());
3129
32- return numberFormat .format (dividedPrice .doubleValue ());
30+ String formattedPrice = numberFormat .format (dividedPrice .doubleValue ());
31+
32+ // Android 4.x and 6 (but not 5 and 7+) are shipping with ICU versions
33+ // that have the currency symbol set to HUF instead of Ft for Locale hu_HU
34+ //
35+ // including the whole ICU library as a dependency increased APK size by 10MB
36+ // so we are overriding the result here instead for consistency
37+ if (currency .getCurrencyCode ().equals ("HUF" )){
38+ return formattedPrice .replace ("HUF" , "Ft" );
39+ }
40+
41+ return formattedPrice ;
3342 }
3443
3544 public String format (Product product ) {
You can’t perform that action at this time.
0 commit comments