forked from organicmaps/organicmaps
[android] Minor changes.
This commit is contained in:
parent
d0290d3a73
commit
fd713b63b8
2 changed files with 19 additions and 15 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue