Example #1
0
        /// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        private static android.view.animation.Animation createAnimationFromXml(android.content.Context
                                                                               c, org.xmlpull.v1.XmlPullParser parser, android.view.animation.AnimationSet parent
                                                                               , android.util.AttributeSet attrs)
        {
            android.view.animation.Animation anim = 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;
                }
                string name = parser.getName();
                if (name.Equals("set"))
                {
                    anim = new android.view.animation.AnimationSet(c, attrs);
                    createAnimationFromXml(c, parser, (android.view.animation.AnimationSet)anim, attrs
                                           );
                }
                else
                {
                    if (name.Equals("alpha"))
                    {
                        anim = new android.view.animation.AlphaAnimation(c, attrs);
                    }
                    else
                    {
                        if (name.Equals("scale"))
                        {
                            anim = new android.view.animation.ScaleAnimation(c, attrs);
                        }
                        else
                        {
                            if (name.Equals("rotate"))
                            {
                                anim = new android.view.animation.RotateAnimation(c, attrs);
                            }
                            else
                            {
                                if (name.Equals("translate"))
                                {
                                    anim = new android.view.animation.TranslateAnimation(c, attrs);
                                }
                                else
                                {
                                    throw new java.lang.RuntimeException("Unknown animation name: " + parser.getName(
                                                                             ));
                                }
                            }
                        }
                    }
                }
                if (parent != null)
                {
                    parent.addAnimation(anim);
                }
            }
            return(anim);
        }
Example #2
0
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private static android.view.animation.Animation createAnimationFromXml(android.content.Context
			 c, org.xmlpull.v1.XmlPullParser parser, android.view.animation.AnimationSet parent
			, android.util.AttributeSet attrs)
		{
			android.view.animation.Animation anim = 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;
				}
				string name = parser.getName();
				if (name.Equals("set"))
				{
					anim = new android.view.animation.AnimationSet(c, attrs);
					createAnimationFromXml(c, parser, (android.view.animation.AnimationSet)anim, attrs
						);
				}
				else
				{
					if (name.Equals("alpha"))
					{
						anim = new android.view.animation.AlphaAnimation(c, attrs);
					}
					else
					{
						if (name.Equals("scale"))
						{
							anim = new android.view.animation.ScaleAnimation(c, attrs);
						}
						else
						{
							if (name.Equals("rotate"))
							{
								anim = new android.view.animation.RotateAnimation(c, attrs);
							}
							else
							{
								if (name.Equals("translate"))
								{
									anim = new android.view.animation.TranslateAnimation(c, attrs);
								}
								else
								{
									throw new java.lang.RuntimeException("Unknown animation name: " + parser.getName(
										));
								}
							}
						}
					}
				}
				if (parent != null)
				{
					parent.addAnimation(anim);
				}
			}
			return anim;
		}