Invalidate when Drawable.setState() returns true
Ensures views that manage drawables follow the contract set forth in
the Drawable.setState() documentation.
Bug: 23792020
Change-Id: I4e5a449cd6535487873fd8443da50555c38e8ed9
diff --git a/core/java/com/android/internal/widget/ViewPager.java b/core/java/com/android/internal/widget/ViewPager.java
index a2c4f6a..6217d6e 100644
--- a/core/java/com/android/internal/widget/ViewPager.java
+++ b/core/java/com/android/internal/widget/ViewPager.java
@@ -753,9 +753,10 @@
@Override
protected void drawableStateChanged() {
super.drawableStateChanged();
- final Drawable d = mMarginDrawable;
- if (d != null && d.isStateful()) {
- d.setState(getDrawableState());
+ final Drawable marginDrawable = mMarginDrawable;
+ if (marginDrawable != null && marginDrawable.isStateful()
+ && marginDrawable.setState(getDrawableState())) {
+ invalidateDrawable(marginDrawable);
}
}