mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-16 12:49:48 +00:00
Support API 16 (Android 4.1)
Because why not
This commit is contained in:
@@ -100,9 +100,13 @@ public class LocaleManager {
|
||||
}
|
||||
|
||||
public static Context getLocaleContext(Context context, Locale locale) {
|
||||
Configuration config = new Configuration(context.getResources().getConfiguration());
|
||||
config.setLocale(locale);
|
||||
return context.createConfigurationContext(config);
|
||||
if (Build.VERSION.SDK_INT >= 17) {
|
||||
Configuration config = new Configuration(context.getResources().getConfiguration());
|
||||
config.setLocale(locale);
|
||||
return context.createConfigurationContext(config);
|
||||
} else {
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
public static Context getLocaleContext(Locale locale) {
|
||||
@@ -114,6 +118,8 @@ public class LocaleManager {
|
||||
}
|
||||
|
||||
public static void loadAvailableLocales(@StringRes int compareId) {
|
||||
if (Build.VERSION.SDK_INT < 17)
|
||||
return;
|
||||
Shell.EXECUTOR.execute(() -> {
|
||||
locales = new ArrayList<>();
|
||||
HashSet<String> set = new HashSet<>();
|
||||
|
@@ -77,7 +77,7 @@ public class Utils {
|
||||
|
||||
public static String getAppLabel(ApplicationInfo info, PackageManager pm) {
|
||||
try {
|
||||
if (info.labelRes > 0) {
|
||||
if (info.labelRes > 0 && Build.VERSION.SDK_INT >= 17) {
|
||||
Resources res = pm.getResourcesForApplication(info);
|
||||
Configuration config = new Configuration();
|
||||
config.setLocale(LocaleManager.locale);
|
||||
|
Reference in New Issue
Block a user