示例#1
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);
        }
示例#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;
		}