/// <summary>
        /// Transforms the index stored in
        /// <see cref="AnimationParameters">AnimationParameters</see>
        /// by the order returned by
        /// <see cref="getOrder()">getOrder()</see>
        /// . Subclasses should override
        /// this method to provide additional support for other types of ordering.
        /// This method should be invoked by
        /// <see cref="getDelayForView(android.view.View)">getDelayForView(android.view.View)
        ///     </see>
        /// prior to any computation.
        /// </summary>
        /// <param name="params">the animation parameters containing the index</param>
        /// <returns>a transformed index</returns>
        protected internal virtual int getTransformedIndex(android.view.animation.LayoutAnimationController
                                                           .AnimationParameters @params)
        {
            switch (getOrder())
            {
            case ORDER_REVERSE:
            {
                return(@params.count - 1 - @params.index);
            }

            case ORDER_RANDOM:
            {
                if (mRandomizer == null)
                {
                    mRandomizer = new System.Random();
                }
                return((int)(@params.count * Sharpen.Util.Random_NextFloat(mRandomizer)));
            }

            case ORDER_NORMAL:
            default:
            {
                return(@params.index);
            }
            }
        }
Example #2
0
 protected virtual int getTransformedIndex(android.view.animation.LayoutAnimationController.AnimationParameters arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(@__env.CallIntMethod(this.JvmHandle, global::android.view.animation.LayoutAnimationController._getTransformedIndex10035, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)));
     }
     else
     {
         return(@__env.CallNonVirtualIntMethod(this.JvmHandle, global::android.view.animation.LayoutAnimationController.staticClass, global::android.view.animation.LayoutAnimationController._getTransformedIndex10035, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)));
     }
 }
        /// <summary>
        /// Returns the amount of milliseconds by which the specified view's
        /// animation must be delayed or offset.
        /// </summary>
        /// <remarks>
        /// Returns the amount of milliseconds by which the specified view's
        /// animation must be delayed or offset. Subclasses should override this
        /// method to return a suitable value.
        /// This implementation returns <code>child animation delay</code>
        /// milliseconds where:
        /// <pre>
        /// child animation delay = child index * delay
        /// </pre>
        /// The index is retrieved from the
        /// <see cref="AnimationParameters">AnimationParameters</see>
        /// found in the view's
        /// <see cref="android.view.ViewGroup.LayoutParams">android.view.ViewGroup.LayoutParams
        ///     </see>
        /// .
        /// </remarks>
        /// <param name="view">the view for which to obtain the animation's delay</param>
        /// <returns>a delay in milliseconds</returns>
        /// <seealso cref="getAnimationForView(android.view.View)">getAnimationForView(android.view.View)
        ///     </seealso>
        /// <seealso cref="getDelay()">getDelay()</seealso>
        /// <seealso cref="getTransformedIndex(AnimationParameters)">getTransformedIndex(AnimationParameters)
        ///     </seealso>
        /// <seealso cref="android.view.ViewGroup.LayoutParams">android.view.ViewGroup.LayoutParams
        ///     </seealso>
        protected internal virtual long getDelayForView(android.view.View view)
        {
            android.view.ViewGroup.LayoutParams lp = view.getLayoutParams();
            android.view.animation.LayoutAnimationController.AnimationParameters @params = lp
                                                                                           .layoutAnimationParameters;
            if (@params == null)
            {
                return(0);
            }
            float delay      = mDelay * mAnimation.getDuration();
            long  viewDelay  = (long)(getTransformedIndex(@params) * delay);
            float totalDelay = delay * @params.count;

            if (mInterpolator == null)
            {
                mInterpolator = new android.view.animation.LinearInterpolator();
            }
            float normalizedDelay = viewDelay / totalDelay;

            normalizedDelay = mInterpolator.getInterpolation(normalizedDelay);
            return((long)(normalizedDelay * totalDelay));
        }
Example #4
0
		/// <summary>
		/// Subclasses should override this method to set layout animation
		/// parameters on the supplied child.
		/// </summary>
		/// <remarks>
		/// Subclasses should override this method to set layout animation
		/// parameters on the supplied child.
		/// </remarks>
		/// <param name="child">the child to associate with animation parameters</param>
		/// <param name="params">
		/// the child's layout parameters which hold the animation
		/// parameters
		/// </param>
		/// <param name="index">the index of the child in the view group</param>
		/// <param name="count">the number of children in the view group</param>
		protected internal virtual void attachLayoutAnimationParameters(android.view.View
			 child, android.view.ViewGroup.LayoutParams @params, int index, int count)
		{
			android.view.animation.LayoutAnimationController.AnimationParameters animationParams
				 = @params.layoutAnimationParameters;
			if (animationParams == null)
			{
				animationParams = new android.view.animation.LayoutAnimationController.AnimationParameters
					();
				@params.layoutAnimationParameters = animationParams;
			}
			animationParams.count = count;
			animationParams.index = index;
		}