Merge pull request #11151 from osmandapp/map_transliteration
Enable transliteration by default for English
This commit is contained in:
commit
2e2f7b6dcf
2 changed files with 13 additions and 15 deletions
|
@ -89,7 +89,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
|
||||||
defaultValues.put(mode, defValue);
|
defaultValues.put(mode, defValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO final
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setModeValue(ApplicationMode mode, T obj) {
|
public boolean setModeValue(ApplicationMode mode, T obj) {
|
||||||
if (global) {
|
if (global) {
|
||||||
|
@ -106,7 +105,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
|
||||||
return valueSaved;
|
return valueSaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO final
|
|
||||||
public T getProfileDefaultValue(ApplicationMode mode) {
|
public T getProfileDefaultValue(ApplicationMode mode) {
|
||||||
if (global) {
|
if (global) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -129,7 +127,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
|
||||||
return defaultValues != null && defaultValues.containsKey(mode);
|
return defaultValues != null && defaultValues.containsKey(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO final
|
|
||||||
protected T getDefaultValue() {
|
protected T getDefaultValue() {
|
||||||
return getProfileDefaultValue(settings.APPLICATION_MODE.get());
|
return getProfileDefaultValue(settings.APPLICATION_MODE.get());
|
||||||
}
|
}
|
||||||
|
@ -139,7 +136,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
|
||||||
this.defaultValue = newDefaultValue;
|
this.defaultValue = newDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO final
|
|
||||||
@Override
|
@Override
|
||||||
public T getModeValue(ApplicationMode mode) {
|
public T getModeValue(ApplicationMode mode) {
|
||||||
if (global) {
|
if (global) {
|
||||||
|
@ -149,14 +145,13 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
|
||||||
return getValue(settings.getProfilePreferences(mode), defaultV);
|
return getValue(settings.getProfilePreferences(mode), defaultV);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO final
|
|
||||||
@Override
|
@Override
|
||||||
public T get() {
|
public T get() {
|
||||||
if (cache && cachedValue != null && cachedPreference == getPreferences()) {
|
if (cache && cachedValue != null && cachedPreference == getPreferences()) {
|
||||||
return cachedValue;
|
return cachedValue;
|
||||||
}
|
}
|
||||||
cachedPreference = getPreferences();
|
cachedPreference = getPreferences();
|
||||||
cachedValue = getValue(cachedPreference, getProfileDefaultValue(settings.APPLICATION_MODE.get()));
|
cachedValue = getValue(cachedPreference, getDefaultValue());
|
||||||
return cachedValue;
|
return cachedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +176,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO final
|
|
||||||
@Override
|
@Override
|
||||||
public boolean set(T obj) {
|
public boolean set(T obj) {
|
||||||
Object prefs = getPreferences();
|
Object prefs = getPreferences();
|
||||||
|
@ -210,7 +204,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
|
||||||
return shared;
|
return shared;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO final
|
|
||||||
@Override
|
@Override
|
||||||
public boolean writeToJson(JSONObject json, ApplicationMode appMode) throws JSONException {
|
public boolean writeToJson(JSONObject json, ApplicationMode appMode) throws JSONException {
|
||||||
if (appMode != null) {
|
if (appMode != null) {
|
||||||
|
@ -231,7 +224,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO final
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromJson(JSONObject json, ApplicationMode appMode) throws JSONException {
|
public void readFromJson(JSONObject json, ApplicationMode appMode) throws JSONException {
|
||||||
if (appMode != null) {
|
if (appMode != null) {
|
||||||
|
|
|
@ -11,6 +11,10 @@ import android.net.NetworkInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.util.Pair;
|
||||||
|
|
||||||
import net.osmand.FileUtils;
|
import net.osmand.FileUtils;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
@ -77,10 +81,6 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.core.util.Pair;
|
|
||||||
|
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.CONFIGURE_MAP_ITEM_ID_SCHEME;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.CONFIGURE_MAP_ITEM_ID_SCHEME;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_ITEM_ID_SCHEME;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_ITEM_ID_SCHEME;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ACTIONS;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ACTIONS;
|
||||||
|
@ -1119,7 +1119,13 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<String> PREFERRED_LOCALE = new StringPreference(this, "preferred_locale", "").makeGlobal().makeShared();
|
public final OsmandPreference<String> PREFERRED_LOCALE = new StringPreference(this, "preferred_locale", "").makeGlobal().makeShared();
|
||||||
|
|
||||||
public final OsmandPreference<String> MAP_PREFERRED_LOCALE = new StringPreference(this, "map_preferred_locale", "").makeGlobal().makeShared().cache();
|
public final OsmandPreference<String> MAP_PREFERRED_LOCALE = new StringPreference(this, "map_preferred_locale", "").makeGlobal().makeShared().cache();
|
||||||
public final OsmandPreference<Boolean> MAP_TRANSLITERATE_NAMES = new BooleanPreference(this, "map_transliterate_names", false).makeGlobal().makeShared().cache();
|
public final OsmandPreference<Boolean> MAP_TRANSLITERATE_NAMES = new BooleanPreference(this, "map_transliterate_names", false) {
|
||||||
|
|
||||||
|
protected Boolean getDefaultValue() {
|
||||||
|
return usingEnglishNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
}.makeGlobal().makeShared().cache();
|
||||||
|
|
||||||
public boolean usingEnglishNames() {
|
public boolean usingEnglishNames() {
|
||||||
return MAP_PREFERRED_LOCALE.get().equals("en");
|
return MAP_PREFERRED_LOCALE.get().equals("en");
|
||||||
|
|
Loading…
Reference in a new issue