diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java index 986c53c15e..533e705c85 100644 --- a/android/src/com/mapswithme/maps/MWMActivity.java +++ b/android/src/com/mapswithme/maps/MWMActivity.java @@ -143,7 +143,7 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService if (u == UNITS_UNDEFINED) { // Checking system-default measurement system - if (UnitLocale.getCurrent() == UnitLocale.Metric) + if (UnitLocale.getCurrent() == UnitLocale.METRIC) { setMeasurementSystem(UNITS_METRIC); } @@ -307,9 +307,9 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService return true; else { - final String lang = Locale.getDefault().getISO3Country(); - Log.i(TAG, "Locale country ISO = " + lang); - if (isChinaISO(lang)) + final String code = Locale.getDefault().getCountry(); + Log.i(TAG, "Locale country ISO = " + code); + if (isChinaISO(code)) return true; } } diff --git a/android/src/com/mapswithme/maps/UnitLocale.java b/android/src/com/mapswithme/maps/UnitLocale.java index f1aca921ba..a5502035e3 100644 --- a/android/src/com/mapswithme/maps/UnitLocale.java +++ b/android/src/com/mapswithme/maps/UnitLocale.java @@ -2,16 +2,20 @@ package com.mapswithme.maps; import java.util.Locale; -public class UnitLocale { - public static UnitLocale Imperial = new UnitLocale(); - public static UnitLocale Metric = new UnitLocale(); +public class UnitLocale +{ + public static int METRIC = 0; + public static int IMPERIAL = 1; - public static UnitLocale getCurrent() - { - String countryCode = Locale.getDefault().getCountry(); - if ("US".equals(countryCode)) return Imperial; // USA - if ("LR".equals(countryCode)) return Imperial; // liberia - if ("MM".equals(countryCode)) return Imperial; // burma - return Metric; - } + public static int getCurrent() + { + final String code = Locale.getDefault().getCountry(); + // USA, Liberia, Burma + String arr[] = { "US", "LR", "MM" }; + for (String s : arr) + if (s.equalsIgnoreCase(code)) + return IMPERIAL; + + return METRIC; + } }