Detect rtl automatically for language

This commit is contained in:
Victor Shcherb 2020-03-28 14:05:21 +01:00
parent 61353d2805
commit b81d12c848
2 changed files with 4 additions and 0 deletions

View file

@ -379,6 +379,7 @@ public class OsmandApplication extends MultiDexApplication {
}
}
public void checkPreferredLocale() {
Configuration config = getBaseContext().getResources().getConfiguration();
@ -408,6 +409,8 @@ public class OsmandApplication extends MultiDexApplication {
if (selectedLocale != null) {
Locale.setDefault(selectedLocale);
config.locale = selectedLocale;
config.setLayoutDirection(selectedLocale);
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
if (android.os.Build.VERSION.SDK_INT >= 17) {
Configuration conf = new Configuration(config);

View file

@ -3401,6 +3401,7 @@ public class OsmandSettings {
// this value could localized
public final OsmandPreference<String> VOICE_PROVIDER = new StringPreference("voice_provider", null) {
protected String getDefaultValue() {
Configuration config = ctx.getResources().getConfiguration();
for (String lang : TTS_AVAILABLE_VOICES) {
if (lang.equals(config.locale.getLanguage())) {