mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-12 02:43:36 +00:00
Properly get color from attribute
This commit is contained in:
parent
9bbfcf326c
commit
aa383e2190
@ -2,6 +2,8 @@ package com.topjohnwu.magisk;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
@ -17,7 +19,6 @@ import android.support.v7.preference.PreferenceCategory;
|
|||||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||||
import android.support.v7.preference.PreferenceScreen;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -319,9 +320,10 @@ public class SettingsActivity extends BaseActivity implements Topic.Subscriber {
|
|||||||
CustomAlertDialog.ViewHolder vh = dialog.getViewHolder();
|
CustomAlertDialog.ViewHolder vh = dialog.getViewHolder();
|
||||||
Drawable fingerprint = getResources().getDrawable(R.drawable.ic_fingerprint);
|
Drawable fingerprint = getResources().getDrawable(R.drawable.ic_fingerprint);
|
||||||
fingerprint.setBounds(0, 0, Utils.dpInPx(50), Utils.dpInPx(50));
|
fingerprint.setBounds(0, 0, Utils.dpInPx(50), Utils.dpInPx(50));
|
||||||
TypedValue tint = new TypedValue();
|
Resources.Theme theme = requireActivity().getTheme();
|
||||||
requireActivity().getTheme().resolveAttribute(R.attr.imageColorTint, tint, true);
|
TypedArray ta = theme.obtainStyledAttributes(new int[] {R.attr.imageColorTint});
|
||||||
fingerprint.setTint(tint.data);
|
fingerprint.setTint(ta.getColor(0, Color.GRAY));
|
||||||
|
ta.recycle();
|
||||||
vh.messageView.setCompoundDrawables(null, null, null, fingerprint);
|
vh.messageView.setCompoundDrawables(null, null, null, fingerprint);
|
||||||
vh.messageView.setCompoundDrawablePadding(Utils.dpInPx(20));
|
vh.messageView.setCompoundDrawablePadding(Utils.dpInPx(20));
|
||||||
vh.messageView.setGravity(Gravity.CENTER);
|
vh.messageView.setGravity(Gravity.CENTER);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user