Loading api/current.xml +24 −0 Original line number Diff line number Diff line Loading @@ -83600,6 +83600,17 @@ visibility="public" > </method> <method name="getColor" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getOpacity" return="int" abstract="false" Loading @@ -83624,6 +83635,19 @@ <parameter name="alpha" type="int"> </parameter> </method> <method name="setColor" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="color" type="int"> </parameter> </method> <method name="setColorFilter" return="void" abstract="false" core/java/android/animation/KeyframeSet.java +32 −17 Original line number Diff line number Diff line Loading @@ -28,12 +28,18 @@ class KeyframeSet { private int mNumKeyframes; ArrayList<Keyframe> mKeyframes; Keyframe mFirstKeyframe; Keyframe mLastKeyframe; TimeInterpolator mInterpolator; // only used in the 2-keyframe case ArrayList<Keyframe> mKeyframes; // only used when there are not 2 keyframes public KeyframeSet(Keyframe... keyframes) { mNumKeyframes = keyframes.length; mKeyframes = new ArrayList<Keyframe>(); mKeyframes.addAll(Arrays.asList(keyframes)); mNumKeyframes = mKeyframes.size(); mFirstKeyframe = mKeyframes.get(0); mLastKeyframe = mKeyframes.get(mNumKeyframes - 1); mInterpolator = mLastKeyframe.getInterpolator(); } public static KeyframeSet ofInt(int... values) { Loading Loading @@ -125,32 +131,40 @@ class KeyframeSet { * @return The animated value. */ public Object getValue(float fraction, TypeEvaluator evaluator) { // TODO: special-case 2-keyframe common case // Special-case optimization for the common case of only two keyframes if (mNumKeyframes == 2) { if (mInterpolator != null) { fraction = mInterpolator.getInterpolation(fraction); } return evaluator.evaluate(fraction, mFirstKeyframe.getValue(), mLastKeyframe.getValue()); } if (fraction <= 0f) { final Keyframe prevKeyframe = mKeyframes.get(0); final Keyframe nextKeyframe = mKeyframes.get(1); final TimeInterpolator interpolator = nextKeyframe.getInterpolator(); if (interpolator != null) { fraction = interpolator.getInterpolation(fraction); } float intervalFraction = (fraction - prevKeyframe.getFraction()) / (nextKeyframe.getFraction() - prevKeyframe.getFraction()); return evaluator.evaluate(intervalFraction, prevKeyframe.getValue(), final float prevFraction = mFirstKeyframe.getFraction(); float intervalFraction = (fraction - prevFraction) / (nextKeyframe.getFraction() - prevFraction); return evaluator.evaluate(intervalFraction, mFirstKeyframe.getValue(), nextKeyframe.getValue()); } else if (fraction >= 1f) { final Keyframe prevKeyframe = mKeyframes.get(mNumKeyframes - 2); final Keyframe nextKeyframe = mKeyframes.get(mNumKeyframes - 1); final TimeInterpolator interpolator = nextKeyframe.getInterpolator(); final TimeInterpolator interpolator = mLastKeyframe.getInterpolator(); if (interpolator != null) { fraction = interpolator.getInterpolation(fraction); } float intervalFraction = (fraction - prevKeyframe.getFraction()) / (nextKeyframe.getFraction() - prevKeyframe.getFraction()); final float prevFraction = prevKeyframe.getFraction(); float intervalFraction = (fraction - prevFraction) / (mLastKeyframe.getFraction() - prevFraction); return evaluator.evaluate(intervalFraction, prevKeyframe.getValue(), nextKeyframe.getValue()); mLastKeyframe.getValue()); } Keyframe prevKeyframe = mKeyframes.get(0); Keyframe prevKeyframe = mFirstKeyframe; for (int i = 1; i < mNumKeyframes; ++i) { Keyframe nextKeyframe = mKeyframes.get(i); if (fraction < nextKeyframe.getFraction()) { Loading @@ -158,14 +172,15 @@ class KeyframeSet { if (interpolator != null) { fraction = interpolator.getInterpolation(fraction); } float intervalFraction = (fraction - prevKeyframe.getFraction()) / (nextKeyframe.getFraction() - prevKeyframe.getFraction()); final float prevFraction = prevKeyframe.getFraction(); float intervalFraction = (fraction - prevFraction) / (nextKeyframe.getFraction() - prevFraction); return evaluator.evaluate(intervalFraction, prevKeyframe.getValue(), nextKeyframe.getValue()); } prevKeyframe = nextKeyframe; } // shouldn't get here return mKeyframes.get(mNumKeyframes - 1).getValue(); // shouldn't reach here return mLastKeyframe.getValue(); } } core/java/android/animation/ObjectAnimator.java +8 −3 Original line number Diff line number Diff line Loading @@ -376,10 +376,15 @@ public final class ObjectAnimator extends ValueAnimator { */ @Override public void setTarget(Object target) { if (mTarget != target) { mTarget = target; // New property/values/target should cause re-initialization prior to starting if (mTarget != null && target != null && mTarget.getClass() == target.getClass()) { return; } // New target type should cause re-initialization prior to starting mInitialized = false; } } @Override public void setupStartValues() { Loading core/java/android/animation/ValueAnimator.java +1 −1 Original line number Diff line number Diff line Loading @@ -1142,7 +1142,7 @@ public class ValueAnimator extends Animator { switch (mPlayingState) { case RUNNING: case SEEKED: float fraction = (float)(currentTime - mStartTime) / mDuration; float fraction = mDuration > 0 ? (float)(currentTime - mStartTime) / mDuration : 1f; if (fraction >= 1f) { if (mCurrentIteration < mRepeatCount || mRepeatCount == INFINITE) { // Time to repeat Loading core/java/android/view/View.java +14 −3 Original line number Diff line number Diff line Loading @@ -6296,8 +6296,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility if (invalidateCache) { mPrivateFlags &= ~DRAWING_CACHE_VALID; } final ViewParent p = mParent; final AttachInfo ai = mAttachInfo; final ViewParent p = mParent; if (ai != null && ai.mHardwareAccelerated) { // fast-track for GL-enabled applications; just invalidate the whole hierarchy // with a null dirty rect, which tells the ViewRoot to redraw everything p.invalidateChild(this, null); return; } if (p != null && ai != null) { final Rect r = ai.mTmpInvalRect; r.set(0, 0, mRight - mLeft, mBottom - mTop); Loading @@ -6321,7 +6327,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility */ @ViewDebug.ExportedProperty(category = "drawing") public boolean isOpaque() { return (mPrivateFlags & OPAQUE_MASK) == OPAQUE_MASK; return (mPrivateFlags & OPAQUE_MASK) == OPAQUE_MASK && (mAlpha >= 1.0f - ViewConfiguration.ALPHA_THRESHOLD); } private void computeOpaqueFlags() { Loading Loading @@ -8618,8 +8625,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility */ @RemotableViewMethod public void setBackgroundColor(int color) { if (mBGDrawable instanceof ColorDrawable) { ((ColorDrawable) mBGDrawable).setColor(color); } else { setBackgroundDrawable(new ColorDrawable(color)); } } /** * Set the background to a given resource. The resource should refer to Loading Loading
api/current.xml +24 −0 Original line number Diff line number Diff line Loading @@ -83600,6 +83600,17 @@ visibility="public" > </method> <method name="getColor" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getOpacity" return="int" abstract="false" Loading @@ -83624,6 +83635,19 @@ <parameter name="alpha" type="int"> </parameter> </method> <method name="setColor" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="color" type="int"> </parameter> </method> <method name="setColorFilter" return="void" abstract="false"
core/java/android/animation/KeyframeSet.java +32 −17 Original line number Diff line number Diff line Loading @@ -28,12 +28,18 @@ class KeyframeSet { private int mNumKeyframes; ArrayList<Keyframe> mKeyframes; Keyframe mFirstKeyframe; Keyframe mLastKeyframe; TimeInterpolator mInterpolator; // only used in the 2-keyframe case ArrayList<Keyframe> mKeyframes; // only used when there are not 2 keyframes public KeyframeSet(Keyframe... keyframes) { mNumKeyframes = keyframes.length; mKeyframes = new ArrayList<Keyframe>(); mKeyframes.addAll(Arrays.asList(keyframes)); mNumKeyframes = mKeyframes.size(); mFirstKeyframe = mKeyframes.get(0); mLastKeyframe = mKeyframes.get(mNumKeyframes - 1); mInterpolator = mLastKeyframe.getInterpolator(); } public static KeyframeSet ofInt(int... values) { Loading Loading @@ -125,32 +131,40 @@ class KeyframeSet { * @return The animated value. */ public Object getValue(float fraction, TypeEvaluator evaluator) { // TODO: special-case 2-keyframe common case // Special-case optimization for the common case of only two keyframes if (mNumKeyframes == 2) { if (mInterpolator != null) { fraction = mInterpolator.getInterpolation(fraction); } return evaluator.evaluate(fraction, mFirstKeyframe.getValue(), mLastKeyframe.getValue()); } if (fraction <= 0f) { final Keyframe prevKeyframe = mKeyframes.get(0); final Keyframe nextKeyframe = mKeyframes.get(1); final TimeInterpolator interpolator = nextKeyframe.getInterpolator(); if (interpolator != null) { fraction = interpolator.getInterpolation(fraction); } float intervalFraction = (fraction - prevKeyframe.getFraction()) / (nextKeyframe.getFraction() - prevKeyframe.getFraction()); return evaluator.evaluate(intervalFraction, prevKeyframe.getValue(), final float prevFraction = mFirstKeyframe.getFraction(); float intervalFraction = (fraction - prevFraction) / (nextKeyframe.getFraction() - prevFraction); return evaluator.evaluate(intervalFraction, mFirstKeyframe.getValue(), nextKeyframe.getValue()); } else if (fraction >= 1f) { final Keyframe prevKeyframe = mKeyframes.get(mNumKeyframes - 2); final Keyframe nextKeyframe = mKeyframes.get(mNumKeyframes - 1); final TimeInterpolator interpolator = nextKeyframe.getInterpolator(); final TimeInterpolator interpolator = mLastKeyframe.getInterpolator(); if (interpolator != null) { fraction = interpolator.getInterpolation(fraction); } float intervalFraction = (fraction - prevKeyframe.getFraction()) / (nextKeyframe.getFraction() - prevKeyframe.getFraction()); final float prevFraction = prevKeyframe.getFraction(); float intervalFraction = (fraction - prevFraction) / (mLastKeyframe.getFraction() - prevFraction); return evaluator.evaluate(intervalFraction, prevKeyframe.getValue(), nextKeyframe.getValue()); mLastKeyframe.getValue()); } Keyframe prevKeyframe = mKeyframes.get(0); Keyframe prevKeyframe = mFirstKeyframe; for (int i = 1; i < mNumKeyframes; ++i) { Keyframe nextKeyframe = mKeyframes.get(i); if (fraction < nextKeyframe.getFraction()) { Loading @@ -158,14 +172,15 @@ class KeyframeSet { if (interpolator != null) { fraction = interpolator.getInterpolation(fraction); } float intervalFraction = (fraction - prevKeyframe.getFraction()) / (nextKeyframe.getFraction() - prevKeyframe.getFraction()); final float prevFraction = prevKeyframe.getFraction(); float intervalFraction = (fraction - prevFraction) / (nextKeyframe.getFraction() - prevFraction); return evaluator.evaluate(intervalFraction, prevKeyframe.getValue(), nextKeyframe.getValue()); } prevKeyframe = nextKeyframe; } // shouldn't get here return mKeyframes.get(mNumKeyframes - 1).getValue(); // shouldn't reach here return mLastKeyframe.getValue(); } }
core/java/android/animation/ObjectAnimator.java +8 −3 Original line number Diff line number Diff line Loading @@ -376,10 +376,15 @@ public final class ObjectAnimator extends ValueAnimator { */ @Override public void setTarget(Object target) { if (mTarget != target) { mTarget = target; // New property/values/target should cause re-initialization prior to starting if (mTarget != null && target != null && mTarget.getClass() == target.getClass()) { return; } // New target type should cause re-initialization prior to starting mInitialized = false; } } @Override public void setupStartValues() { Loading
core/java/android/animation/ValueAnimator.java +1 −1 Original line number Diff line number Diff line Loading @@ -1142,7 +1142,7 @@ public class ValueAnimator extends Animator { switch (mPlayingState) { case RUNNING: case SEEKED: float fraction = (float)(currentTime - mStartTime) / mDuration; float fraction = mDuration > 0 ? (float)(currentTime - mStartTime) / mDuration : 1f; if (fraction >= 1f) { if (mCurrentIteration < mRepeatCount || mRepeatCount == INFINITE) { // Time to repeat Loading
core/java/android/view/View.java +14 −3 Original line number Diff line number Diff line Loading @@ -6296,8 +6296,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility if (invalidateCache) { mPrivateFlags &= ~DRAWING_CACHE_VALID; } final ViewParent p = mParent; final AttachInfo ai = mAttachInfo; final ViewParent p = mParent; if (ai != null && ai.mHardwareAccelerated) { // fast-track for GL-enabled applications; just invalidate the whole hierarchy // with a null dirty rect, which tells the ViewRoot to redraw everything p.invalidateChild(this, null); return; } if (p != null && ai != null) { final Rect r = ai.mTmpInvalRect; r.set(0, 0, mRight - mLeft, mBottom - mTop); Loading @@ -6321,7 +6327,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility */ @ViewDebug.ExportedProperty(category = "drawing") public boolean isOpaque() { return (mPrivateFlags & OPAQUE_MASK) == OPAQUE_MASK; return (mPrivateFlags & OPAQUE_MASK) == OPAQUE_MASK && (mAlpha >= 1.0f - ViewConfiguration.ALPHA_THRESHOLD); } private void computeOpaqueFlags() { Loading Loading @@ -8618,8 +8625,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility */ @RemotableViewMethod public void setBackgroundColor(int color) { if (mBGDrawable instanceof ColorDrawable) { ((ColorDrawable) mBGDrawable).setColor(color); } else { setBackgroundDrawable(new ColorDrawable(color)); } } /** * Set the background to a given resource. The resource should refer to Loading