commit 29541f35fb9183148eeb3550aaf2a3d453c1d645 Author: bim dsnake@protonmail.com Date: Tue Apr 7 22:39:52 2020 -0400
Fixes #300 Where Locale is set to Zulu when settings are opened --- .../org/torproject/android/settings/Languages.java | 18 +----------------- .../org/torproject/android/settings/LocaleHelper.java | 6 ------ 2 files changed, 1 insertion(+), 23 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/settings/Languages.java b/app/src/main/java/org/torproject/android/settings/Languages.java index 1032d499..da83cd97 100644 --- a/app/src/main/java/org/torproject/android/settings/Languages.java +++ b/app/src/main/java/org/torproject/android/settings/Languages.java @@ -71,9 +71,8 @@ public class Languages { DisplayMetrics ignored = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(ignored); Resources resources; - Set<Locale> localeSet = new LinkedHashSet<Locale>(); + Set<Locale> localeSet = new LinkedHashSet<>(); for (Locale locale : localesToTest) { - config.locale = locale; resources = new Resources(assets, ignored, config); if (!TextUtils.equals(defaultString, resources.getString(resId)) || locale.equals(Locale.ENGLISH)) @@ -193,21 +192,6 @@ public class Languages { }
/** - * Return the name of the language based on the locale. - * - * @param locale - * @return - */ - public String getName(String locale) { - String ret = nameMap.get(locale); - // if no match, try to return a more general name (i.e. English for - // en_IN) - if (ret == null && locale.contains("_")) - ret = nameMap.get(locale.split("_")[0]); - return ret; - } - - /** * Return an array of the names of all the supported languages, sorted to * match what is returned by {@link Languages#getSupportedLocales()}. * diff --git a/app/src/main/java/org/torproject/android/settings/LocaleHelper.java b/app/src/main/java/org/torproject/android/settings/LocaleHelper.java index ea3fde93..4fb9e833 100644 --- a/app/src/main/java/org/torproject/android/settings/LocaleHelper.java +++ b/app/src/main/java/org/torproject/android/settings/LocaleHelper.java @@ -20,8 +20,6 @@ import java.util.Locale; */ public class LocaleHelper {
- private static final String SELECTED_LANGUAGE = "Locale.Helper.Selected.Language"; - public static Context onAttach(Context context) { String lang = getPersistedData(context, Locale.getDefault().getLanguage()); return setLocale(context, lang); @@ -32,10 +30,6 @@ public class LocaleHelper { return setLocale(context, lang); }
- public static String getLanguage(Context context) { - return getPersistedData(context, Locale.getDefault().getLanguage()); - } - public static Context setLocale(Context context, String language) { persist(context, language);
tor-commits@lists.torproject.org