Fix #642 & #643 - Wrong Country

This commit is contained in:
stom79 2018-12-16 17:26:19 +01:00
parent c03489b0da
commit 62ce2950c6
1 changed files with 13 additions and 9 deletions

View File

@ -53,15 +53,19 @@ public class MainApplication extends MultiDexApplication {
try {
List<Locale> SUPPORTED_LOCALES = new ArrayList<>();
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
String defaultLocaleString = sharedpreferences.getString(Helper.SET_DEFAULT_LOCALE_NEW, Helper.getDefaultLocale());
Locale defaultLocale;
if( defaultLocaleString.equals("zh-CN"))
defaultLocale = Locale.SIMPLIFIED_CHINESE;
else if( defaultLocaleString.equals("zh-TW"))
defaultLocale = Locale.TRADITIONAL_CHINESE;
else
defaultLocale = new Locale(defaultLocaleString);
SUPPORTED_LOCALES.add(defaultLocale);
String defaultLocaleString = sharedpreferences.getString(Helper.SET_DEFAULT_LOCALE_NEW, null);
if( defaultLocaleString != null){
Locale defaultLocale;
if( defaultLocaleString.equals("zh-CN"))
defaultLocale = Locale.SIMPLIFIED_CHINESE;
else if( defaultLocaleString.equals("zh-TW"))
defaultLocale = Locale.TRADITIONAL_CHINESE;
else
defaultLocale = new Locale(defaultLocaleString);
SUPPORTED_LOCALES.add(defaultLocale);
}else {
SUPPORTED_LOCALES.add(Locale.getDefault());
}
LocaleChanger.initialize(getApplicationContext(), SUPPORTED_LOCALES);
}catch (Exception ignored){ignored.printStackTrace();}
Toasty.Config.getInstance().apply();