Esempio n. 1
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);
                }
            }
        }