protected internal override long getDelayForView(android.view.View view)
        {
            android.view.ViewGroup.LayoutParams lp = view.getLayoutParams();
            android.view.animation.GridLayoutAnimationController.AnimationParameters @params =
                (android.view.animation.GridLayoutAnimationController.AnimationParameters)lp.layoutAnimationParameters;
            if (@params == null)
            {
                return(0);
            }
            int   column       = getTransformedColumnIndex(@params);
            int   row          = getTransformedRowIndex(@params);
            int   rowsCount    = @params.rowsCount;
            int   columnsCount = @params.columnsCount;
            long  duration     = mAnimation.getDuration();
            float columnDelay  = mColumnDelay * duration;
            float rowDelay     = mRowDelay * duration;
            float totalDelay;
            long  viewDelay;

            if (mInterpolator == null)
            {
                mInterpolator = new android.view.animation.LinearInterpolator();
            }
            switch (mDirectionPriority)
            {
            case PRIORITY_COLUMN:
            {
                viewDelay  = (long)(row * rowDelay + column * rowsCount * rowDelay);
                totalDelay = rowsCount * rowDelay + columnsCount * rowsCount * rowDelay;
                break;
            }

            case PRIORITY_ROW:
            {
                viewDelay  = (long)(column * columnDelay + row * columnsCount * columnDelay);
                totalDelay = columnsCount * columnDelay + rowsCount * columnsCount * columnDelay;
                break;
            }

            case PRIORITY_NONE:
            default:
            {
                viewDelay  = (long)(column * columnDelay + row * rowDelay);
                totalDelay = columnsCount * columnDelay + rowsCount * rowDelay;
                break;
            }
            }
            float normalizedDelay = viewDelay / totalDelay;

            normalizedDelay = mInterpolator.getInterpolation(normalizedDelay);
            return((long)(normalizedDelay * totalDelay));
        }
Пример #2
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);
        }
Пример #3
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;
		}
		protected internal override long getDelayForView(android.view.View view)
		{
			android.view.ViewGroup.LayoutParams lp = view.getLayoutParams();
			android.view.animation.GridLayoutAnimationController.AnimationParameters @params = 
				(android.view.animation.GridLayoutAnimationController.AnimationParameters)lp.layoutAnimationParameters;
			if (@params == null)
			{
				return 0;
			}
			int column = getTransformedColumnIndex(@params);
			int row = getTransformedRowIndex(@params);
			int rowsCount = @params.rowsCount;
			int columnsCount = @params.columnsCount;
			long duration = mAnimation.getDuration();
			float columnDelay = mColumnDelay * duration;
			float rowDelay = mRowDelay * duration;
			float totalDelay;
			long viewDelay;
			if (mInterpolator == null)
			{
				mInterpolator = new android.view.animation.LinearInterpolator();
			}
			switch (mDirectionPriority)
			{
				case PRIORITY_COLUMN:
				{
					viewDelay = (long)(row * rowDelay + column * rowsCount * rowDelay);
					totalDelay = rowsCount * rowDelay + columnsCount * rowsCount * rowDelay;
					break;
				}

				case PRIORITY_ROW:
				{
					viewDelay = (long)(column * columnDelay + row * columnsCount * columnDelay);
					totalDelay = columnsCount * columnDelay + rowsCount * columnsCount * columnDelay;
					break;
				}

				case PRIORITY_NONE:
				default:
				{
					viewDelay = (long)(column * columnDelay + row * rowDelay);
					totalDelay = columnsCount * columnDelay + rowsCount * rowDelay;
					break;
				}
			}
			float normalizedDelay = viewDelay / totalDelay;
			normalizedDelay = mInterpolator.getInterpolation(normalizedDelay);
			return (long)(normalizedDelay * totalDelay);
		}