Methods Summary |
---|
public void | addAnimation(Animation a)Add a child animation to this animation set.
The transforms of the child animations are applied in the order
that they were added
mAnimations.add(a);
boolean noMatrix = (mFlags & PROPERTY_MORPH_MATRIX_MASK) == 0;
if (noMatrix && a.willChangeTransformationMatrix()) {
mFlags |= PROPERTY_MORPH_MATRIX_MASK;
}
boolean changeBounds = (mFlags & PROPERTY_CHANGE_BOUNDS_MASK) == 0;
if (changeBounds && a.willChangeBounds()) {
mFlags |= PROPERTY_CHANGE_BOUNDS_MASK;
}
if ((mFlags & PROPERTY_DURATION_MASK) == PROPERTY_DURATION_MASK) {
mLastEnd = mStartOffset + mDuration;
} else {
if (mAnimations.size() == 1) {
mDuration = a.getStartOffset() + a.getDuration();
mLastEnd = mStartOffset + mDuration;
} else {
mLastEnd = Math.max(mLastEnd, a.getStartOffset() + a.getDuration());
mDuration = mLastEnd - mStartOffset;
}
}
mDirty = true;
|
protected android.view.animation.AnimationSet | clone()
final AnimationSet animation = (AnimationSet) super.clone();
animation.mTempTransformation = new Transformation();
animation.mAnimations = new ArrayList<Animation>();
final int count = mAnimations.size();
final ArrayList<Animation> animations = mAnimations;
for (int i = 0; i < count; i++) {
animation.mAnimations.add(animations.get(i).clone());
}
return animation;
|
public long | computeDurationHint()The duration hint of an animation set is the maximum of the duration
hints of all of its component animations.
long duration = 0;
final int count = mAnimations.size();
final ArrayList<Animation> animations = mAnimations;
for (int i = count - 1; i >= 0; --i) {
final long d = animations.get(i).computeDurationHint();
if (d > duration) duration = d;
}
return duration;
|
public java.util.List | getAnimations()
return mAnimations;
|
public long | getDuration()The duration of an AnimationSet is defined to be the
duration of the longest child animation.
final ArrayList<Animation> animations = mAnimations;
final int count = animations.size();
long duration = 0;
boolean durationSet = (mFlags & PROPERTY_DURATION_MASK) == PROPERTY_DURATION_MASK;
if (durationSet) {
duration = mDuration;
} else {
for (int i = 0; i < count; i++) {
duration = Math.max(duration, animations.get(i).getDuration());
}
}
return duration;
|
public long | getStartTime()
long startTime = Long.MAX_VALUE;
final int count = mAnimations.size();
final ArrayList<Animation> animations = mAnimations;
for (int i = 0; i < count; i++) {
Animation a = animations.get(i);
startTime = Math.min(startTime, a.getStartTime());
}
return startTime;
|
public boolean | getTransformation(long currentTime, Transformation t)The transformation of an animation set is the concatenation of all of its
component animations.
final int count = mAnimations.size();
final ArrayList<Animation> animations = mAnimations;
final Transformation temp = mTempTransformation;
boolean more = false;
boolean started = false;
boolean ended = true;
t.clear();
for (int i = count - 1; i >= 0; --i) {
final Animation a = animations.get(i);
temp.clear();
more = a.getTransformation(currentTime, temp, getScaleFactor()) || more;
t.compose(temp);
started = started || a.hasStarted();
ended = a.hasEnded() && ended;
}
if (started && !mStarted) {
if (mListener != null) {
mListener.onAnimationStart(this);
}
mStarted = true;
}
if (ended != mEnded) {
if (mListener != null) {
mListener.onAnimationEnd(this);
}
mEnded = ended;
}
return more;
|
public boolean | hasAlpha()
if (mDirty) {
mDirty = mHasAlpha = false;
final int count = mAnimations.size();
final ArrayList<Animation> animations = mAnimations;
for (int i = 0; i < count; i++) {
if (animations.get(i).hasAlpha()) {
mHasAlpha = true;
break;
}
}
}
return mHasAlpha;
|
private void | init()
mStartTime = 0;
|
public void | initialize(int width, int height, int parentWidth, int parentHeight)
super.initialize(width, height, parentWidth, parentHeight);
boolean durationSet = (mFlags & PROPERTY_DURATION_MASK) == PROPERTY_DURATION_MASK;
boolean fillAfterSet = (mFlags & PROPERTY_FILL_AFTER_MASK) == PROPERTY_FILL_AFTER_MASK;
boolean fillBeforeSet = (mFlags & PROPERTY_FILL_BEFORE_MASK) == PROPERTY_FILL_BEFORE_MASK;
boolean repeatModeSet = (mFlags & PROPERTY_REPEAT_MODE_MASK) == PROPERTY_REPEAT_MODE_MASK;
boolean shareInterpolator = (mFlags & PROPERTY_SHARE_INTERPOLATOR_MASK)
== PROPERTY_SHARE_INTERPOLATOR_MASK;
boolean startOffsetSet = (mFlags & PROPERTY_START_OFFSET_MASK)
== PROPERTY_START_OFFSET_MASK;
if (shareInterpolator) {
ensureInterpolator();
}
final ArrayList<Animation> children = mAnimations;
final int count = children.size();
final long duration = mDuration;
final boolean fillAfter = mFillAfter;
final boolean fillBefore = mFillBefore;
final int repeatMode = mRepeatMode;
final Interpolator interpolator = mInterpolator;
final long startOffset = mStartOffset;
long[] storedOffsets = mStoredOffsets;
if (startOffsetSet) {
if (storedOffsets == null || storedOffsets.length != count) {
storedOffsets = mStoredOffsets = new long[count];
}
} else if (storedOffsets != null) {
storedOffsets = mStoredOffsets = null;
}
for (int i = 0; i < count; i++) {
Animation a = children.get(i);
if (durationSet) {
a.setDuration(duration);
}
if (fillAfterSet) {
a.setFillAfter(fillAfter);
}
if (fillBeforeSet) {
a.setFillBefore(fillBefore);
}
if (repeatModeSet) {
a.setRepeatMode(repeatMode);
}
if (shareInterpolator) {
a.setInterpolator(interpolator);
}
if (startOffsetSet) {
long offset = a.getStartOffset();
a.setStartOffset(offset + startOffset);
storedOffsets[i] = offset;
}
a.initialize(width, height, parentWidth, parentHeight);
}
|
public void | initializeInvalidateRegion(int left, int top, int right, int bottom)
final RectF region = mPreviousRegion;
region.set(left, top, right, bottom);
region.inset(-1.0f, -1.0f);
if (mFillBefore) {
final int count = mAnimations.size();
final ArrayList<Animation> animations = mAnimations;
final Transformation temp = mTempTransformation;
final Transformation previousTransformation = mPreviousTransformation;
for (int i = count - 1; i >= 0; --i) {
final Animation a = animations.get(i);
if (!a.isFillEnabled() || a.getFillBefore() || a.getStartOffset() == 0) {
temp.clear();
final Interpolator interpolator = a.mInterpolator;
a.applyTransformation(interpolator != null ? interpolator.getInterpolation(0.0f)
: 0.0f, temp);
previousTransformation.compose(temp);
}
}
}
|
public void | reset()
super.reset();
restoreChildrenStartOffset();
|
void | restoreChildrenStartOffset()
final long[] offsets = mStoredOffsets;
if (offsets == null) return;
final ArrayList<Animation> children = mAnimations;
final int count = children.size();
for (int i = 0; i < count; i++) {
children.get(i).setStartOffset(offsets[i]);
}
|
public void | restrictDuration(long durationMillis)
super.restrictDuration(durationMillis);
final ArrayList<Animation> animations = mAnimations;
int count = animations.size();
for (int i = 0; i < count; i++) {
animations.get(i).restrictDuration(durationMillis);
}
|
public void | scaleCurrentDuration(float scale)
final ArrayList<Animation> animations = mAnimations;
int count = animations.size();
for (int i = 0; i < count; i++) {
animations.get(i).scaleCurrentDuration(scale);
}
|
public void | setDuration(long durationMillis)Sets the duration of every child animation.
mFlags |= PROPERTY_DURATION_MASK;
super.setDuration(durationMillis);
mLastEnd = mStartOffset + mDuration;
|
public void | setFillAfter(boolean fillAfter)
mFlags |= PROPERTY_FILL_AFTER_MASK;
super.setFillAfter(fillAfter);
|
public void | setFillBefore(boolean fillBefore)
mFlags |= PROPERTY_FILL_BEFORE_MASK;
super.setFillBefore(fillBefore);
|
private void | setFlag(int mask, boolean value)
if (value) {
mFlags |= mask;
} else {
mFlags &= ~mask;
}
|
public void | setRepeatMode(int repeatMode)
mFlags |= PROPERTY_REPEAT_MODE_MASK;
super.setRepeatMode(repeatMode);
|
public void | setStartOffset(long startOffset)
mFlags |= PROPERTY_START_OFFSET_MASK;
super.setStartOffset(startOffset);
|
public void | setStartTime(long startTimeMillis)Sets the start time of this animation and all child animations
super.setStartTime(startTimeMillis);
final int count = mAnimations.size();
final ArrayList<Animation> animations = mAnimations;
for (int i = 0; i < count; i++) {
Animation a = animations.get(i);
a.setStartTime(startTimeMillis);
}
|
public boolean | willChangeBounds()
return (mFlags & PROPERTY_CHANGE_BOUNDS_MASK) == PROPERTY_CHANGE_BOUNDS_MASK;
|
public boolean | willChangeTransformationMatrix()
return (mFlags & PROPERTY_MORPH_MATRIX_MASK) == PROPERTY_MORPH_MATRIX_MASK;
|