commit 237b388d5ece2d1a85bd42e0423ecd929a236ff0 Author: n8fr8 nathan@guardianproject.info Date: Fri Sep 6 15:33:51 2019 -0400
yet another attempt at fixing the phantom zulu locale bug! --- app/src/main/java/org/torproject/android/OrbotApp.java | 14 ++------------ .../java/org/torproject/android/settings/Languages.java | 9 +++++---- 2 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotApp.java b/app/src/main/java/org/torproject/android/OrbotApp.java index e92083d3..dbd9d469 100644 --- a/app/src/main/java/org/torproject/android/OrbotApp.java +++ b/app/src/main/java/org/torproject/android/OrbotApp.java @@ -42,7 +42,7 @@ public class OrbotApp extends Application implements OrbotConstants { //check for updates via github, since it is unlikely to be blocked; notify the user of places where upgrades can be found new AppUpdater(this) .setUpdateFrom(UpdateFrom.JSON) - .setUpdateJSON("https://raw.githubusercontent.com/n8fr8/orbot/master/update.json") + .setUpdateJSON("https://raw.githubusercontent.com/guardianproject/orbot/master/update.json") .setDisplay(Display.NOTIFICATION).start(); }
@@ -59,17 +59,7 @@ public class OrbotApp extends Application implements OrbotConstants { if (!Prefs.getDefaultLocale().equals(Locale.getDefault().getLanguage())) Languages.setLanguage(this, Prefs.getDefaultLocale(), true); } - /** - public static void forceChangeLanguage(Activity activity) { - Intent intent = activity.getIntent(); - if (intent == null) // when launched as LAUNCHER - intent = new Intent(activity, OrbotMainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); - activity.finish(); - activity.overridePendingTransition(0, 0); - activity.startActivity(intent); - activity.overridePendingTransition(0, 0); - }**/ +
public static Languages getLanguages(Activity activity) { return Languages.get(activity); 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 05ae96ce..1032d499 100644 --- a/app/src/main/java/org/torproject/android/settings/Languages.java +++ b/app/src/main/java/org/torproject/android/settings/Languages.java @@ -21,7 +21,7 @@ import java.util.TreeMap; public class Languages { public static final String TAG = "Languages";
- public static final Locale defaultLocale; + public static Locale defaultLocale; public static final Locale TIBETAN = new Locale("bo"); static final Locale localesToTest[] = { Locale.ENGLISH, Locale.FRENCH, Locale.GERMAN, @@ -61,11 +61,10 @@ public class Languages { private static Map<String, String> tmpMap = new TreeMap<String, String>(); private static Map<String, String> nameMap;
- static { - defaultLocale = Locale.getDefault(); - }
private Languages(Activity activity) { + + AssetManager assets = activity.getAssets(); Configuration config = activity.getResources().getConfiguration(); // Resources() requires DisplayMetrics, but they are only needed for drawables @@ -119,6 +118,8 @@ public class Languages { * @return */ public static void setup(Class<?> clazz, int resId) { + defaultLocale = Locale.getDefault(); + if (Languages.clazz == null) { Languages.clazz = clazz; Languages.resId = resId;
tor-commits@lists.torproject.org