From 1d0b87246afd5214a9c6c1e7bb0a76bcbb5048c8 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 27 Dec 2018 17:28:06 +0800 Subject: [PATCH] Handle vector drawables --- .../com/topjohnwu/magisk/SuRequestActivity.java | 1 + .../topjohnwu/magisk/components/AboutCardRow.java | 13 +++++-------- app/src/full/res/layout/activity_about.xml | 4 ++-- app/src/full/res/layout/activity_request.xml | 4 ++-- app/src/full/res/layout/fragment_magisk.xml | 4 ++-- app/src/full/res/layout/fragment_modules.xml | 2 +- app/src/full/res/layout/list_item_module.xml | 4 ++-- app/src/full/res/layout/list_item_policy.xml | 9 +++++---- app/src/full/res/layout/list_item_repo.xml | 5 +++-- app/src/full/res/layout/list_item_sulog_group.xml | 3 ++- 10 files changed, 25 insertions(+), 24 deletions(-) diff --git a/app/src/full/java/com/topjohnwu/magisk/SuRequestActivity.java b/app/src/full/java/com/topjohnwu/magisk/SuRequestActivity.java index e6f4bb699..04889186a 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SuRequestActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/SuRequestActivity.java @@ -125,6 +125,7 @@ public class SuRequestActivity extends BaseActivity { appIcon.setImageDrawable(policy.info.loadIcon(pm)); appNameView.setText(policy.appName); packageNameView.setText(policy.packageName); + warning.setCompoundDrawablesRelativeWithIntrinsicBounds(getDrawable(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/components/AboutCardRow.java b/app/src/full/java/com/topjohnwu/magisk/components/AboutCardRow.java index 7916237bc..8c9b3701c 100644 --- a/app/src/full/java/com/topjohnwu/magisk/components/AboutCardRow.java +++ b/app/src/full/java/com/topjohnwu/magisk/components/AboutCardRow.java @@ -28,6 +28,7 @@ import android.widget.TextView; import com.topjohnwu.magisk.R; +import androidx.appcompat.content.res.AppCompatResources; import butterknife.BindView; /** @@ -54,14 +55,10 @@ public class AboutCardRow extends LinearLayout { new AboutCardRow_ViewBinding(this, this); TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AboutCardRow, 0, 0); - String title; - Drawable icon; - try { - title = a.getString(R.styleable.AboutCardRow_text); - icon = a.getDrawable(R.styleable.AboutCardRow_icon); - } finally { - a.recycle(); - } + String title = a.getString(R.styleable.AboutCardRow_text); + Drawable icon = AppCompatResources.getDrawable(context, + a.getResourceId(R.styleable.AboutCardRow_icon, R.drawable.ic_magisk)); + a.recycle(); mTitle.setText(title); mIcon.setImageDrawable(icon); } diff --git a/app/src/full/res/layout/activity_about.xml b/app/src/full/res/layout/activity_about.xml index 1957b1e36..aeba3daf3 100644 --- a/app/src/full/res/layout/activity_about.xml +++ b/app/src/full/res/layout/activity_about.xml @@ -39,10 +39,10 @@ android:padding="16dp"> + android:layout_gravity="center_vertical" /> + app:srcCompat="@drawable/ic_fingerprint" /> diff --git a/app/src/full/res/layout/fragment_magisk.xml b/app/src/full/res/layout/fragment_magisk.xml index 837578232..8ba723094 100644 --- a/app/src/full/res/layout/fragment_magisk.xml +++ b/app/src/full/res/layout/fragment_magisk.xml @@ -41,7 +41,7 @@ android:layout_height="25dp" android:layout_centerVertical="true" android:layout_toStartOf="@+id/core_only" - android:src="@drawable/ic_warning"/> + app:srcCompat="@drawable/ic_warning"/> + app:srcCompat="@drawable/ic_refresh" /> diff --git a/app/src/full/res/layout/list_item_module.xml b/app/src/full/res/layout/list_item_module.xml index c79b576c5..86507bbab 100644 --- a/app/src/full/res/layout/list_item_module.xml +++ b/app/src/full/res/layout/list_item_module.xml @@ -3,6 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" style="?attr/cardStyle" android:layout_width="fill_parent" android:layout_height="wrap_content" @@ -90,7 +91,6 @@ android:focusable="false" android:gravity="center" android:padding="@dimen/checkbox_padding" - android:src="@drawable/ic_menu_overflow_material" tools:ignore="ContentDescription"/> diff --git a/app/src/full/res/layout/list_item_policy.xml b/app/src/full/res/layout/list_item_policy.xml index 685f1fa17..b289b1459 100644 --- a/app/src/full/res/layout/list_item_policy.xml +++ b/app/src/full/res/layout/list_item_policy.xml @@ -2,6 +2,7 @@ @@ -126,7 +127,7 @@ @@ -147,7 +148,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:background="?android:attr/selectableItemBackground" - android:src="@drawable/ic_delete" + app:srcCompat="@drawable/ic_delete" android:tint="@color/icon_grey" android:layout_gravity="center" /> @@ -157,7 +158,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:background="?android:attr/selectableItemBackground" - android:src="@drawable/ic_more" + app:srcCompat="@drawable/ic_more" android:tint="@color/icon_grey" android:layout_gravity="center" /> diff --git a/app/src/full/res/layout/list_item_repo.xml b/app/src/full/res/layout/list_item_repo.xml index 4ebc51fbd..7c1a0ee41 100644 --- a/app/src/full/res/layout/list_item_repo.xml +++ b/app/src/full/res/layout/list_item_repo.xml @@ -2,6 +2,7 @@ + app:srcCompat="@drawable/ic_arrow" />