Merge "Add TestApi to ValueAnimator for AnimationScaleListDrawable CTS test." into nyc-mr1-dev
This commit is contained in:
@@ -3255,6 +3255,7 @@ package android.animation {
|
|||||||
method public java.lang.Object getAnimatedValue(java.lang.String);
|
method public java.lang.Object getAnimatedValue(java.lang.String);
|
||||||
method public long getCurrentPlayTime();
|
method public long getCurrentPlayTime();
|
||||||
method public long getDuration();
|
method public long getDuration();
|
||||||
|
method public static float getDurationScale();
|
||||||
method public static long getFrameDelay();
|
method public static long getFrameDelay();
|
||||||
method public int getRepeatCount();
|
method public int getRepeatCount();
|
||||||
method public int getRepeatMode();
|
method public int getRepeatMode();
|
||||||
@@ -3272,6 +3273,7 @@ package android.animation {
|
|||||||
method public void setCurrentFraction(float);
|
method public void setCurrentFraction(float);
|
||||||
method public void setCurrentPlayTime(long);
|
method public void setCurrentPlayTime(long);
|
||||||
method public android.animation.ValueAnimator setDuration(long);
|
method public android.animation.ValueAnimator setDuration(long);
|
||||||
|
method public static void setDurationScale(float);
|
||||||
method public void setEvaluator(android.animation.TypeEvaluator);
|
method public void setEvaluator(android.animation.TypeEvaluator);
|
||||||
method public void setFloatValues(float...);
|
method public void setFloatValues(float...);
|
||||||
method public static void setFrameDelay(long);
|
method public static void setFrameDelay(long);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package android.animation;
|
|||||||
|
|
||||||
import android.annotation.CallSuper;
|
import android.annotation.CallSuper;
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
|
import android.annotation.TestApi;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Trace;
|
import android.os.Trace;
|
||||||
import android.util.AndroidRuntimeException;
|
import android.util.AndroidRuntimeException;
|
||||||
@@ -261,6 +262,7 @@ public class ValueAnimator extends Animator implements AnimationHandler.Animatio
|
|||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@TestApi
|
||||||
public static void setDurationScale(float durationScale) {
|
public static void setDurationScale(float durationScale) {
|
||||||
sDurationScale = durationScale;
|
sDurationScale = durationScale;
|
||||||
}
|
}
|
||||||
@@ -268,6 +270,7 @@ public class ValueAnimator extends Animator implements AnimationHandler.Animatio
|
|||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@TestApi
|
||||||
public static float getDurationScale() {
|
public static float getDurationScale() {
|
||||||
return sDurationScale;
|
return sDurationScale;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,17 +46,17 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class AnimationScaleListDrawable extends DrawableContainer implements Animatable {
|
public class AnimationScaleListDrawable extends DrawableContainer implements Animatable {
|
||||||
private static final String TAG = "AnimationScaleListDrawable";
|
private static final String TAG = "AnimationScaleListDrawable";
|
||||||
private AnimatedScaleListState mAnimatedScaleListState;
|
private AnimationScaleListState mAnimationScaleListState;
|
||||||
private boolean mMutated;
|
private boolean mMutated;
|
||||||
|
|
||||||
public AnimationScaleListDrawable() {
|
public AnimationScaleListDrawable() {
|
||||||
this(null, null);
|
this(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private AnimationScaleListDrawable(@Nullable AnimatedScaleListState state,
|
private AnimationScaleListDrawable(@Nullable AnimationScaleListState state,
|
||||||
@Nullable Resources res) {
|
@Nullable Resources res) {
|
||||||
// Every scale list drawable has its own constant state.
|
// Every scale list drawable has its own constant state.
|
||||||
final AnimatedScaleListState newState = new AnimatedScaleListState(state, this, res);
|
final AnimationScaleListState newState = new AnimationScaleListState(state, this, res);
|
||||||
setConstantState(newState);
|
setConstantState(newState);
|
||||||
onStateChange(getState());
|
onStateChange(getState());
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ public class AnimationScaleListDrawable extends DrawableContainer implements Ani
|
|||||||
@Override
|
@Override
|
||||||
protected boolean onStateChange(int[] stateSet) {
|
protected boolean onStateChange(int[] stateSet) {
|
||||||
final boolean changed = super.onStateChange(stateSet);
|
final boolean changed = super.onStateChange(stateSet);
|
||||||
int idx = mAnimatedScaleListState.getCurrentDrawableIndexBasedOnScale();
|
int idx = mAnimationScaleListState.getCurrentDrawableIndexBasedOnScale();
|
||||||
return selectDrawable(idx) || changed;
|
return selectDrawable(idx) || changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ public class AnimationScaleListDrawable extends DrawableContainer implements Ani
|
|||||||
private void inflateChildElements(@NonNull Resources r, @NonNull XmlPullParser parser,
|
private void inflateChildElements(@NonNull Resources r, @NonNull XmlPullParser parser,
|
||||||
@NonNull AttributeSet attrs, @Nullable Theme theme)
|
@NonNull AttributeSet attrs, @Nullable Theme theme)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
final AnimatedScaleListState state = mAnimatedScaleListState;
|
final AnimationScaleListState state = mAnimationScaleListState;
|
||||||
final int innerDepth = parser.getDepth() + 1;
|
final int innerDepth = parser.getDepth() + 1;
|
||||||
int type;
|
int type;
|
||||||
int depth;
|
int depth;
|
||||||
@@ -134,7 +134,7 @@ public class AnimationScaleListDrawable extends DrawableContainer implements Ani
|
|||||||
@Override
|
@Override
|
||||||
public Drawable mutate() {
|
public Drawable mutate() {
|
||||||
if (!mMutated && super.mutate() == this) {
|
if (!mMutated && super.mutate() == this) {
|
||||||
mAnimatedScaleListState.mutate();
|
mAnimationScaleListState.mutate();
|
||||||
mMutated = true;
|
mMutated = true;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
@@ -172,14 +172,14 @@ public class AnimationScaleListDrawable extends DrawableContainer implements Ani
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class AnimatedScaleListState extends DrawableContainerState {
|
static class AnimationScaleListState extends DrawableContainerState {
|
||||||
int[] mThemeAttrs = null;
|
int[] mThemeAttrs = null;
|
||||||
// The index of the last static drawable.
|
// The index of the last static drawable.
|
||||||
int mStaticDrawableIndex = -1;
|
int mStaticDrawableIndex = -1;
|
||||||
// The index of the last animatable drawable.
|
// The index of the last animatable drawable.
|
||||||
int mAnimatableDrawableIndex = -1;
|
int mAnimatableDrawableIndex = -1;
|
||||||
|
|
||||||
AnimatedScaleListState(AnimatedScaleListState orig, AnimationScaleListDrawable owner,
|
AnimationScaleListState(AnimationScaleListState orig, AnimationScaleListDrawable owner,
|
||||||
Resources res) {
|
Resources res) {
|
||||||
super(orig, owner, res);
|
super(orig, owner, res);
|
||||||
|
|
||||||
@@ -246,8 +246,8 @@ public class AnimationScaleListDrawable extends DrawableContainer implements Ani
|
|||||||
protected void setConstantState(@NonNull DrawableContainerState state) {
|
protected void setConstantState(@NonNull DrawableContainerState state) {
|
||||||
super.setConstantState(state);
|
super.setConstantState(state);
|
||||||
|
|
||||||
if (state instanceof AnimatedScaleListState) {
|
if (state instanceof AnimationScaleListState) {
|
||||||
mAnimatedScaleListState = (AnimatedScaleListState) state;
|
mAnimationScaleListState = (AnimationScaleListState) state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user