Ejemplo n.º 1
0
        /// <summary>
        /// @brief Create animator to hide specified app actions
        /// </summary>
        /// <param name="toShow">        View to be shown </param>
        /// <param name="duration">      Animation duration of each sub animator
        /// </param>
        /// <returns>  Sequential animator to show the hidden element </returns>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public android.animation.Animator createExpandAnimator(final android.view.View toShow, long duration)
        public virtual Animator createExpandAnimator(View toShow, long duration)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int fromWidth = toShow.getWidth();
            int fromWidth = toShow.Width;

            toShow.LayoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
            toShow.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int toWidth = toShow.getMeasuredWidth();
            int toWidth = toShow.MeasuredWidth;

            if (FcConstants.OPT_DETAILED_LOGS)
            {
                Log.d(TAG, "createExpandAnimator(" + toShow + ")");
                Log.d(TAG, "    duration: " + duration);
                Log.d(TAG, "    width: " + fromWidth + " -> " + toWidth);
            }

            ValueAnimator expandAnimator = ValueAnimator.ofFloat(0f, 1f);

            expandAnimator.Duration = duration;
            expandAnimator.addUpdateListener(new AnimatorUpdateListenerAnonymousInnerClassHelper3(this, toShow, fromWidth, toWidth));
            expandAnimator.addListener(new FcAnimatorListenerAnonymousInnerClassHelper3(this, toShow, fromWidth));

            return(expandAnimator);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// @brief Create animator to hide specified app actions
        /// </summary>
        /// <param name="toShow">        View to be shown </param>
        /// <param name="toDimension"> </param>
        /// <param name="duration">      Animation duration of each sub animator
        /// </param>
        /// <returns>  Sequential animator to show the hidden element </returns>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public android.animation.Animator createExpandAnimator(final android.view.View toShow, final int toDimension, long duration)
        public virtual Animator createExpandAnimator(View toShow, int toDimension, long duration)
        {
            Log.d(TAG, "View params:");
            Log.d(TAG, "  before measure getWidth: " + toShow.Width);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final float fromWidth = toShow.getWidth();
            float fromWidth = toShow.Width;

            toShow.LayoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
            toShow.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));

            float toMeasuredWidth = toShow.MeasuredWidth;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final float toWidth = (toDimension < toMeasuredWidth) ? toDimension : toMeasuredWidth;
            float toWidth = (toDimension < toMeasuredWidth) ? toDimension : toMeasuredWidth;

            ValueAnimator expandAnimator = ValueAnimator.ofFloat(0f, 1f);

            expandAnimator.Duration = duration;
            expandAnimator.addUpdateListener(new AnimatorUpdateListenerAnonymousInnerClassHelper2(this, toShow, toWidth));

            expandAnimator.addListener(new FcAnimatorListenerAnonymousInnerClassHelper2(this, toShow));

            return(expandAnimator);
        }
Ejemplo n.º 3
0
			public override void onAnimationUpdate(ValueAnimator animation)
			{
				float value = (float?) animation.AnimatedValue;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int curPos = (int)(fromDimension * value);
				int curPos = (int)(fromDimension * value);
				toHide.LayoutParams.width = curPos;
				toHide.requestLayout();
			}
Ejemplo n.º 4
0
            public override void onAnimationUpdate(ValueAnimator animation)
            {
                float value = (float?)animation.AnimatedValue;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int curPos = (int)(fromDimension * value);
                int curPos = (int)(fromDimension * value);

                toHide.LayoutParams.width = curPos;
                toHide.requestLayout();
            }
Ejemplo n.º 5
0
        /// <summary>
        /// @brief Create animator to hide selected view
        ///
        /// The Animator will
        /// - Shrink layout width from full to 0
        /// - Set visibility of the view to GONE
        /// </summary>
        /// <param name="toHide">    View to be hidden </param>
        /// <param name="duration">  Animation duration
        /// </param>
        /// <returns>  Sequential animator to hide the element </returns>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public android.animation.Animator createCollapseAnimator(final android.view.View toHide, long duration)
        public virtual Animator createCollapseAnimator(View toHide, long duration)
        {
            ValueAnimator collapseAnimator = ValueAnimator.ofFloat(1f, 0f);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int fromDimension = toHide.getWidth();
            int fromDimension = toHide.Width;

            collapseAnimator.Duration = duration;
            collapseAnimator.addUpdateListener(new AnimatorUpdateListenerAnonymousInnerClassHelper(this, toHide, fromDimension));

            collapseAnimator.addListener(new FcAnimatorListenerAnonymousInnerClassHelper(this, toHide));

            return(collapseAnimator);
        }
Ejemplo n.º 6
0
 public void onAnimationUpdate(android.animation.ValueAnimator animation)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates a new animation whose parameters come from the specified context and
        /// attributes set.
        /// </summary>
        /// <remarks>
        /// Creates a new animation whose parameters come from the specified context and
        /// attributes set.
        /// </remarks>
        /// <param name="context">the application environment</param>
        /// <param name="attrs">the set of attributes holding the animation parameters</param>
        /// <exception cref="android.content.res.Resources.NotFoundException"></exception>
        private static android.animation.ValueAnimator loadAnimator(android.content.Context
                                                                    context, android.util.AttributeSet attrs, android.animation.ValueAnimator anim)
        {
            android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
                                                                              .styleable.Animator);
            long duration   = a.getInt([email protected]_duration, 0);
            long startDelay = a.getInt([email protected]_startOffset, 0);
            int  valueType  = a.getInt([email protected]_valueType, VALUE_TYPE_FLOAT
                                       );

            if (anim == null)
            {
                anim = new android.animation.ValueAnimator();
            }
            android.animation.TypeEvaluator <object> evaluator = null;
            int  valueFromIndex = [email protected]_valueFrom;
            int  valueToIndex   = [email protected]_valueTo;
            bool getFloats      = (valueType == VALUE_TYPE_FLOAT);

            android.util.TypedValue tvFrom = a.peekValue(valueFromIndex);
            bool hasFrom  = (tvFrom != null);
            int  fromType = hasFrom ? tvFrom.type : 0;

            android.util.TypedValue tvTo = a.peekValue(valueToIndex);
            bool hasTo  = (tvTo != null);
            int  toType = hasTo ? tvTo.type : 0;

            if ((hasFrom && (fromType >= android.util.TypedValue.TYPE_FIRST_COLOR_INT) && (fromType
                                                                                           <= android.util.TypedValue.TYPE_LAST_COLOR_INT)) || (hasTo && (toType >= android.util.TypedValue
                                                                                                                                                          .TYPE_FIRST_COLOR_INT) && (toType <= android.util.TypedValue.TYPE_LAST_COLOR_INT
                                                                                                                                                                                     )))
            {
                // special case for colors: ignore valueType and get ints
                getFloats = false;
                anim.setEvaluator(new android.animation.ArgbEvaluator());
            }
            if (getFloats)
            {
                float valueFrom;
                float valueTo;
                if (hasFrom)
                {
                    if (fromType == android.util.TypedValue.TYPE_DIMENSION)
                    {
                        valueFrom = a.getDimension(valueFromIndex, 0f);
                    }
                    else
                    {
                        valueFrom = a.getFloat(valueFromIndex, 0f);
                    }
                    if (hasTo)
                    {
                        if (toType == android.util.TypedValue.TYPE_DIMENSION)
                        {
                            valueTo = a.getDimension(valueToIndex, 0f);
                        }
                        else
                        {
                            valueTo = a.getFloat(valueToIndex, 0f);
                        }
                        anim.setFloatValues(valueFrom, valueTo);
                    }
                    else
                    {
                        anim.setFloatValues(valueFrom);
                    }
                }
                else
                {
                    if (toType == android.util.TypedValue.TYPE_DIMENSION)
                    {
                        valueTo = a.getDimension(valueToIndex, 0f);
                    }
                    else
                    {
                        valueTo = a.getFloat(valueToIndex, 0f);
                    }
                    anim.setFloatValues(valueTo);
                }
            }
            else
            {
                int valueFrom;
                int valueTo;
                if (hasFrom)
                {
                    if (fromType == android.util.TypedValue.TYPE_DIMENSION)
                    {
                        valueFrom = (int)a.getDimension(valueFromIndex, 0f);
                    }
                    else
                    {
                        if ((fromType >= android.util.TypedValue.TYPE_FIRST_COLOR_INT) && (fromType <= android.util.TypedValue
                                                                                           .TYPE_LAST_COLOR_INT))
                        {
                            valueFrom = a.getColor(valueFromIndex, 0);
                        }
                        else
                        {
                            valueFrom = a.getInt(valueFromIndex, 0);
                        }
                    }
                    if (hasTo)
                    {
                        if (toType == android.util.TypedValue.TYPE_DIMENSION)
                        {
                            valueTo = (int)a.getDimension(valueToIndex, 0f);
                        }
                        else
                        {
                            if ((toType >= android.util.TypedValue.TYPE_FIRST_COLOR_INT) && (toType <= android.util.TypedValue
                                                                                             .TYPE_LAST_COLOR_INT))
                            {
                                valueTo = a.getColor(valueToIndex, 0);
                            }
                            else
                            {
                                valueTo = a.getInt(valueToIndex, 0);
                            }
                        }
                        anim.setIntValues(valueFrom, valueTo);
                    }
                    else
                    {
                        anim.setIntValues(valueFrom);
                    }
                }
                else
                {
                    if (hasTo)
                    {
                        if (toType == android.util.TypedValue.TYPE_DIMENSION)
                        {
                            valueTo = (int)a.getDimension(valueToIndex, 0f);
                        }
                        else
                        {
                            if ((toType >= android.util.TypedValue.TYPE_FIRST_COLOR_INT) && (toType <= android.util.TypedValue
                                                                                             .TYPE_LAST_COLOR_INT))
                            {
                                valueTo = a.getColor(valueToIndex, 0);
                            }
                            else
                            {
                                valueTo = a.getInt(valueToIndex, 0);
                            }
                        }
                        anim.setIntValues(valueTo);
                    }
                }
            }
            anim.setDuration(duration);
            anim.setStartDelay(startDelay);
            if (a.hasValue([email protected]_repeatCount))
            {
                anim.setRepeatCount(a.getInt([email protected]_repeatCount,
                                             0));
            }
            if (a.hasValue([email protected]_repeatMode))
            {
                anim.setRepeatMode(a.getInt([email protected]_repeatMode, android.animation.ValueAnimator
                                            .RESTART));
            }
            if (evaluator != null)
            {
                anim.setEvaluator(evaluator);
            }
            int resID = a.getResourceId([email protected]_interpolator,
                                        0);

            if (resID > 0)
            {
                anim.setInterpolator(android.view.animation.AnimationUtils.loadInterpolator(context
                                                                                            , resID));
            }
            a.recycle();
            return(anim);
        }
Ejemplo n.º 8
0
		/// <summary>
		/// Creates a new animation whose parameters come from the specified context and
		/// attributes set.
		/// </summary>
		/// <remarks>
		/// Creates a new animation whose parameters come from the specified context and
		/// attributes set.
		/// </remarks>
		/// <param name="context">the application environment</param>
		/// <param name="attrs">the set of attributes holding the animation parameters</param>
		/// <exception cref="android.content.res.Resources.NotFoundException"></exception>
		private static android.animation.ValueAnimator loadAnimator(android.content.Context
			 context, android.util.AttributeSet attrs, android.animation.ValueAnimator anim)
		{
			android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
				.styleable.Animator);
			long duration = a.getInt([email protected]_duration, 0);
			long startDelay = a.getInt([email protected]_startOffset, 0);
			int valueType = a.getInt([email protected]_valueType, VALUE_TYPE_FLOAT
				);
			if (anim == null)
			{
				anim = new android.animation.ValueAnimator();
			}
			android.animation.TypeEvaluator<object> evaluator = null;
			int valueFromIndex = [email protected]_valueFrom;
			int valueToIndex = [email protected]_valueTo;
			bool getFloats = (valueType == VALUE_TYPE_FLOAT);
			android.util.TypedValue tvFrom = a.peekValue(valueFromIndex);
			bool hasFrom = (tvFrom != null);
			int fromType = hasFrom ? tvFrom.type : 0;
			android.util.TypedValue tvTo = a.peekValue(valueToIndex);
			bool hasTo = (tvTo != null);
			int toType = hasTo ? tvTo.type : 0;
			if ((hasFrom && (fromType >= android.util.TypedValue.TYPE_FIRST_COLOR_INT) && (fromType
				 <= android.util.TypedValue.TYPE_LAST_COLOR_INT)) || (hasTo && (toType >= android.util.TypedValue
				.TYPE_FIRST_COLOR_INT) && (toType <= android.util.TypedValue.TYPE_LAST_COLOR_INT
				)))
			{
				// special case for colors: ignore valueType and get ints
				getFloats = false;
				anim.setEvaluator(new android.animation.ArgbEvaluator());
			}
			if (getFloats)
			{
				float valueFrom;
				float valueTo;
				if (hasFrom)
				{
					if (fromType == android.util.TypedValue.TYPE_DIMENSION)
					{
						valueFrom = a.getDimension(valueFromIndex, 0f);
					}
					else
					{
						valueFrom = a.getFloat(valueFromIndex, 0f);
					}
					if (hasTo)
					{
						if (toType == android.util.TypedValue.TYPE_DIMENSION)
						{
							valueTo = a.getDimension(valueToIndex, 0f);
						}
						else
						{
							valueTo = a.getFloat(valueToIndex, 0f);
						}
						anim.setFloatValues(valueFrom, valueTo);
					}
					else
					{
						anim.setFloatValues(valueFrom);
					}
				}
				else
				{
					if (toType == android.util.TypedValue.TYPE_DIMENSION)
					{
						valueTo = a.getDimension(valueToIndex, 0f);
					}
					else
					{
						valueTo = a.getFloat(valueToIndex, 0f);
					}
					anim.setFloatValues(valueTo);
				}
			}
			else
			{
				int valueFrom;
				int valueTo;
				if (hasFrom)
				{
					if (fromType == android.util.TypedValue.TYPE_DIMENSION)
					{
						valueFrom = (int)a.getDimension(valueFromIndex, 0f);
					}
					else
					{
						if ((fromType >= android.util.TypedValue.TYPE_FIRST_COLOR_INT) && (fromType <= android.util.TypedValue
							.TYPE_LAST_COLOR_INT))
						{
							valueFrom = a.getColor(valueFromIndex, 0);
						}
						else
						{
							valueFrom = a.getInt(valueFromIndex, 0);
						}
					}
					if (hasTo)
					{
						if (toType == android.util.TypedValue.TYPE_DIMENSION)
						{
							valueTo = (int)a.getDimension(valueToIndex, 0f);
						}
						else
						{
							if ((toType >= android.util.TypedValue.TYPE_FIRST_COLOR_INT) && (toType <= android.util.TypedValue
								.TYPE_LAST_COLOR_INT))
							{
								valueTo = a.getColor(valueToIndex, 0);
							}
							else
							{
								valueTo = a.getInt(valueToIndex, 0);
							}
						}
						anim.setIntValues(valueFrom, valueTo);
					}
					else
					{
						anim.setIntValues(valueFrom);
					}
				}
				else
				{
					if (hasTo)
					{
						if (toType == android.util.TypedValue.TYPE_DIMENSION)
						{
							valueTo = (int)a.getDimension(valueToIndex, 0f);
						}
						else
						{
							if ((toType >= android.util.TypedValue.TYPE_FIRST_COLOR_INT) && (toType <= android.util.TypedValue
								.TYPE_LAST_COLOR_INT))
							{
								valueTo = a.getColor(valueToIndex, 0);
							}
							else
							{
								valueTo = a.getInt(valueToIndex, 0);
							}
						}
						anim.setIntValues(valueTo);
					}
				}
			}
			anim.setDuration(duration);
			anim.setStartDelay(startDelay);
			if (a.hasValue([email protected]_repeatCount))
			{
				anim.setRepeatCount(a.getInt([email protected]_repeatCount, 
					0));
			}
			if (a.hasValue([email protected]_repeatMode))
			{
				anim.setRepeatMode(a.getInt([email protected]_repeatMode, android.animation.ValueAnimator
					.RESTART));
			}
			if (evaluator != null)
			{
				anim.setEvaluator(evaluator);
			}
			int resID = a.getResourceId([email protected]_interpolator, 
				0);
			if (resID > 0)
			{
				anim.setInterpolator(android.view.animation.AnimationUtils.loadInterpolator(context
					, resID));
			}
			a.recycle();
			return anim;
		}