/// <summary>Add a child animation to this animation set.</summary> /// <remarks> /// Add a child animation to this animation set. /// The transforms of the child animations are applied in the order /// that they were added /// </remarks> /// <param name="a">Animation to add.</param> public virtual void addAnimation(android.view.animation.Animation a) { mAnimations.add(a); bool noMatrix = (mFlags & PROPERTY_MORPH_MATRIX_MASK) == 0; if (noMatrix && a.willChangeTransformationMatrix()) { mFlags |= PROPERTY_MORPH_MATRIX_MASK; } bool changeBounds = (mFlags & PROPERTY_CHANGE_BOUNDS_MASK) == 0; if (changeBounds && a.willChangeTransformationMatrix()) { 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 = System.Math.Max(mLastEnd, a.getStartOffset() + a.getDuration()); mDuration = mLastEnd - mStartOffset; } } mDirty = true; }
public override void initialize(int width, int height, int parentWidth, int parentHeight ) { base.initialize(width, height, parentWidth, parentHeight); bool durationSet = (mFlags & PROPERTY_DURATION_MASK) == PROPERTY_DURATION_MASK; bool fillAfterSet = (mFlags & PROPERTY_FILL_AFTER_MASK) == PROPERTY_FILL_AFTER_MASK; bool fillBeforeSet = (mFlags & PROPERTY_FILL_BEFORE_MASK) == PROPERTY_FILL_BEFORE_MASK; bool repeatModeSet = (mFlags & PROPERTY_REPEAT_MODE_MASK) == PROPERTY_REPEAT_MODE_MASK; bool shareInterpolator = (mFlags & PROPERTY_SHARE_INTERPOLATOR_MASK) == PROPERTY_SHARE_INTERPOLATOR_MASK; bool startOffsetSet = (mFlags & PROPERTY_START_OFFSET_MASK) == PROPERTY_START_OFFSET_MASK; if (shareInterpolator) { ensureInterpolator(); } java.util.ArrayList <android.view.animation.Animation> children = mAnimations; int count = children.size(); long duration = mDuration; bool fillAfter = mFillAfter; bool fillBefore = mFillBefore; int repeatMode = mRepeatMode; android.view.animation.Interpolator interpolator = mInterpolator; 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++) { android.view.animation.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); } } }