Set default driving region

This commit is contained in:
Victor Shcherb 2015-04-10 19:49:52 +02:00
parent 08ab3b073a
commit a5ad26fa58

View file

@ -11,6 +11,7 @@ import java.util.LinkedHashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -657,6 +658,24 @@ public class OsmandSettings {
} }
return super.setValue(prefs, val); 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(); }.makeGlobal().cache();
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name