mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 19:57:43 +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.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
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.PreferenceScreen;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -319,9 +320,10 @@ public class SettingsActivity extends BaseActivity implements Topic.Subscriber {
|
||||
CustomAlertDialog.ViewHolder vh = dialog.getViewHolder();
|
||||
Drawable fingerprint = getResources().getDrawable(R.drawable.ic_fingerprint);
|
||||
fingerprint.setBounds(0, 0, Utils.dpInPx(50), Utils.dpInPx(50));
|
||||
TypedValue tint = new TypedValue();
|
||||
requireActivity().getTheme().resolveAttribute(R.attr.imageColorTint, tint, true);
|
||||
fingerprint.setTint(tint.data);
|
||||
Resources.Theme theme = requireActivity().getTheme();
|
||||
TypedArray ta = theme.obtainStyledAttributes(new int[] {R.attr.imageColorTint});
|
||||
fingerprint.setTint(ta.getColor(0, Color.GRAY));
|
||||
ta.recycle();
|
||||
vh.messageView.setCompoundDrawables(null, null, null, fingerprint);
|
||||
vh.messageView.setCompoundDrawablePadding(Utils.dpInPx(20));
|
||||
vh.messageView.setGravity(Gravity.CENTER);
|
||||
|
Loading…
x
Reference in New Issue
Block a user