Skip to content
Snippets Groups Projects
Commit 4a6ff4ad authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Geoffrey Métais
Browse files

Request the locale settings outside of the main thread

parent 70f5de75
No related branches found
No related tags found
1 merge request!69Fix locale settings
Pipeline #6183 passed with stage
in 3 minutes and 51 seconds
......@@ -76,15 +76,22 @@ 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() {
locale = Settings.INSTANCE.getInstance(instance).getString("set_locale", "");
WorkersKt.runOnMainThread(new Runnable() {
@Override
public void run() {
// 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)
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment