Handle vector drawables

This commit is contained in:
topjohnwu 2018-12-27 17:28:06 +08:00
parent 920b60da19
commit 1d0b87246a
10 changed files with 25 additions and 24 deletions

View File

@ -125,6 +125,7 @@ public class SuRequestActivity extends BaseActivity {
appIcon.setImageDrawable(policy.info.loadIcon(pm)); appIcon.setImageDrawable(policy.info.loadIcon(pm));
appNameView.setText(policy.appName); appNameView.setText(policy.appName);
packageNameView.setText(policy.packageName); packageNameView.setText(policy.packageName);
warning.setCompoundDrawablesRelativeWithIntrinsicBounds(getDrawable(R.drawable.ic_warning), null, null, null);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.allow_timeout, android.R.layout.simple_spinner_item); R.array.allow_timeout, android.R.layout.simple_spinner_item);

View File

@ -28,6 +28,7 @@ import android.widget.TextView;
import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.R;
import androidx.appcompat.content.res.AppCompatResources;
import butterknife.BindView; import butterknife.BindView;
/** /**
@ -54,14 +55,10 @@ public class AboutCardRow extends LinearLayout {
new AboutCardRow_ViewBinding(this, this); new AboutCardRow_ViewBinding(this, this);
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AboutCardRow, 0, 0); TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AboutCardRow, 0, 0);
String title; String title = a.getString(R.styleable.AboutCardRow_text);
Drawable icon; Drawable icon = AppCompatResources.getDrawable(context,
try { a.getResourceId(R.styleable.AboutCardRow_icon, R.drawable.ic_magisk));
title = a.getString(R.styleable.AboutCardRow_text); a.recycle();
icon = a.getDrawable(R.styleable.AboutCardRow_icon);
} finally {
a.recycle();
}
mTitle.setText(title); mTitle.setText(title);
mIcon.setImageDrawable(icon); mIcon.setImageDrawable(icon);
} }

View File

@ -39,10 +39,10 @@
android:padding="16dp"> android:padding="16dp">
<ImageView <ImageView
app:srcCompat="@drawable/ic_logo"
android:layout_width="72dp" android:layout_width="72dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical" />
android:src="@drawable/ic_logo"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -2,6 +2,7 @@
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/su_popup" android:id="@+id/su_popup"
tools:context=".SuRequestActivity" tools:context=".SuRequestActivity"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -82,7 +83,6 @@
android:id="@+id/warning" android:id="@+id/warning"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_warning"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:text="@string/su_warning" android:text="@string/su_warning"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
@ -121,7 +121,7 @@
android:layout_weight="1" android:layout_weight="1"
android:padding="7dp" android:padding="7dp"
android:tint="?attr/colorAccent" android:tint="?attr/colorAccent"
android:src="@drawable/ic_fingerprint" /> app:srcCompat="@drawable/ic_fingerprint" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -41,7 +41,7 @@
android:layout_height="25dp" android:layout_height="25dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toStartOf="@+id/core_only" android:layout_toStartOf="@+id/core_only"
android:src="@drawable/ic_warning"/> app:srcCompat="@drawable/ic_warning"/>
<TextView <TextView
android:id="@+id/core_only" android:id="@+id/core_only"
@ -173,7 +173,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_margin="15dp" android:layout_margin="15dp"
android:layout_toStartOf="@+id/safetyNet_status" android:layout_toStartOf="@+id/safetyNet_status"
android:src="@drawable/ic_refresh" /> app:srcCompat="@drawable/ic_refresh" />
<ProgressBar <ProgressBar
android:id="@+id/safetyNet_check_progress" android:id="@+id/safetyNet_check_progress"

View File

@ -43,7 +43,7 @@
android:layout_gravity="bottom|center_horizontal" android:layout_gravity="bottom|center_horizontal"
android:layout_margin="@dimen/fab_padding" android:layout_margin="@dimen/fab_padding"
android:elevation="6dp" android:elevation="6dp"
android:src="@drawable/ic_add" app:srcCompat="@drawable/ic_add"
tools:fabSize="normal" tools:fabSize="normal"
tools:pressedTranslationZ="12dp" /> tools:pressedTranslationZ="12dp" />

View File

@ -3,6 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="?attr/cardStyle" style="?attr/cardStyle"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -90,7 +91,6 @@
android:focusable="false" android:focusable="false"
android:gravity="center" android:gravity="center"
android:padding="@dimen/checkbox_padding" android:padding="@dimen/checkbox_padding"
android:src="@drawable/ic_menu_overflow_material"
tools:ignore="ContentDescription"/> tools:ignore="ContentDescription"/>
<ImageView <ImageView
@ -101,7 +101,7 @@
android:focusable="false" android:focusable="false"
android:gravity="center" android:gravity="center"
android:padding="@dimen/checkbox_padding" android:padding="@dimen/checkbox_padding"
android:src="@drawable/ic_delete" app:srcCompat="@drawable/ic_delete"
android:tint="@color/icon_grey" android:tint="@color/icon_grey"
tools:ignore="ContentDescription"/> tools:ignore="ContentDescription"/>

View File

@ -2,6 +2,7 @@
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="?attr/cardStyle" style="?attr/cardStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -99,7 +100,7 @@
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_notifications" app:srcCompat="@drawable/ic_notifications"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:tint="@color/icon_grey" android:tint="@color/icon_grey"
android:layout_marginEnd="10dp" /> android:layout_marginEnd="10dp" />
@ -126,7 +127,7 @@
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_bug_report" app:srcCompat="@drawable/ic_bug_report"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:tint="@color/icon_grey" android:tint="@color/icon_grey"
android:layout_marginEnd="10dp" /> android:layout_marginEnd="10dp" />
@ -147,7 +148,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_delete" app:srcCompat="@drawable/ic_delete"
android:tint="@color/icon_grey" android:tint="@color/icon_grey"
android:layout_gravity="center" /> android:layout_gravity="center" />
@ -157,7 +158,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_more" app:srcCompat="@drawable/ic_more"
android:tint="@color/icon_grey" android:tint="@color/icon_grey"
android:layout_gravity="center" /> android:layout_gravity="center" />

View File

@ -2,6 +2,7 @@
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="?attr/cardStyle" style="?attr/cardStyle"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -83,8 +84,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="@drawable/ic_file_download_black" app:srcCompat="@drawable/ic_file_download_black"
android:backgroundTint="@color/icon_grey" android:tint="@color/icon_grey"
android:clickable="true" android:clickable="true"
android:foreground="?android:attr/selectableItemBackground" android:foreground="?android:attr/selectableItemBackground"
android:focusable="false" android:focusable="false"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
@ -13,7 +14,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="25dp" android:layout_height="25dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:src="@drawable/ic_arrow" /> app:srcCompat="@drawable/ic_arrow" />
<TextView <TextView
android:id="@+id/date" android:id="@+id/date"