Merge pull request #11151 from osmandapp/map_transliteration

Enable transliteration by default for English
This commit is contained in:
vshcherb 2021-03-15 17:42:01 +01:00 committed by GitHub
commit 2e2f7b6dcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 15 deletions

View file

@ -89,7 +89,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
defaultValues.put(mode, defValue);
}
// TODO final
@Override
public boolean setModeValue(ApplicationMode mode, T obj) {
if (global) {
@ -106,7 +105,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
return valueSaved;
}
// TODO final
public T getProfileDefaultValue(ApplicationMode mode) {
if (global) {
return defaultValue;
@ -129,7 +127,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
return defaultValues != null && defaultValues.containsKey(mode);
}
// TODO final
protected T getDefaultValue() {
return getProfileDefaultValue(settings.APPLICATION_MODE.get());
}
@ -139,7 +136,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
this.defaultValue = newDefaultValue;
}
// TODO final
@Override
public T getModeValue(ApplicationMode mode) {
if (global) {
@ -149,14 +145,13 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
return getValue(settings.getProfilePreferences(mode), defaultV);
}
// TODO final
@Override
public T get() {
if (cache && cachedValue != null && cachedPreference == getPreferences()) {
return cachedValue;
}
cachedPreference = getPreferences();
cachedValue = getValue(cachedPreference, getProfileDefaultValue(settings.APPLICATION_MODE.get()));
cachedValue = getValue(cachedPreference, getDefaultValue());
return cachedValue;
}
@ -181,7 +176,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
}
}
// TODO final
@Override
public boolean set(T obj) {
Object prefs = getPreferences();
@ -210,7 +204,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
return shared;
}
// TODO final
@Override
public boolean writeToJson(JSONObject json, ApplicationMode appMode) throws JSONException {
if (appMode != null) {
@ -231,7 +224,6 @@ public abstract class CommonPreference<T> extends PreferenceWithListener<T> {
return false;
}
// TODO final
@Override
public void readFromJson(JSONObject json, ApplicationMode appMode) throws JSONException {
if (appMode != null) {

View file

@ -11,6 +11,10 @@ import android.net.NetworkInfo;
import android.os.Build;
import android.os.Environment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.util.Pair;
import net.osmand.FileUtils;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
@ -77,10 +81,6 @@ import java.util.Map;
import java.util.Set;
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.DRAWER_ITEM_ID_SCHEME;
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> 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() {
return MAP_PREFERRED_LOCALE.get().equals("en");