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));
appNameView.setText(policy.appName);
packageNameView.setText(policy.packageName);
warning.setCompoundDrawablesRelativeWithIntrinsicBounds(getDrawable(R.drawable.ic_warning), null, null, null);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
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 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 {
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);
}

View File

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

View File

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

View File

@ -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"/>
<TextView
android:id="@+id/core_only"
@ -173,7 +173,7 @@
android:layout_centerVertical="true"
android:layout_margin="15dp"
android:layout_toStartOf="@+id/safetyNet_status"
android:src="@drawable/ic_refresh" />
app:srcCompat="@drawable/ic_refresh" />
<ProgressBar
android:id="@+id/safetyNet_check_progress"

View File

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

View File

@ -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"/>
<ImageView
@ -101,7 +101,7 @@
android:focusable="false"
android:gravity="center"
android:padding="@dimen/checkbox_padding"
android:src="@drawable/ic_delete"
app:srcCompat="@drawable/ic_delete"
android:tint="@color/icon_grey"
tools:ignore="ContentDescription"/>

View File

@ -2,6 +2,7 @@
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="?attr/cardStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -99,7 +100,7 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_notifications"
app:srcCompat="@drawable/ic_notifications"
android:layout_gravity="center_vertical"
android:tint="@color/icon_grey"
android:layout_marginEnd="10dp" />
@ -126,7 +127,7 @@
<ImageView
android:layout_width="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:tint="@color/icon_grey"
android:layout_marginEnd="10dp" />
@ -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" />

View File

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

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<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_height="wrap_content"
android:background="?attr/selectableItemBackground"
@ -13,7 +14,7 @@
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginEnd="10dp"
android:src="@drawable/ic_arrow" />
app:srcCompat="@drawable/ic_arrow" />
<TextView
android:id="@+id/date"