From c137f2de4f4e79c0e2346a024f6e09f0a1ddb70e Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 12 Feb 2019 16:58:05 -0500 Subject: [PATCH] Remove SDK 16 support completely Android 4.1 init miss several significant features Magisk reply on, so the final decision is to forget about it in the future. Pull minSdkVersion of Magisk Manager back to 17 and remove some unnecessary adjustments done for SDK 16 --- .../topjohnwu/magisk/utils/LocaleManager.java | 12 ++----- .../com/topjohnwu/magisk/utils/Utils.java | 2 +- .../topjohnwu/magisk/SuRequestActivity.java | 9 ++--- .../magisk/adapters/StringListAdapter.java | 2 +- .../magisk/fragments/SettingsFragment.java | 4 --- app/src/full/res/layout/activity_flash.xml | 4 +-- app/src/full/res/layout/activity_request.xml | 10 +++--- app/src/full/res/layout/alert_dialog.xml | 4 +-- .../full/res/layout/custom_channel_dialog.xml | 4 +-- app/src/full/res/layout/fragment_magisk.xml | 34 ++++++++----------- .../full/res/layout/fragment_magisk_hide.xml | 13 ++++--- .../full/res/layout/fragment_magisk_log.xml | 3 +- app/src/full/res/layout/fragment_modules.xml | 9 +++-- app/src/full/res/layout/fragment_repos.xml | 8 ++--- app/src/full/res/layout/fragment_su_log.xml | 4 +-- .../full/res/layout/fragment_superuser.xml | 7 ++-- app/src/full/res/layout/list_item_app.xml | 8 ++--- app/src/full/res/layout/list_item_module.xml | 6 ++-- app/src/full/res/layout/list_item_policy.xml | 11 ++---- app/src/full/res/layout/list_item_repo.xml | 5 ++- app/src/full/res/layout/list_item_sulog.xml | 4 +-- .../full/res/layout/list_item_sulog_group.xml | 1 - app/src/full/res/layout/markdown_window.xml | 4 +-- app/src/full/res/layout/section.xml | 1 - app/src/full/res/layout/update_card.xml | 8 ++--- build.gradle | 2 +- 26 files changed, 65 insertions(+), 114 deletions(-) diff --git a/app-core/src/main/java/com/topjohnwu/magisk/utils/LocaleManager.java b/app-core/src/main/java/com/topjohnwu/magisk/utils/LocaleManager.java index 39535fff7..3b0d4a3b6 100644 --- a/app-core/src/main/java/com/topjohnwu/magisk/utils/LocaleManager.java +++ b/app-core/src/main/java/com/topjohnwu/magisk/utils/LocaleManager.java @@ -100,13 +100,9 @@ public class LocaleManager { } public static Context getLocaleContext(Context context, Locale locale) { - if (Build.VERSION.SDK_INT >= 17) { - Configuration config = new Configuration(context.getResources().getConfiguration()); - config.setLocale(locale); - return context.createConfigurationContext(config); - } else { - return context; - } + Configuration config = new Configuration(context.getResources().getConfiguration()); + config.setLocale(locale); + return context.createConfigurationContext(config); } public static Context getLocaleContext(Locale locale) { @@ -118,8 +114,6 @@ public class LocaleManager { } public static void loadAvailableLocales(@StringRes int compareId) { - if (Build.VERSION.SDK_INT < 17) - return; Shell.EXECUTOR.execute(() -> { locales = new ArrayList<>(); HashSet set = new HashSet<>(); diff --git a/app-core/src/main/java/com/topjohnwu/magisk/utils/Utils.java b/app-core/src/main/java/com/topjohnwu/magisk/utils/Utils.java index 23a47f641..d2cb23f54 100644 --- a/app-core/src/main/java/com/topjohnwu/magisk/utils/Utils.java +++ b/app-core/src/main/java/com/topjohnwu/magisk/utils/Utils.java @@ -77,7 +77,7 @@ public class Utils { public static String getAppLabel(ApplicationInfo info, PackageManager pm) { try { - if (info.labelRes > 0 && Build.VERSION.SDK_INT >= 17) { + if (info.labelRes > 0) { Resources res = pm.getResourcesForApplication(info); Configuration config = new Configuration(); config.setLocale(LocaleManager.locale); diff --git a/app/src/full/java/com/topjohnwu/magisk/SuRequestActivity.java b/app/src/full/java/com/topjohnwu/magisk/SuRequestActivity.java index 52cfec56e..260b9c518 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SuRequestActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/SuRequestActivity.java @@ -129,13 +129,8 @@ public class SuRequestActivity extends BaseActivity { appIcon.setImageDrawable(policy.info.loadIcon(pm)); appNameView.setText(policy.appName); packageNameView.setText(policy.packageName); - if (Build.VERSION.SDK_INT >= 17) { - warning.setCompoundDrawablesRelativeWithIntrinsicBounds( - AppCompatResources.getDrawable(this, R.drawable.ic_warning), null, null, null); - } else { - warning.setCompoundDrawablesWithIntrinsicBounds( - AppCompatResources.getDrawable(this, R.drawable.ic_warning), null, null, null); - } + warning.setCompoundDrawablesRelativeWithIntrinsicBounds( + AppCompatResources.getDrawable(this, R.drawable.ic_warning), null, null, null); ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.allow_timeout, android.R.layout.simple_spinner_item); diff --git a/app/src/full/java/com/topjohnwu/magisk/adapters/StringListAdapter.java b/app/src/full/java/com/topjohnwu/magisk/adapters/StringListAdapter.java index b2cd680e0..0aacad2e8 100644 --- a/app/src/full/java/com/topjohnwu/magisk/adapters/StringListAdapter.java +++ b/app/src/full/java/com/topjohnwu/magisk/adapters/StringListAdapter.java @@ -73,7 +73,7 @@ public abstract class StringListAdapter ((Activity) rv.getContext()).getWindowManager() .getDefaultDisplay().getMetrics(displayMetrics); screenWidth = displayMetrics.widthPixels; - padding = rv.getPaddingLeft() + rv.getPaddingRight(); + padding = rv.getPaddingStart() + rv.getPaddingEnd(); this.rv = rv; } diff --git a/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java index fe502e414..c709c8764 100644 --- a/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java @@ -111,10 +111,6 @@ public class SettingsFragment extends BasePreferenceFragment implements Topic.Su setSummary(); - // Remove language setting when API < 17 - if (Build.VERSION.SDK_INT < 17) - generalCatagory.removePreference(findPreference(Config.Key.LOCALE)); - // Disable dangerous settings in secondary user if (Const.USER_ID > 0) { suCategory.removePreference(multiuserConfig); diff --git a/app/src/full/res/layout/activity_flash.xml b/app/src/full/res/layout/activity_flash.xml index 5a8e2eb68..0bc141964 100644 --- a/app/src/full/res/layout/activity_flash.xml +++ b/app/src/full/res/layout/activity_flash.xml @@ -17,8 +17,8 @@ android:id="@+id/recyclerView" android:layout_width="wrap_content" android:layout_height="match_parent" - android:paddingLeft="8dp" - android:paddingRight="8dp" + android:paddingStart="8dp" + android:paddingEnd="8dp" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> diff --git a/app/src/full/res/layout/activity_request.xml b/app/src/full/res/layout/activity_request.xml index b0efb9d26..7d4b6eaa5 100644 --- a/app/src/full/res/layout/activity_request.xml +++ b/app/src/full/res/layout/activity_request.xml @@ -27,8 +27,8 @@ android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:orientation="horizontal" - android:paddingLeft="10dp" - android:paddingRight="10dp"> + android:paddingStart="10dp" + android:paddingEnd="10dp"> + android:paddingStart="30dp" + android:paddingEnd="30dp">