From 9a9b0713395fd4b6bbe6d9959f6ddbed8e086eed Mon Sep 17 00:00:00 2001 From: Maurice Lam Date: Wed, 27 Apr 2016 18:24:03 -0700 Subject: [PATCH] [SuwLib] Move mutate into TintedDrawable Move mutate() into TintedDrawable to prevent it from being called multiple times, which causes the drawable to disappear on KitKat. Bug: 28391968 Change-Id: Ib1a839344c7cb20f7bde3f21b877a0296391bc52 --- .../view/NavigationBarButton.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/library/eclair-mr1/src/com/android/setupwizardlib/view/NavigationBarButton.java b/library/eclair-mr1/src/com/android/setupwizardlib/view/NavigationBarButton.java index 1ffc034..6e555a1 100644 --- a/library/eclair-mr1/src/com/android/setupwizardlib/view/NavigationBarButton.java +++ b/library/eclair-mr1/src/com/android/setupwizardlib/view/NavigationBarButton.java @@ -44,7 +44,7 @@ public class NavigationBarButton extends Button { Drawable[] drawables = getCompoundDrawablesRelative(); for (int i = 0; i < drawables.length; i++) { if (drawables[i] != null) { - drawables[i] = TintedDrawable.wrap(drawables[i].mutate()); + drawables[i] = TintedDrawable.wrap(drawables[i]); } } setCompoundDrawablesRelativeWithIntrinsicBounds(drawables[0], drawables[1], @@ -54,10 +54,10 @@ public class NavigationBarButton extends Button { @Override public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) { - if (left != null) left = TintedDrawable.wrap(left.mutate()); - if (top != null) top = TintedDrawable.wrap(top.mutate()); - if (right != null) right = TintedDrawable.wrap(right.mutate()); - if (bottom != null) bottom = TintedDrawable.wrap(bottom.mutate()); + if (left != null) left = TintedDrawable.wrap(left); + if (top != null) top = TintedDrawable.wrap(top); + if (right != null) right = TintedDrawable.wrap(right); + if (bottom != null) bottom = TintedDrawable.wrap(bottom); super.setCompoundDrawables(left, top, right, bottom); tintDrawables(); } @@ -65,10 +65,10 @@ public class NavigationBarButton extends Button { @Override public void setCompoundDrawablesRelative(Drawable start, Drawable top, Drawable end, Drawable bottom) { - if (start != null) start = TintedDrawable.wrap(start.mutate()); - if (top != null) top = TintedDrawable.wrap(top.mutate()); - if (end != null) end = TintedDrawable.wrap(end.mutate()); - if (bottom != null) bottom = TintedDrawable.wrap(bottom.mutate()); + if (start != null) start = TintedDrawable.wrap(start); + if (top != null) top = TintedDrawable.wrap(top); + if (end != null) end = TintedDrawable.wrap(end); + if (bottom != null) bottom = TintedDrawable.wrap(bottom); super.setCompoundDrawablesRelative(start, top, end, bottom); tintDrawables(); } @@ -114,7 +114,7 @@ public class NavigationBarButton extends Button { if (drawable instanceof TintedDrawable) { return (TintedDrawable) drawable; } - return new TintedDrawable(drawable); + return new TintedDrawable(drawable.mutate()); } private ColorStateList mTintList = null;