<div dir="ltr">Looks good.<br>But if it's for Android 7+, maybe we should apply it on these devices only and spare the older ones?<br><br><div class="gmail_quote"><div dir="ltr">Le ven. 2 juin 2017 à 00:26, habib kazemi <<a href="mailto:kazemihabib1996@gmail.com">kazemihabib1996@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><a href="https://code.videolan.org/videolan/vlc-android/issues/285" rel="noreferrer" target="_blank">https://code.videolan.org/videolan/vlc-android/issues/285</a><br>
---<br>
.../src/org/videolan/vlc/VLCApplication.java | 26 +++++++++++++++-------<br>
.../src/org/videolan/vlc/gui/AboutFragment.java | 4 ++++<br>
2 files changed, 22 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java<br>
index 8973f5d93..abfba212e 100644<br>
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java<br>
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java<br>
@@ -83,13 +83,9 @@ public class VLCApplication extends Application {<br>
<br>
private static int sDialogCounter = 0;<br>
<br>
- @Override<br>
- public void onCreate() {<br>
- super.onCreate();<br>
- instance = this;<br>
-<br>
+ public static void setLocale(Context context){<br>
// Are we using advanced debugging - locale?<br>
- mSettings = PreferenceManager.getDefaultSharedPreferences(this);<br>
+ mSettings = PreferenceManager.getDefaultSharedPreferences(context);<br>
String p = mSettings.getString("set_locale", "");<br>
if (!p.equals("")) {<br>
Locale locale;<br>
@@ -115,9 +111,17 @@ public class VLCApplication extends Application {<br>
Locale.setDefault(locale);<br>
Configuration config = new Configuration();<br>
config.locale = locale;<br>
- getResources().updateConfiguration(config,<br>
- getResources().getDisplayMetrics());<br>
+ context.getResources().updateConfiguration(config,<br>
+ context.getResources().getDisplayMetrics());<br>
}<br>
+ }<br>
+<br>
+ @Override<br>
+ public void onCreate() {<br>
+ super.onCreate();<br>
+ instance = this;<br>
+<br>
+ setLocale(this);<br>
<br>
runBackground(new Runnable() {<br>
@Override<br>
@@ -138,6 +142,12 @@ public class VLCApplication extends Application {<br>
});<br>
}<br>
<br>
+ @Override<br>
+ public void onConfigurationChanged(Configuration newConfig) {<br>
+ super.onConfigurationChanged(newConfig);<br>
+ setLocale(this);<br>
+ }<br>
+<br>
/**<br>
* Called when the overall system is running low on memory<br>
*/<br>
diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java<br>
index ad9d05c68..fb1cfd3ae 100644<br>
--- a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java<br>
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java<br>
@@ -32,6 +32,7 @@ import android.webkit.WebView;<br>
<br>
import org.videolan.vlc.BuildConfig;<br>
import org.videolan.vlc.R;<br>
+import org.videolan.vlc.VLCApplication;<br>
import org.videolan.vlc.gui.audio.AudioPagerAdapter;<br>
import org.videolan.vlc.gui.helpers.UiTools;<br>
import org.videolan.vlc.util.Util;<br>
@@ -51,6 +52,9 @@ public class AboutFragment extends Fragment {<br>
if (getActivity() instanceof AppCompatActivity)<br>
((AppCompatActivity) getActivity()).getSupportActionBar().setTitle("VLC " + BuildConfig.VERSION_NAME);<br>
View v = inflater.inflate(R.layout.about, container, false);<br>
+ //Fix android 7 Locale problem with webView<br>
+ //<a href="https://stackoverflow.com/questions/40398528/android-webview-locale-changes-abruptly-on-android-n" rel="noreferrer" target="_blank">https://stackoverflow.com/questions/40398528/android-webview-locale-changes-abruptly-on-android-n</a><br>
+ VLCApplication.setLocale(getContext());<br>
<br>
View aboutMain = v.findViewById(R.id.about_main);<br>
WebView webView = (WebView)v.findViewById(R.id.webview);<br>
--<br>
2.12.2<br>
<br>
_______________________________________________<br>
Android mailing list<br>
<a href="mailto:Android@videolan.org" target="_blank">Android@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/android" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/android</a><br>
</blockquote></div></div>