/// <summary>Returns the animation to be applied to the specified view.</summary>
        /// <remarks>
        /// Returns the animation to be applied to the specified view. The returned
        /// animation is delayed by an offset computed according to the information
        /// provided by
        /// <see cref="AnimationParameters">AnimationParameters</see>
        /// .
        /// This method is called by view groups to obtain the animation to set on
        /// a specific child.
        /// </remarks>
        /// <param name="view">the view to animate</param>
        /// <returns>
        /// an animation delayed by the number of milliseconds returned by
        /// <see cref="getDelayForView(android.view.View)">getDelayForView(android.view.View)
        ///     </see>
        /// </returns>
        /// <seealso cref="getDelay()">getDelay()</seealso>
        /// <seealso cref="setDelay(float)">setDelay(float)</seealso>
        /// <seealso cref="getDelayForView(android.view.View)">getDelayForView(android.view.View)
        ///     </seealso>
        public android.view.animation.Animation getAnimationForView(android.view.View view
                                                                    )
        {
            long delay = getDelayForView(view) + mAnimation.getStartOffset();

            mMaxDelay = System.Math.Max(mMaxDelay, delay);
            android.view.animation.Animation animation = mAnimation.clone();
            animation.setStartOffset(delay);
            return(animation);
        }
Example #2
0
        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);
                }
            }
        }