address review

This commit is contained in:
Julian Dehm
2019-03-27 19:15:22 +01:00
committed by akwizgran
parent 5b77f28ce0
commit 2374f8b4c9
3 changed files with 17 additions and 8 deletions

View File

@@ -106,7 +106,7 @@ public class BriarApplicationImpl extends Application
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Localizer.getInstance()
.applicationConfigurationChanged(this);
.applicationConfigurationChanged(this, newConfig);
}
private void setTheme(Context ctx, SharedPreferences prefs) {

View File

@@ -119,20 +119,29 @@ public class Localizer {
Resources.getSystem().getConfiguration();
updateConfiguration(systemConfiguration, locale);
// DateUtils uses the system resources, so we need to update them too.
//noinspection deprecation
Resources.getSystem().updateConfiguration(systemConfiguration,
Resources.getSystem().getDisplayMetrics());
}
public void applicationConfigurationChanged(Context appContext) {
public void applicationConfigurationChanged(Context appContext,
Configuration newConfig) {
if (SDK_INT >= 24) {
if (newConfig.getLocales().get(0) == locale) return;
} else {
if (newConfig.locale == locale) return;
}
setLocaleAndSystemConfiguration(locale);
if (SDK_INT < 17) setLocaleLegacy(appContext);
}
// Indicates whether the language represented by locale
// should be offered to the user on this device.
// * Android doesn't pick up Asturian on API < 21
// * Android can't render Devanagari characters on API 15.
// * RTL languages are supported since API >= 17
/**
* Indicates whether the language represented by locale
* should be offered to the user on this device.
* * Android doesn't pick up Asturian on API < 21
* * Android can't render Devanagari characters on API 15.
* * RTL languages are supported since API >= 17
*/
public static boolean isLocaleSupported(Locale locale) {
if (SDK_INT >= 21) return true;
if (locale.getLanguage().equals("ast")) return false;

View File

@@ -301,7 +301,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
continue;
}
String nativeName;
// Unsupported languages won't be translated to their native name.
// Unknown languages won't be translated to their native name.
if (locale.getLanguage().equals("ast")) {
nativeName = "Asturianu";
} else if (locale.getLanguage().equals("oc")) {