[Android] Make the locale change synchronous at app start

Nicolas Pomepuy git at videolan.org
Thu Apr 11 18:23:53 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Thu Apr 11 08:14:51 2019 +0200| [cd3b12508a93d6aa9ab44cbe30f7b61701fe7009] | committer: Geoffrey Métais

Make the locale change synchronous at app start

> https://code.videolan.org/videolan/vlc-android/commit/cd3b12508a93d6aa9ab44cbe30f7b61701fe7009
---

 vlc-android/src/org/videolan/vlc/VLCApplication.java | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 749c06807..fc7ccb0d6 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -38,7 +38,6 @@ import org.videolan.vlc.gui.helpers.AudioUtil;
 import org.videolan.vlc.gui.helpers.BitmapCache;
 import org.videolan.vlc.gui.helpers.NotificationHelper;
 import org.videolan.vlc.util.Settings;
-import org.videolan.vlc.util.Strings;
 import org.videolan.vlc.util.Util;
 import org.videolan.vlc.util.VLCInstance;
 import org.videolan.vlc.util.WorkersKt;
@@ -77,19 +76,14 @@ public class VLCApplication extends Application {
     @Override
     public void onCreate() {
         super.onCreate();
+        locale = Settings.INSTANCE.getInstance(instance).getString("set_locale", "");
+
+        // Set the locale for API < 24 and set application resources and direction for API >=24
+        setLocale(getAppContext());
         //Initiate Kotlinx Dispatchers in a thread to prevent ANR
         new Thread(new Runnable() {
             @Override
             public void run() {
-                WorkersKt.runIO(new Runnable() {
-                    @Override
-                    public void run() {
-                        locale = Settings.INSTANCE.getInstance(instance).getString("set_locale", "");
-
-                        // Set the locale for API < 24 and set application resources and direction for API >=24
-                        setLocale(getAppContext());
-                    }
-                });
 
                 WorkersKt.runIO(new Runnable() {
                     @TargetApi(Build.VERSION_CODES.O)



More information about the Android mailing list