mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 21:40:15 -07:00
Changes
- [Custom controls] Fix special buttons index. - [Language changer] change behavior
This commit is contained in:
parent
dd6d080b4e
commit
9e71ff6aaa
6 changed files with 80 additions and 48 deletions
31
app/src/main/java/net/kdt/pojavlaunch/utils/LocaleUtils.java
Normal file
31
app/src/main/java/net/kdt/pojavlaunch/utils/LocaleUtils.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package net.kdt.pojavlaunch.utils;
|
||||
|
||||
import android.content.*;
|
||||
import android.content.res.*;
|
||||
import android.support.v7.preference.*;
|
||||
import java.util.*;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
|
||||
public class LocaleUtils {
|
||||
public static final Locale DEFAULT_LOCALE;
|
||||
|
||||
static {
|
||||
DEFAULT_LOCALE = Locale.getDefault();
|
||||
}
|
||||
|
||||
public static Context setLocale(Context context) {
|
||||
if (LauncherPreferences.DEFAULT_PREF == null) {
|
||||
LauncherPreferences.DEFAULT_PREF = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
LauncherPreferences.loadPreferences();
|
||||
}
|
||||
|
||||
Locale locale = new Locale(LauncherPreferences.PREF_LANGUAGE);
|
||||
Locale.setDefault(locale);
|
||||
|
||||
Resources res = context.getResources();
|
||||
Configuration config = new Configuration(res.getConfiguration());
|
||||
config.setLocale(locale);
|
||||
context = context.createConfigurationContext(config);
|
||||
return context;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue