mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Use TextViewCompat.setCompoundDrawableTintList().
This commit is contained in:
		| @@ -5,7 +5,7 @@ import static org.schabi.newpipe.player.notification.NotificationConstants.ACTIO | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
| import android.content.SharedPreferences; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.util.AttributeSet; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| @@ -21,7 +21,7 @@ import androidx.annotation.NonNull; | ||||
| import androidx.annotation.Nullable; | ||||
| import androidx.appcompat.app.AlertDialog; | ||||
| import androidx.appcompat.content.res.AppCompatResources; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.widget.TextViewCompat; | ||||
| import androidx.preference.Preference; | ||||
| import androidx.preference.PreferenceViewHolder; | ||||
|  | ||||
| @@ -214,17 +214,13 @@ public class NotificationActionsPreference extends Preference { | ||||
|                         .getRoot(); | ||||
|  | ||||
|                 // if present set action icon with correct color | ||||
|                 if (NotificationConstants.ACTION_ICONS[action] != 0) { | ||||
|                     Drawable drawable = AppCompatResources.getDrawable(getContext(), | ||||
|                             NotificationConstants.ACTION_ICONS[action]); | ||||
|                     if (drawable != null) { | ||||
|                         final int color = ThemeHelper.resolveColorFromAttr(getContext(), | ||||
|                                 android.R.attr.textColorPrimary); | ||||
|                         drawable = DrawableCompat.wrap(drawable).mutate(); | ||||
|                         drawable.setTint(color); | ||||
|                         radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(null, | ||||
|                                 null, drawable, null); | ||||
|                     } | ||||
|                 final int iconId = NotificationConstants.ACTION_ICONS[action]; | ||||
|                 if (iconId != 0) { | ||||
|                     radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, iconId, 0); | ||||
|  | ||||
|                     final var color = ColorStateList.valueOf(ThemeHelper | ||||
|                             .resolveColorFromAttr(getContext(), android.R.attr.textColorPrimary)); | ||||
|                     TextViewCompat.setCompoundDrawableTintList(radioButton, color); | ||||
|                 } | ||||
|  | ||||
|                 radioButton.setText(NotificationConstants.getActionName(getContext(), action)); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Isira Seneviratne
					Isira Seneviratne