Example #1
0
 public override void initializeInvalidateRegion(int left, int top, int right, int
                                                 bottom)
 {
     android.graphics.RectF region = mPreviousRegion;
     region.set(left, top, right, bottom);
     region.inset(-1.0f, -1.0f);
     if (mFillBefore)
     {
         int count = mAnimations.size();
         java.util.ArrayList <android.view.animation.Animation> animations = mAnimations;
         android.view.animation.Transformation temp = mTempTransformation;
         android.view.animation.Transformation previousTransformation = mPreviousTransformation;
         {
             for (int i = count - 1; i >= 0; --i)
             {
                 android.view.animation.Animation a = animations.get(i);
                 temp.clear();
                 android.view.animation.Interpolator interpolator = a.mInterpolator;
                 a.applyTransformation(interpolator != null ? interpolator.getInterpolation(0.0f) :
                                       0.0f, temp);
                 previousTransformation.compose(temp);
             }
         }
     }
 }
Example #2
0
 /// <summary>Creates an OverScroller.</summary>
 /// <remarks>Creates an OverScroller.</remarks>
 /// <param name="context">The context of this application.</param>
 /// <param name="interpolator">
 /// The scroll interpolator. If null, a default (viscous) interpolator will
 /// be used.
 /// </param>
 /// <param name="flywheel">If true, successive fling motions will keep on increasing scroll speed.
 ///     </param>
 /// <hide></hide>
 public OverScroller(android.content.Context context, android.view.animation.Interpolator
                     interpolator, bool flywheel)
 {
     mInterpolator = interpolator;
     mFlywheel     = flywheel;
     mScrollerX    = new android.widget.OverScroller.SplineOverScroller();
     mScrollerY    = new android.widget.OverScroller.SplineOverScroller();
     android.widget.OverScroller.SplineOverScroller.initFromContext(context);
 }
Example #3
0
		/// <summary>Creates an OverScroller.</summary>
		/// <remarks>Creates an OverScroller.</remarks>
		/// <param name="context">The context of this application.</param>
		/// <param name="interpolator">
		/// The scroll interpolator. If null, a default (viscous) interpolator will
		/// be used.
		/// </param>
		/// <param name="flywheel">If true, successive fling motions will keep on increasing scroll speed.
		/// 	</param>
		/// <hide></hide>
		public OverScroller(android.content.Context context, android.view.animation.Interpolator
			 interpolator, bool flywheel)
		{
			mInterpolator = interpolator;
			mFlywheel = flywheel;
			mScrollerX = new android.widget.OverScroller.SplineOverScroller();
			mScrollerY = new android.widget.OverScroller.SplineOverScroller();
			android.widget.OverScroller.SplineOverScroller.initFromContext(context);
		}
Example #4
0
 /// <summary>Create a Scroller with the specified interpolator.</summary>
 /// <remarks>
 /// Create a Scroller with the specified interpolator. If the interpolator is
 /// null, the default (viscous) interpolator will be used. Specify whether or
 /// not to support progressive "flywheel" behavior in flinging.
 /// </remarks>
 public Scroller(android.content.Context context, android.view.animation.Interpolator
                 interpolator, bool flywheel)
 {
     mFinished     = true;
     mInterpolator = interpolator;
     mPpi          = context.getResources().getDisplayMetrics().density * 160.0f;
     mDeceleration = computeDeceleration(android.view.ViewConfiguration.getScrollFriction
                                             ());
     mFlywheel = flywheel;
 }
Example #5
0
 public virtual void setInterpolator(android.view.animation.Interpolator arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.widget.ProgressBar._setInterpolator11696, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.widget.ProgressBar.staticClass, global::android.widget.ProgressBar._setInterpolator11696, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
 }
Example #6
0
 /// <summary>Construct a new EdgeEffect with a theme appropriate for the provided context.
 ///     </summary>
 /// <remarks>Construct a new EdgeEffect with a theme appropriate for the provided context.
 ///     </remarks>
 /// <param name="context">Context used to provide theming and resource information for the EdgeEffect
 ///     </param>
 public EdgeEffect(android.content.Context context)
 {
     // Time it will take the effect to fully recede in ms
     // Time it will take before a pulled glow begins receding in ms
     // Time it will take in ms for a pulled glow to decay to partial strength before release
     // Minimum velocity that will be absorbed
     // How much dragging should effect the height of the edge image.
     // Number determined by user testing.
     // How much dragging should effect the height of the glow image.
     // Number determined by user testing.
     android.content.res.Resources res = context.getResources();
     mEdge     = res.getDrawable([email protected]_edge);
     mGlow     = res.getDrawable([email protected]_glow);
     mMinWidth = (int)(context.getResources().getDisplayMetrics().density *MIN_WIDTH
                       + 0.5f);
     mInterpolator = new android.view.animation.DecelerateInterpolator();
 }
        /// <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 #8
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);
                }
            }
        }
 /// <summary>
 /// Sets the interpolator used to interpolate the delays between the
 /// children.
 /// </summary>
 /// <remarks>
 /// Sets the interpolator used to interpolate the delays between the
 /// children.
 /// </remarks>
 /// <param name="interpolator">the interpolator</param>
 /// <seealso cref="getInterpolator()">getInterpolator()</seealso>
 /// <seealso cref="setInterpolator(Interpolator)">setInterpolator(Interpolator)</seealso>
 /// <attr>ref android.R.styleable#LayoutAnimation_interpolator</attr>
 public virtual void setInterpolator(android.view.animation.Interpolator interpolator
                                     )
 {
     mInterpolator = interpolator;
 }
Example #10
0
 /// <summary>Creates an OverScroller with flywheel enabled.</summary>
 /// <remarks>Creates an OverScroller with flywheel enabled.</remarks>
 /// <param name="context">The context of this application.</param>
 /// <param name="interpolator">
 /// The scroll interpolator. If null, a default (viscous) interpolator will
 /// be used.
 /// </param>
 /// <param name="bounceCoefficientX">
 /// A value between 0 and 1 that will determine the proportion of the
 /// velocity which is preserved in the bounce when the horizontal edge is reached. A null value
 /// means no bounce. This behavior is no longer supported and this coefficient has no effect.
 /// </param>
 /// <param name="bounceCoefficientY">
 /// Same as bounceCoefficientX but for the vertical direction. This
 /// behavior is no longer supported and this coefficient has no effect.
 /// !deprecated Use {!link #OverScroller(Context, Interpolator, boolean)} instead.
 /// </param>
 public OverScroller(android.content.Context context, android.view.animation.Interpolator
                     interpolator, float bounceCoefficientX, float bounceCoefficientY) : this(context
                                                                                              , interpolator, true)
 {
 }
Example #11
0
 /// <summary>Create a Scroller with the specified interpolator.</summary>
 /// <remarks>
 /// Create a Scroller with the specified interpolator. If the interpolator is
 /// null, the default (viscous) interpolator will be used. "Flywheel" behavior will
 /// be in effect for apps targeting Honeycomb or newer.
 /// </remarks>
 public Scroller(android.content.Context context, android.view.animation.Interpolator
                 interpolator) : this(context, interpolator, context.getApplicationInfo().targetSdkVersion
                                      >= android.os.Build.VERSION_CODES.HONEYCOMB)
 {
 }
Example #12
0
 public Scroller(android.content.Context arg0, android.view.animation.Interpolator arg1)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv         @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.widget.Scroller.staticClass, global::android.widget.Scroller._Scroller11894, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     Init(@__env, handle);
 }
Example #13
0
		/// <summary>Create a Scroller with the specified interpolator.</summary>
		/// <remarks>
		/// Create a Scroller with the specified interpolator. If the interpolator is
		/// null, the default (viscous) interpolator will be used. Specify whether or
		/// not to support progressive "flywheel" behavior in flinging.
		/// </remarks>
		public Scroller(android.content.Context context, android.view.animation.Interpolator
			 interpolator, bool flywheel)
		{
			mFinished = true;
			mInterpolator = interpolator;
			mPpi = context.getResources().getDisplayMetrics().density * 160.0f;
			mDeceleration = computeDeceleration(android.view.ViewConfiguration.getScrollFriction
				());
			mFlywheel = flywheel;
		}
		/// <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);
		}
		/// <summary>
		/// Sets the interpolator used to interpolate the delays between the
		/// children.
		/// </summary>
		/// <remarks>
		/// Sets the interpolator used to interpolate the delays between the
		/// children.
		/// </remarks>
		/// <param name="interpolator">the interpolator</param>
		/// <seealso cref="getInterpolator()">getInterpolator()</seealso>
		/// <seealso cref="setInterpolator(Interpolator)">setInterpolator(Interpolator)</seealso>
		/// <attr>ref android.R.styleable#LayoutAnimation_interpolator</attr>
		public virtual void setInterpolator(android.view.animation.Interpolator interpolator
			)
		{
			mInterpolator = interpolator;
		}
Example #16
0
        /// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        private static android.view.animation.Interpolator createInterpolatorFromXml(android.content.Context
                                                                                     c, org.xmlpull.v1.XmlPullParser parser)
        {
            android.view.animation.Interpolator interpolator = null;
            // Make sure we are on a start tag.
            int type;
            int depth = parser.getDepth();

            while (((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser
                    .getDepth() > depth) && type != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT)
            {
                if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
                {
                    continue;
                }
                android.util.AttributeSet attrs = android.util.Xml.asAttributeSet(parser);
                string name = parser.getName();
                if (name.Equals("linearInterpolator"))
                {
                    interpolator = new android.view.animation.LinearInterpolator(c, attrs);
                }
                else
                {
                    if (name.Equals("accelerateInterpolator"))
                    {
                        interpolator = new android.view.animation.AccelerateInterpolator(c, attrs);
                    }
                    else
                    {
                        if (name.Equals("decelerateInterpolator"))
                        {
                            interpolator = new android.view.animation.DecelerateInterpolator(c, attrs);
                        }
                        else
                        {
                            if (name.Equals("accelerateDecelerateInterpolator"))
                            {
                                interpolator = new android.view.animation.AccelerateDecelerateInterpolator(c, attrs
                                                                                                           );
                            }
                            else
                            {
                                if (name.Equals("cycleInterpolator"))
                                {
                                    interpolator = new android.view.animation.CycleInterpolator(c, attrs);
                                }
                                else
                                {
                                    if (name.Equals("anticipateInterpolator"))
                                    {
                                        interpolator = new android.view.animation.AnticipateInterpolator(c, attrs);
                                    }
                                    else
                                    {
                                        if (name.Equals("overshootInterpolator"))
                                        {
                                            interpolator = new android.view.animation.OvershootInterpolator(c, attrs);
                                        }
                                        else
                                        {
                                            if (name.Equals("anticipateOvershootInterpolator"))
                                            {
                                                interpolator = new android.view.animation.AnticipateOvershootInterpolator(c, attrs
                                                                                                                          );
                                            }
                                            else
                                            {
                                                if (name.Equals("bounceInterpolator"))
                                                {
                                                    interpolator = new android.view.animation.BounceInterpolator(c, attrs);
                                                }
                                                else
                                                {
                                                    throw new java.lang.RuntimeException("Unknown interpolator name: " + parser.getName
                                                                                             ());
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(interpolator);
        }
Example #17
0
 /// <summary>Creates an OverScroller with flywheel enabled.</summary>
 /// <remarks>Creates an OverScroller with flywheel enabled.</remarks>
 /// <param name="context">The context of this application.</param>
 /// <param name="interpolator">
 /// The scroll interpolator. If null, a default (viscous) interpolator will
 /// be used.
 /// </param>
 public OverScroller(android.content.Context context, android.view.animation.Interpolator
                     interpolator) : this(context, interpolator, true)
 {
 }