[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] udpate custom language/locale handling



commit 2e2f6e78ede1d0367aa8760d03d90aa2393d6d2a
Author: n8fr8 <nathan@xxxxxxxxxxxxxxxxxxxx>
Date:   Tue Nov 13 13:45:37 2018 -0500

    udpate custom language/locale handling
---
 app/build.gradle                                   |  6 +++---
 .../main/java/org/torproject/android/OrbotApp.java |  7 +++----
 .../org/torproject/android/OrbotMainActivity.java  | 22 +++++++++++++++++-----
 .../org/torproject/android/settings/Languages.java |  4 ++--
 .../android/settings/SettingsPreferences.java      |  6 ------
 app/src/main/res/values/arrays.xml                 | 10 +++++-----
 app/src/main/res/values/strings.xml                |  7 ++++++-
 orbotservice/build.gradle                          |  2 +-
 8 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/app/build.gradle b/app/build.gradle
index 815202c1..ba57f72c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -34,8 +34,8 @@ android {
             minSdkVersion 16
             applicationId 'org.torproject.android'
             targetSdkVersion 27
-            versionCode 16040010
-            versionName '16.0.4-BETA-1-tor-0.3.4.8'
+            versionCode 16050100
+            versionName '16.0.5-RC-1-tor-0.3.4.9'
             archivesBaseName = "Orbot-$versionName"
         }
     }
@@ -67,7 +67,7 @@ android {
 }
 
 dependencies {
-    implementation 'com.github.delight-im:Android-Languages:v1.0.1'
+//    implementation 'com.github.delight-im:Android-Languages:v1.0.1'
     implementation 'com.android.support.constraint:constraint-layout:1.1.3'
     implementation project(':orbotservice')
     implementation 'com.android.support:design:27.1.1'
diff --git a/app/src/main/java/org/torproject/android/OrbotApp.java b/app/src/main/java/org/torproject/android/OrbotApp.java
index a61f0937..7279c8e2 100644
--- a/app/src/main/java/org/torproject/android/OrbotApp.java
+++ b/app/src/main/java/org/torproject/android/OrbotApp.java
@@ -33,7 +33,6 @@ import org.torproject.android.settings.LocaleHelper;
 import java.util.Locale;
 import java.util.Set;
 
-import im.delight.android.languages.Language;
 
 public class OrbotApp extends Application implements OrbotConstants
 {
@@ -48,7 +47,7 @@ public class OrbotApp extends Application implements OrbotConstants
         Languages.setup(OrbotMainActivity.class, R.string.menu_settings);
         Languages.setLanguage(this, Prefs.getDefaultLocale(), true);
 
-        Language.setFromPreference(this, "pref_default_locale");
+        //Language.setFromPreference(this, "pref_default_locale");
 
         //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)
@@ -66,10 +65,10 @@ public class OrbotApp extends Application implements OrbotConstants
     @Override
     public void onConfigurationChanged(Configuration newConfig) {
         super.onConfigurationChanged(newConfig);
-        Language.setFromPreference(this, "pref_default_locale");
+       // Language.setFromPreference(this, "pref_default_locale");
 
         //Log.i(TAG, "onConfigurationChanged " + newConfig.locale.getLanguage());
-    //    Languages.setLanguage(this, Prefs.getDefaultLocale(), true);
+        Languages.setLanguage(this, Prefs.getDefaultLocale(), true);
     }
 	/**
     public static void forceChangeLanguage(Activity activity) {
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index f19bbc06..e18711b1 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -15,6 +15,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 import java.util.StringTokenizer;
+import java.util.TimerTask;
 
 import org.json.JSONArray;
 import org.torproject.android.service.OrbotConstants;
@@ -92,7 +93,6 @@ import android.widget.Toast;
 import com.google.zxing.integration.android.IntentIntegrator;
 import com.google.zxing.integration.android.IntentResult;
 
-import im.delight.android.languages.Language;
 import pl.bclogic.pulsator4droid.library.PulsatorLayout;
 
 import static android.support.v4.content.FileProvider.getUriForFile;
@@ -938,12 +938,24 @@ public class OrbotMainActivity extends AppCompatActivity
         {
             if (data != null && (!TextUtils.isEmpty(data.getStringExtra("locale")))) {
 
-                Prefs.setDefaultLocale(data.getStringExtra("locale"));
-                Languages.setLanguage(this, Prefs.getDefaultLocale(), true);
-                Language.setFromPreference(this, "pref_default_locale");
+                String newLocale = data.getStringExtra("locale");
+                Prefs.setDefaultLocale(newLocale);
+                Languages.setLanguage(this, newLocale, true);
+              //  Language.setFromPreference(this, "pref_default_locale");
 
                 finish();
-                startActivity(new Intent(this,OrbotMainActivity.class));
+
+                final Handler handler = new Handler();
+                handler.postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        //Do something after 100ms
+                        startActivity(new Intent(OrbotMainActivity.this,OrbotMainActivity.class));
+
+                    }
+                }, 1000);
+
+
             }
         }
         else if (request == REQUEST_VPN)
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 fcdfa344..b7425996 100644
--- a/app/src/main/java/org/torproject/android/settings/Languages.java
+++ b/app/src/main/java/org/torproject/android/settings/Languages.java
@@ -94,8 +94,8 @@ public class Languages {
         }
 
         /* USE_SYSTEM_DEFAULT is a fake one for displaying in a chooser menu. */
-        localeSet.add(null);
-        tmpMap.put(USE_SYSTEM_DEFAULT, activity.getString(resId));
+       // localeSet.add(null);
+       // tmpMap.put(USE_SYSTEM_DEFAULT, activity.getString(resId));
         nameMap = Collections.unmodifiableMap(tmpMap);
     }
 
diff --git a/app/src/main/java/org/torproject/android/settings/SettingsPreferences.java b/app/src/main/java/org/torproject/android/settings/SettingsPreferences.java
index 827eb940..c3b5189d 100644
--- a/app/src/main/java/org/torproject/android/settings/SettingsPreferences.java
+++ b/app/src/main/java/org/torproject/android/settings/SettingsPreferences.java
@@ -14,7 +14,6 @@ import android.preference.PreferenceActivity;
 import org.torproject.android.R;
 import org.torproject.android.service.util.Prefs;
 
-import im.delight.android.languages.Language;
 
 public class SettingsPreferences
         extends PreferenceActivity {
@@ -39,11 +38,6 @@ public class SettingsPreferences
             public boolean onPreferenceChange(Preference preference, Object newValue) {
                 String language = (String) newValue;
 
-
-                Prefs.setDefaultLocale(language);
-                Languages.setLanguage(SettingsPreferences.this, Prefs.getDefaultLocale(), true);
-                Language.setFromPreference(SettingsPreferences.this, "pref_default_locale");
-
                 Intent intentResult = new Intent();
                 intentResult.putExtra("locale", language);
                 setResult(RESULT_OK, intentResult);
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 9e7a6196..76e060dc 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -3,13 +3,13 @@
 <resources>
 
 	<string-array name="bridge_options">
-	    <item>Default Bridges (Obfs4)</item>
-	    <item>Cloud Tunneling (Meek)</item>
-	    <item>Get New Bridges...</item>
+	    <item>@string/default_bridges</item>
+	    <item>@string/cloud_tunnel</item>
+	    <item>@string/get_new_bridges</item>
 	    <item></item>
 	</string-array>
 	<string-array name="array_hs_types">
-		<item>User services</item>
-		<item>App services</item>
+		<item>@string/user_services</item>
+		<item>@string/app_services</item>
 	</string-array>
 </resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f14b51b5..fb51caa1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -236,7 +236,6 @@
     <string name="pref_use_expanded_notifications_title">Expanded Notifications</string>
 
     <string name="notification_using_bridges">Bridges enabled!</string>
-    <string name="default_bridges" />
     <string name="set_locale_title">Language</string>
     <string name="set_locale_summary">Choose the locale and language for Orbot</string>
     <string name="wizard_locale_title">Choose Language</string>
@@ -407,4 +406,10 @@
 
     <string name="use_system_default">Use System Default</string>
 
+    <string name="default_bridges">Default Bridges (Obfs4)</string>
+    <string name="cloud_tunnel">Cloud Tunneling</string>
+    <string name="get_new_bridges">Get New Bridges...</string>
+
+    <string name="user_services">User services</string>
+    <string name="app_services">App services</string>
 </resources>
diff --git a/orbotservice/build.gradle b/orbotservice/build.gradle
index 8606d49d..fb9b6946 100644
--- a/orbotservice/build.gradle
+++ b/orbotservice/build.gradle
@@ -27,7 +27,7 @@ android {
 
 dependencies {
     implementation project(':jsocksAndroid')
-    implementation 'org.torproject:tor-android-binary:0.3.4.8-2'
+    implementation 'org.torproject:tor-android-binary:0.3.4.9'
     implementation 'com.android.support:appcompat-v7:27.1.1'
     implementation 'com.jrummyapps:android-shell:1.0.1'
     implementation fileTree(dir: 'libs', include: ['.so'])



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits