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
@@ -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);
@@ -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);
}