Loading graphics/java/android/graphics/drawable/ColorDrawable.java +5 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,11 @@ public class ColorDrawable extends Drawable { state.mUseColor = state.mBaseColor; } @Override public boolean canApplyTheme() { return mColorState.canApplyTheme() || super.canApplyTheme(); } @Override public void applyTheme(Theme t) { super.applyTheme(t); Loading graphics/java/android/graphics/drawable/DrawableContainer.java +48 −30 Original line number Diff line number Diff line Loading @@ -447,12 +447,48 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { mCurrDrawable = d; mCurIndex = idx; if (d != null) { d.mutate(); if (mDrawableContainerState.mEnterFadeDuration > 0) { mEnterAnimationEnd = now + mDrawableContainerState.mEnterFadeDuration; } else if (mHasAlpha) { } initializeDrawableForDisplay(d); } } else { mCurrDrawable = null; mCurIndex = -1; } if (mEnterAnimationEnd != 0 || mExitAnimationEnd != 0) { if (mAnimationRunnable == null) { mAnimationRunnable = new Runnable() { @Override public void run() { animate(true); invalidateSelf(); } }; } else { unscheduleSelf(mAnimationRunnable); } // Compute first frame and schedule next animation. animate(true); } invalidateSelf(); return true; } /** * Initializes a drawable for display in this container. * * @param d The drawable to initialize. */ private void initializeDrawableForDisplay(Drawable d) { d.mutate(); if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) { d.setAlpha(mAlpha); } if (mDrawableContainerState.mHasColorFilter) { // Color filter always overrides tint. d.setColorFilter(mDrawableContainerState.mColorFilter); Loading @@ -464,6 +500,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { d.setTintMode(mDrawableContainerState.mTintMode); } } d.setVisible(isVisible(), true); d.setDither(mDrawableContainerState.mDither); d.setState(getState()); Loading @@ -478,30 +515,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { hotspotBounds.right, hotspotBounds.bottom); } } } else { mCurrDrawable = null; mCurIndex = -1; } if (mEnterAnimationEnd != 0 || mExitAnimationEnd != 0) { if (mAnimationRunnable == null) { mAnimationRunnable = new Runnable() { @Override public void run() { animate(true); invalidateSelf(); } }; } else { unscheduleSelf(mAnimationRunnable); } // Compute first frame and schedule next animation. animate(true); } invalidateSelf(); return true; } void animate(boolean schedule) { mHasAlpha = true; Loading Loading @@ -1136,9 +1149,14 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { // The locally cached drawables may have changed. if (mCurIndex >= 0) { mCurrDrawable = state.getChild(mCurIndex); if (mCurrDrawable != null) { initializeDrawableForDisplay(mCurrDrawable); } if (mLastIndex >= 0) { mLastDrawable = state.getChild(mLastIndex); } // Clear out the last drawable. We don't have enough information to // propagate local state from the past. mLastIndex = -1; mLastDrawable = null; } } Loading
graphics/java/android/graphics/drawable/ColorDrawable.java +5 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,11 @@ public class ColorDrawable extends Drawable { state.mUseColor = state.mBaseColor; } @Override public boolean canApplyTheme() { return mColorState.canApplyTheme() || super.canApplyTheme(); } @Override public void applyTheme(Theme t) { super.applyTheme(t); Loading
graphics/java/android/graphics/drawable/DrawableContainer.java +48 −30 Original line number Diff line number Diff line Loading @@ -447,12 +447,48 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { mCurrDrawable = d; mCurIndex = idx; if (d != null) { d.mutate(); if (mDrawableContainerState.mEnterFadeDuration > 0) { mEnterAnimationEnd = now + mDrawableContainerState.mEnterFadeDuration; } else if (mHasAlpha) { } initializeDrawableForDisplay(d); } } else { mCurrDrawable = null; mCurIndex = -1; } if (mEnterAnimationEnd != 0 || mExitAnimationEnd != 0) { if (mAnimationRunnable == null) { mAnimationRunnable = new Runnable() { @Override public void run() { animate(true); invalidateSelf(); } }; } else { unscheduleSelf(mAnimationRunnable); } // Compute first frame and schedule next animation. animate(true); } invalidateSelf(); return true; } /** * Initializes a drawable for display in this container. * * @param d The drawable to initialize. */ private void initializeDrawableForDisplay(Drawable d) { d.mutate(); if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) { d.setAlpha(mAlpha); } if (mDrawableContainerState.mHasColorFilter) { // Color filter always overrides tint. d.setColorFilter(mDrawableContainerState.mColorFilter); Loading @@ -464,6 +500,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { d.setTintMode(mDrawableContainerState.mTintMode); } } d.setVisible(isVisible(), true); d.setDither(mDrawableContainerState.mDither); d.setState(getState()); Loading @@ -478,30 +515,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { hotspotBounds.right, hotspotBounds.bottom); } } } else { mCurrDrawable = null; mCurIndex = -1; } if (mEnterAnimationEnd != 0 || mExitAnimationEnd != 0) { if (mAnimationRunnable == null) { mAnimationRunnable = new Runnable() { @Override public void run() { animate(true); invalidateSelf(); } }; } else { unscheduleSelf(mAnimationRunnable); } // Compute first frame and schedule next animation. animate(true); } invalidateSelf(); return true; } void animate(boolean schedule) { mHasAlpha = true; Loading Loading @@ -1136,9 +1149,14 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { // The locally cached drawables may have changed. if (mCurIndex >= 0) { mCurrDrawable = state.getChild(mCurIndex); if (mCurrDrawable != null) { initializeDrawableForDisplay(mCurrDrawable); } if (mLastIndex >= 0) { mLastDrawable = state.getChild(mLastIndex); } // Clear out the last drawable. We don't have enough information to // propagate local state from the past. mLastIndex = -1; mLastDrawable = null; } }