Update DrawableWrapper to DrawableWrapperCompat am: b1401d612f am: 9cd6eea905 am: 164064c1c4
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Messaging/+/2200597 Change-Id: I06cf3ed171327507e082b6aebe6ffe31bceccdaa Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -21,7 +21,7 @@ import android.content.res.ColorStateList;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import androidx.appcompat.graphics.drawable.DrawableWrapper;
|
import androidx.appcompat.graphics.drawable.DrawableWrapperCompat;
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
|
||||||
@@ -53,8 +53,8 @@ public class SwitchCompatUtils {
|
|||||||
private static Drawable getColorTintedDrawable(Drawable oldDrawable,
|
private static Drawable getColorTintedDrawable(Drawable oldDrawable,
|
||||||
final ColorStateList colorStateList, final PorterDuff.Mode mode) {
|
final ColorStateList colorStateList, final PorterDuff.Mode mode) {
|
||||||
final int[] thumbState = oldDrawable.isStateful() ? oldDrawable.getState() : null;
|
final int[] thumbState = oldDrawable.isStateful() ? oldDrawable.getState() : null;
|
||||||
if (oldDrawable instanceof DrawableWrapper) {
|
if (oldDrawable instanceof DrawableWrapperCompat) {
|
||||||
oldDrawable = ((DrawableWrapper) oldDrawable).getWrappedDrawable();
|
oldDrawable = ((DrawableWrapperCompat) oldDrawable).getDrawable();
|
||||||
}
|
}
|
||||||
final Drawable newDrawable = new TintDrawableWrapper(oldDrawable, colorStateList, mode);
|
final Drawable newDrawable = new TintDrawableWrapper(oldDrawable, colorStateList, mode);
|
||||||
if (thumbState != null) {
|
if (thumbState != null) {
|
||||||
|
|||||||
@@ -20,16 +20,16 @@ import android.content.res.ColorStateList;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import androidx.appcompat.graphics.drawable.DrawableWrapper;
|
import androidx.appcompat.graphics.drawable.DrawableWrapperCompat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is directly copied from v7/appcompat/src/androidx.appcompat.internal/widget/TintManager.java
|
* This is directly copied from v7/appcompat/src/androidx.appcompat.internal/widget/TintManager.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link DrawableWrapper} which updates it's color filter using a {@link ColorStateList}.
|
* A {@link DrawableWrapperCompat} which updates it's color filter using a {@link ColorStateList}.
|
||||||
*/
|
*/
|
||||||
class TintDrawableWrapper extends DrawableWrapper {
|
class TintDrawableWrapper extends DrawableWrapperCompat {
|
||||||
private final ColorStateList mTintStateList;
|
private final ColorStateList mTintStateList;
|
||||||
private final PorterDuff.Mode mTintMode;
|
private final PorterDuff.Mode mTintMode;
|
||||||
private int mCurrentColor;
|
private int mCurrentColor;
|
||||||
|
|||||||
Reference in New Issue
Block a user