From a5ad26fa587adbb5c4cc9bb540424fb20a416fa7 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 10 Apr 2015 19:49:52 +0200 Subject: [PATCH] Set default driving region --- .../src/net/osmand/plus/OsmandSettings.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 57317b4e96..b7aa8e100b 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -11,6 +11,7 @@ import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; @@ -657,6 +658,24 @@ public class OsmandSettings { } return super.setValue(prefs, val); }; + + protected DrivingRegion getDefaultValue() { + Locale df = Locale.getDefault(); + if(df == null) { + return DrivingRegion.EUROPE_ASIA; + } + if(df.getCountry().equalsIgnoreCase(Locale.US.getCountry())) { + return DrivingRegion.US; + } else if(df.getCountry().equalsIgnoreCase(Locale.CANADA.getCountry())) { + return DrivingRegion.CANADA; + } else if(df.getCountry().equalsIgnoreCase(Locale.JAPAN.getCountry())) { + return DrivingRegion.JAPAN; + // potentially wrong in europe +// } else if(df.getCountry().equalsIgnoreCase(Locale.UK.getCountry())) { +// return DrivingRegion.UK_AND_OTHERS; + } + return DrivingRegion.EUROPE_ASIA; + }; }.makeGlobal().cache(); // this value string is synchronized with settings_pref.xml preference name