示例#1
0
		/// <summary>Read a HashSet object from an XmlPullParser.</summary>
		/// <remarks>
		/// Read a HashSet object from an XmlPullParser. The XML data could previously
		/// have been generated by writeSetXml(). The XmlPullParser must be positioned
		/// <em>after</em> the tag that begins the set.
		/// </remarks>
		/// <param name="parser">The XmlPullParser from which to read the set data.</param>
		/// <param name="endTag">Name of the tag that will end the set, usually "set".</param>
		/// <param name="name">
		/// An array of one string, used to return the name attribute
		/// of the set's tag.
		/// </param>
		/// <returns>HashSet The newly generated set.</returns>
		/// <exception cref="org.xmlpull.v1.XmlPullParserException">org.xmlpull.v1.XmlPullParserException
		/// 	</exception>
		/// <exception cref="System.IO.IOException">System.IO.IOException</exception>
		/// <seealso cref="readSetXml(java.io.InputStream)">readSetXml(java.io.InputStream)</seealso>
		public static java.util.HashSet<object> readThisSetXml(org.xmlpull.v1.XmlPullParser
			 parser, string endTag, string[] name)
		{
			java.util.HashSet<object> set = new java.util.HashSet<object>();
			int eventType = parser.getEventType();
			do
			{
				if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					object val = readThisValueXml(parser, name);
					set.add(val);
				}
				else
				{
					//System.out.println("Adding to set: " + val);
					if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
					{
						if (parser.getName().Equals(endTag))
						{
							return set;
						}
						throw new org.xmlpull.v1.XmlPullParserException("Expected " + endTag + " end tag at: "
							 + parser.getName());
					}
				}
				eventType = parser.next();
			}
			while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT);
			throw new org.xmlpull.v1.XmlPullParserException("Document ended before " + endTag
				 + " end tag");
		}
示例#2
0
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public static void beginDocument(org.xmlpull.v1.XmlPullParser parser, string firstElementName
			)
		{
			int type;
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.START_TAG && type
				 != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT)
			{
			}
			if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
			{
				throw new org.xmlpull.v1.XmlPullParserException("No start tag found");
			}
			if (!parser.getName().Equals(firstElementName))
			{
				throw new org.xmlpull.v1.XmlPullParserException("Unexpected start tag: found " + 
					parser.getName() + ", expected " + firstElementName);
			}
		}
示例#3
0
		/// <summary>Read a HashMap object from an XmlPullParser.</summary>
		/// <remarks>
		/// Read a HashMap object from an XmlPullParser.  The XML data could
		/// previously have been generated by writeMapXml().  The XmlPullParser
		/// must be positioned <em>after</em> the tag that begins the map.
		/// </remarks>
		/// <param name="parser">The XmlPullParser from which to read the map data.</param>
		/// <param name="endTag">Name of the tag that will end the map, usually "map".</param>
		/// <param name="name">
		/// An array of one string, used to return the name attribute
		/// of the map's tag.
		/// </param>
		/// <returns>HashMap The newly generated map.</returns>
		/// <seealso cref="readMapXml(java.io.InputStream)">readMapXml(java.io.InputStream)</seealso>
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public static java.util.HashMap<object, object> readThisMapXml(org.xmlpull.v1.XmlPullParser
			 parser, string endTag, string[] name)
		{
			java.util.HashMap<object, object> map = new java.util.HashMap<object, object>();
			int eventType = parser.getEventType();
			do
			{
				if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					object val = readThisValueXml(parser, name);
					if (name[0] != null)
					{
						//System.out.println("Adding to map: " + name + " -> " + val);
						map.put(name[0], val);
					}
					else
					{
						throw new org.xmlpull.v1.XmlPullParserException("Map value without name attribute: "
							 + parser.getName());
					}
				}
				else
				{
					if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
					{
						if (parser.getName().Equals(endTag))
						{
							return map;
						}
						throw new org.xmlpull.v1.XmlPullParserException("Expected " + endTag + " end tag at: "
							 + parser.getName());
					}
				}
				eventType = parser.next();
			}
			while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT);
			throw new org.xmlpull.v1.XmlPullParserException("Document ended before " + endTag
				 + " end tag");
		}
示例#4
0
		/// <summary>Inflate a new view hierarchy from the specified XML node.</summary>
		/// <remarks>
		/// Inflate a new view hierarchy from the specified XML node. Throws
		/// <see cref="InflateException">InflateException</see>
		/// if there is an error.
		/// <p>
		/// <em><strong>Important</strong></em>&nbsp;&nbsp;&nbsp;For performance
		/// reasons, view inflation relies heavily on pre-processing of XML files
		/// that is done at build time. Therefore, it is not currently possible to
		/// use LayoutInflater with an XmlPullParser over a plain XML file at runtime.
		/// </remarks>
		/// <param name="parser">
		/// XML dom node containing the description of the view
		/// hierarchy.
		/// </param>
		/// <param name="root">
		/// Optional view to be the parent of the generated hierarchy (if
		/// <em>attachToRoot</em> is true), or else simply an object that
		/// provides a set of LayoutParams values for root of the returned
		/// hierarchy (if <em>attachToRoot</em> is false.)
		/// </param>
		/// <param name="attachToRoot">
		/// Whether the inflated hierarchy should be attached to
		/// the root parameter? If false, root is only used to create the
		/// correct subclass of LayoutParams for the root view in the XML.
		/// </param>
		/// <returns>
		/// The root View of the inflated hierarchy. If root was supplied and
		/// attachToRoot is true, this is root; otherwise it is the root of
		/// the inflated XML file.
		/// </returns>
		public virtual android.view.View inflate(org.xmlpull.v1.XmlPullParser parser, android.view.ViewGroup
			 root, bool attachToRoot)
		{
			lock (mConstructorArgs)
			{
				android.util.AttributeSet attrs = android.util.Xml.asAttributeSet(parser);
				android.content.Context lastContext = (android.content.Context)mConstructorArgs[0
					];
				mConstructorArgs[0] = mContext;
				android.view.View result = root;
				try
				{
					// Look for the root node.
					int type;
					while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.START_TAG && type
						 != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT)
					{
					}
					// Empty
					if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
					{
						throw new android.view.InflateException(parser.getPositionDescription() + ": No start tag found!"
							);
					}
					string name = parser.getName();
					if (TAG_MERGE.Equals(name))
					{
						if (root == null || !attachToRoot)
						{
							throw new android.view.InflateException("<merge /> can be used only with a valid "
								 + "ViewGroup root and attachToRoot=true");
						}
						rInflate(parser, root, attrs, false);
					}
					else
					{
						// Temp is the root view that was found in the xml
						android.view.View temp;
						if (TAG_1995.Equals(name))
						{
							temp = new android.view.LayoutInflater.BlinkLayout(mContext, attrs);
						}
						else
						{
							temp = createViewFromTag(root, name, attrs);
						}
						android.view.ViewGroup.LayoutParams @params = null;
						if (root != null)
						{
							// Create layout params that match root, if supplied
							@params = root.generateLayoutParams(attrs);
							if (!attachToRoot)
							{
								// Set the layout params for temp if we are not
								// attaching. (If we are, we use addView, below)
								temp.setLayoutParams(@params);
							}
						}
						// Inflate all children under temp
						rInflate(parser, temp, attrs, true);
						// We are supposed to attach all the views we found (int temp)
						// to root. Do that now.
						if (root != null && attachToRoot)
						{
							root.addView(temp, @params);
						}
						// Decide whether to return the root that was passed in or the
						// top view found in xml.
						if (root == null || !attachToRoot)
						{
							result = temp;
						}
					}
				}
				catch (org.xmlpull.v1.XmlPullParserException e)
				{
					android.view.InflateException ex = new android.view.InflateException(e.Message);
					ex.InnerException = e;
					throw ex;
				}
				catch (System.IO.IOException e)
				{
					android.view.InflateException ex = new android.view.InflateException(parser.getPositionDescription
						() + ": " + e.Message);
					ex.InnerException = e;
					throw ex;
				}
				finally
				{
					// Don't retain static reference on context.
					mConstructorArgs[0] = lastContext;
					mConstructorArgs[1] = null;
				}
				return result;
			}
		}
示例#5
0
		public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
			 parser, android.util.AttributeSet attrs)
		{
			android.graphics.drawable.GradientDrawable.GradientState st = mGradientState;
			android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
				styleable.GradientDrawable);
			base.inflateWithAttributes(r, parser, a, [email protected]_visible
				);
			int shapeType = a.getInt([email protected]_shape, RECTANGLE
				);
			bool dither = a.getBoolean([email protected]_dither, 
				false);
			if (shapeType == RING)
			{
				st.mInnerRadius = a.getDimensionPixelSize([email protected]_innerRadius
					, -1);
				if (st.mInnerRadius == -1)
				{
					st.mInnerRadiusRatio = a.getFloat([email protected]_innerRadiusRatio
						, 3.0f);
				}
				st.mThickness = a.getDimensionPixelSize([email protected]_thickness
					, -1);
				if (st.mThickness == -1)
				{
					st.mThicknessRatio = a.getFloat([email protected]_thicknessRatio
						, 9.0f);
				}
				st.mUseLevelForShape = a.getBoolean([email protected]_useLevel
					, true);
			}
			a.recycle();
			setShape(shapeType);
			setDither(dither);
			int type;
			int innerDepth = parser.getDepth() + 1;
			int depth;
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
				 ((depth = parser.getDepth()) >= innerDepth || type != org.xmlpull.v1.XmlPullParserClass.END_TAG
				))
			{
				if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					continue;
				}
				if (depth > innerDepth)
				{
					continue;
				}
				string name = parser.getName();
				if (name.Equals("size"))
				{
					a = r.obtainAttributes(attrs, [email protected]);
					int width = a.getDimensionPixelSize([email protected]_width
						, -1);
					int height = a.getDimensionPixelSize([email protected]_height
						, -1);
					a.recycle();
					setSize(width, height);
				}
				else
				{
					if (name.Equals("gradient"))
					{
						a = r.obtainAttributes(attrs, [email protected]
							);
						int startColor = a.getColor([email protected]_startColor
							, 0);
						bool hasCenterColor = a.hasValue([email protected]_centerColor
							);
						int centerColor = a.getColor([email protected]_centerColor
							, 0);
						int endColor = a.getColor([email protected]_endColor
							, 0);
						int gradientType = a.getInt([email protected]_type
							, LINEAR_GRADIENT);
						st.mCenterX = getFloatOrFraction(a, [email protected]_centerX
							, 0.5f);
						st.mCenterY = getFloatOrFraction(a, [email protected]_centerY
							, 0.5f);
						st.mUseLevel = a.getBoolean([email protected]_useLevel
							, false);
						st.mGradient = gradientType;
						if (gradientType == LINEAR_GRADIENT)
						{
							int angle = (int)a.getFloat([email protected]_angle
								, 0);
							angle %= 360;
							if (angle % 45 != 0)
							{
								throw new org.xmlpull.v1.XmlPullParserException(a.getPositionDescription() + "<gradient> tag requires 'angle' attribute to "
									 + "be a multiple of 45");
							}
							switch (angle)
							{
								case 0:
								{
									st.mOrientation = android.graphics.drawable.GradientDrawable.Orientation.LEFT_RIGHT;
									break;
								}

								case 45:
								{
									st.mOrientation = android.graphics.drawable.GradientDrawable.Orientation.BL_TR;
									break;
								}

								case 90:
								{
									st.mOrientation = android.graphics.drawable.GradientDrawable.Orientation.BOTTOM_TOP;
									break;
								}

								case 135:
								{
									st.mOrientation = android.graphics.drawable.GradientDrawable.Orientation.BR_TL;
									break;
								}

								case 180:
								{
									st.mOrientation = android.graphics.drawable.GradientDrawable.Orientation.RIGHT_LEFT;
									break;
								}

								case 225:
								{
									st.mOrientation = android.graphics.drawable.GradientDrawable.Orientation.TR_BL;
									break;
								}

								case 270:
								{
									st.mOrientation = android.graphics.drawable.GradientDrawable.Orientation.TOP_BOTTOM;
									break;
								}

								case 315:
								{
									st.mOrientation = android.graphics.drawable.GradientDrawable.Orientation.TL_BR;
									break;
								}
							}
						}
						else
						{
							android.util.TypedValue tv = a.peekValue([email protected]_gradientRadius
								);
							if (tv != null)
							{
								bool radiusRel = tv.type == android.util.TypedValue.TYPE_FRACTION;
								st.mGradientRadius = radiusRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
							}
							else
							{
								if (gradientType == RADIAL_GRADIENT)
								{
									throw new org.xmlpull.v1.XmlPullParserException(a.getPositionDescription() + "<gradient> tag requires 'gradientRadius' "
										 + "attribute with radial type");
								}
							}
						}
						a.recycle();
						if (hasCenterColor)
						{
							st.mColors = new int[3];
							st.mColors[0] = startColor;
							st.mColors[1] = centerColor;
							st.mColors[2] = endColor;
							st.mPositions = new float[3];
							st.mPositions[0] = 0.0f;
							// Since 0.5f is default value, try to take the one that isn't 0.5f
							st.mPositions[1] = st.mCenterX != 0.5f ? st.mCenterX : st.mCenterY;
							st.mPositions[2] = 1f;
						}
						else
						{
							st.mColors = new int[2];
							st.mColors[0] = startColor;
							st.mColors[1] = endColor;
						}
					}
					else
					{
						if (name.Equals("solid"))
						{
							a = r.obtainAttributes(attrs, [email protected]
								);
							int argb = a.getColor([email protected]_color, 
								0);
							a.recycle();
							setColor(argb);
						}
						else
						{
							if (name.Equals("stroke"))
							{
								a = r.obtainAttributes(attrs, [email protected]
									);
								int width = a.getDimensionPixelSize([email protected]_width
									, 0);
								int color = a.getColor([email protected]_color
									, 0);
								float dashWidth = a.getDimension([email protected]_dashWidth
									, 0);
								if (dashWidth != 0.0f)
								{
									float dashGap = a.getDimension([email protected]_dashGap
										, 0);
									setStroke(width, color, dashWidth, dashGap);
								}
								else
								{
									setStroke(width, color);
								}
								a.recycle();
							}
							else
							{
								if (name.Equals("corners"))
								{
									a = r.obtainAttributes(attrs, [email protected]);
									int radius = a.getDimensionPixelSize([email protected]_radius
										, 0);
									setCornerRadius(radius);
									int topLeftRadius = a.getDimensionPixelSize([email protected]_topLeftRadius
										, radius);
									int topRightRadius = a.getDimensionPixelSize([email protected]_topRightRadius
										, radius);
									int bottomLeftRadius = a.getDimensionPixelSize([email protected]_bottomLeftRadius
										, radius);
									int bottomRightRadius = a.getDimensionPixelSize([email protected]_bottomRightRadius
										, radius);
									if (topLeftRadius != radius || topRightRadius != radius || bottomLeftRadius != radius
										 || bottomRightRadius != radius)
									{
										// The corner radii are specified in clockwise order (see Path.addRoundRect())
										setCornerRadii(new float[] { topLeftRadius, topLeftRadius, topRightRadius, topRightRadius
											, bottomRightRadius, bottomRightRadius, bottomLeftRadius, bottomLeftRadius });
									}
									a.recycle();
								}
								else
								{
									if (name.Equals("padding"))
									{
										a = r.obtainAttributes(attrs, [email protected]
											);
										mPadding = new android.graphics.Rect(a.getDimensionPixelOffset([email protected]
											.styleable.GradientDrawablePadding_left, 0), a.getDimensionPixelOffset([email protected]
											.styleable.GradientDrawablePadding_top, 0), a.getDimensionPixelOffset([email protected]
											.styleable.GradientDrawablePadding_right, 0), a.getDimensionPixelOffset([email protected]
											.styleable.GradientDrawablePadding_bottom, 0));
										a.recycle();
										mGradientState.mPadding = mPadding;
									}
									else
									{
										android.util.Log.w("drawable", "Bad element under <shape>: " + name);
									}
								}
							}
						}
					}
				}
			}
		}
示例#6
0
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private static object readThisValueXml(org.xmlpull.v1.XmlPullParser parser, string
			[] name)
		{
			string valueName = parser.getAttributeValue(null, "name");
			string tagName = parser.getName();
			//System.out.println("Reading this value tag: " + tagName + ", name=" + valueName);
			object res;
			if (tagName.Equals("null"))
			{
				res = null;
			}
			else
			{
				if (tagName.Equals("string"))
				{
					string value = string.Empty;
					int eventType;
					while ((eventType = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT
						)
					{
						if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
						{
							if (parser.getName().Equals("string"))
							{
								name[0] = valueName;
								//System.out.println("Returning value for " + valueName + ": " + value);
								return value;
							}
							throw new org.xmlpull.v1.XmlPullParserException("Unexpected end tag in <string>: "
								 + parser.getName());
						}
						else
						{
							if (eventType == org.xmlpull.v1.XmlPullParserClass.TEXT)
							{
								value += parser.getText();
							}
							else
							{
								if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
								{
									throw new org.xmlpull.v1.XmlPullParserException("Unexpected start tag in <string>: "
										 + parser.getName());
								}
							}
						}
					}
					throw new org.xmlpull.v1.XmlPullParserException("Unexpected end of document in <string>"
						);
				}
				else
				{
					if (tagName.Equals("int"))
					{
						res = System.Convert.ToInt32(parser.getAttributeValue(null, "value"));
					}
					else
					{
						if (tagName.Equals("long"))
						{
							res = long.Parse(parser.getAttributeValue(null, "value"));
						}
						else
						{
							if (tagName.Equals("float"))
							{
								res = System.Convert.ToSingle(parser.getAttributeValue(null, "value"));
							}
							else
							{
								if (tagName.Equals("double"))
								{
									res = System.Convert.ToDouble(parser.getAttributeValue(null, "value"));
								}
								else
								{
									if (tagName.Equals("boolean"))
									{
										res = bool.Parse(parser.getAttributeValue(null, "value"));
									}
									else
									{
										if (tagName.Equals("int-array"))
										{
											parser.next();
											res = readThisIntArrayXml(parser, "int-array", name);
											name[0] = valueName;
											//System.out.println("Returning value for " + valueName + ": " + res);
											return res;
										}
										else
										{
											if (tagName.Equals("map"))
											{
												parser.next();
												res = readThisMapXml(parser, "map", name);
												name[0] = valueName;
												//System.out.println("Returning value for " + valueName + ": " + res);
												return res;
											}
											else
											{
												if (tagName.Equals("list"))
												{
													parser.next();
													res = readThisListXml(parser, "list", name);
													name[0] = valueName;
													//System.out.println("Returning value for " + valueName + ": " + res);
													return res;
												}
												else
												{
													if (tagName.Equals("set"))
													{
														parser.next();
														res = readThisSetXml(parser, "set", name);
														name[0] = valueName;
														//System.out.println("Returning value for " + valueName + ": " + res);
														return res;
													}
													else
													{
														throw new org.xmlpull.v1.XmlPullParserException("Unknown tag: " + tagName);
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			// Skip through to end tag.
			int eventType_1;
			while ((eventType_1 = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT
				)
			{
				if (eventType_1 == org.xmlpull.v1.XmlPullParserClass.END_TAG)
				{
					if (parser.getName().Equals(tagName))
					{
						name[0] = valueName;
						//System.out.println("Returning value for " + valueName + ": " + res);
						return res;
					}
					throw new org.xmlpull.v1.XmlPullParserException("Unexpected end tag in <" + tagName
						 + ">: " + parser.getName());
				}
				else
				{
					if (eventType_1 == org.xmlpull.v1.XmlPullParserClass.TEXT)
					{
						throw new org.xmlpull.v1.XmlPullParserException("Unexpected text in <" + tagName 
							+ ">: " + parser.getName());
					}
					else
					{
						if (eventType_1 == org.xmlpull.v1.XmlPullParserClass.START_TAG)
						{
							throw new org.xmlpull.v1.XmlPullParserException("Unexpected start tag in <" + tagName
								 + ">: " + parser.getName());
						}
					}
				}
			}
			throw new org.xmlpull.v1.XmlPullParserException("Unexpected end of document in <"
				 + tagName + ">");
		}
示例#7
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 org.openrdf.query.UnsupportedQueryLanguageException UnsupportedQueryLanguage(org.openrdf.query.QueryLanguage ql)
 {
     throw new org.openrdf.query.UnsupportedQueryLanguageException("dotNetRDF Repository Connections do not support the " + ql.getName() + " Query Language");
 }
 protected bool SupportsQueryLanguage(org.openrdf.query.QueryLanguage ql)
 {
     return ql.getName().ToUpper().Equals("SPARQL");
 }
示例#10
0
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private static android.animation.Animator createAnimatorFromXml(android.content.Context
			 c, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs, android.animation.AnimatorSet
			 parent, int sequenceOrdering)
		{
			android.animation.Animator anim = null;
			java.util.ArrayList<android.animation.Animator> childAnims = 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("objectAnimator"))
				{
					anim = loadObjectAnimator(c, attrs);
				}
				else
				{
					if (name.Equals("animator"))
					{
						anim = loadAnimator(c, attrs, null);
					}
					else
					{
						if (name.Equals("set"))
						{
							anim = new android.animation.AnimatorSet();
							android.content.res.TypedArray a = c.obtainStyledAttributes(attrs, [email protected]
								.styleable.AnimatorSet);
							int ordering = a.getInt([email protected]_ordering, TOGETHER
								);
							createAnimatorFromXml(c, parser, attrs, (android.animation.AnimatorSet)anim, ordering
								);
							a.recycle();
						}
						else
						{
							throw new java.lang.RuntimeException("Unknown animator name: " + parser.getName()
								);
						}
					}
				}
				if (parent != null)
				{
					if (childAnims == null)
					{
						childAnims = new java.util.ArrayList<android.animation.Animator>();
					}
					childAnims.add(anim);
				}
			}
			if (parent != null && childAnims != null)
			{
				android.animation.Animator[] animsArray = new android.animation.Animator[childAnims
					.size()];
				int index = 0;
				foreach (android.animation.Animator a in Sharpen.IterableProxy.Create(childAnims))
				{
					animsArray[index++] = a;
				}
				if (sequenceOrdering == TOGETHER)
				{
					parent.playTogether(animsArray);
				}
				else
				{
					parent.playSequentially(animsArray);
				}
			}
			return anim;
		}
示例#11
0
		public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
			 parser, android.util.AttributeSet attrs)
		{
			base.inflate(r, parser, attrs);
			int type;
			int innerDepth = parser.getDepth() + 1;
			int depth;
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
				 ((depth = parser.getDepth()) >= innerDepth || type != org.xmlpull.v1.XmlPullParserClass.END_TAG
				))
			{
				if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					continue;
				}
				if (depth > innerDepth || !parser.getName().Equals("item"))
				{
					continue;
				}
				android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
					styleable.MipmapDrawableItem);
				int drawableRes = a.getResourceId([email protected]_drawable
					, 0);
				a.recycle();
				android.graphics.drawable.Drawable dr;
				if (drawableRes != 0)
				{
					dr = r.getDrawable(drawableRes);
				}
				else
				{
					while ((type = parser.next()) == org.xmlpull.v1.XmlPullParserClass.TEXT)
					{
					}
					if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
					{
						throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
							 ": <item> tag requires a 'drawable' attribute or " + "child tag defining a drawable"
							);
					}
					dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs);
				}
				mMipmapContainerState.addDrawable(dr);
			}
			onDrawableAdded();
		}
示例#12
0
		public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
			 parser, android.util.AttributeSet attrs)
		{
			android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
				styleable.StateListDrawable);
			base.inflateWithAttributes(r, parser, a, [email protected]_visible
				);
			mStateListState.setVariablePadding(a.getBoolean([email protected]_variablePadding
				, false));
			mStateListState.setConstantSize(a.getBoolean([email protected]_constantSize
				, false));
			mStateListState.setEnterFadeDuration(a.getInt([email protected]_enterFadeDuration
				, 0));
			mStateListState.setExitFadeDuration(a.getInt([email protected]_exitFadeDuration
				, 0));
			setDither(a.getBoolean([email protected]_dither, DEFAULT_DITHER
				));
			a.recycle();
			int type;
			int innerDepth = parser.getDepth() + 1;
			int depth;
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
				 ((depth = parser.getDepth()) >= innerDepth || type != org.xmlpull.v1.XmlPullParserClass.END_TAG
				))
			{
				if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					continue;
				}
				if (depth > innerDepth || !parser.getName().Equals("item"))
				{
					continue;
				}
				int drawableRes = 0;
				int i;
				int j = 0;
				int numAttrs = attrs.getAttributeCount();
				int[] states = new int[numAttrs];
				for (i = 0; i < numAttrs; i++)
				{
					int stateResId = attrs.getAttributeNameResource(i);
					if (stateResId == 0)
					{
						break;
					}
					if (stateResId == [email protected])
					{
						drawableRes = attrs.getAttributeResourceValue(i, 0);
					}
					else
					{
						states[j++] = attrs.getAttributeBooleanValue(i, false) ? stateResId : -stateResId;
					}
				}
				states = android.util.StateSet.trimStateSet(states, j);
				android.graphics.drawable.Drawable dr;
				if (drawableRes != 0)
				{
					dr = r.getDrawable(drawableRes);
				}
				else
				{
					while ((type = parser.next()) == org.xmlpull.v1.XmlPullParserClass.TEXT)
					{
					}
					if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
					{
						throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
							 ": <item> tag requires a 'drawable' attribute or " + "child tag defining a drawable"
							);
					}
					dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs);
				}
				mStateListState.addStateSet(states, dr);
			}
			onStateChange(getState());
		}
示例#13
0
		public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
			 parser, android.util.AttributeSet attrs)
		{
			android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
				styleable.RotateDrawable);
			base.inflateWithAttributes(r, parser, a, [email protected]_visible
				);
			android.util.TypedValue tv = a.peekValue([email protected]_pivotX
				);
			bool pivotXRel;
			float pivotX;
			if (tv == null)
			{
				pivotXRel = true;
				pivotX = 0.5f;
			}
			else
			{
				pivotXRel = tv.type == android.util.TypedValue.TYPE_FRACTION;
				pivotX = pivotXRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
			}
			tv = a.peekValue([email protected]_pivotY);
			bool pivotYRel;
			float pivotY;
			if (tv == null)
			{
				pivotYRel = true;
				pivotY = 0.5f;
			}
			else
			{
				pivotYRel = tv.type == android.util.TypedValue.TYPE_FRACTION;
				pivotY = pivotYRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
			}
			float fromDegrees = a.getFloat([email protected]_fromDegrees
				, 0.0f);
			float toDegrees = a.getFloat([email protected]_toDegrees
				, 360.0f);
			int res = a.getResourceId([email protected]_drawable, 
				0);
			android.graphics.drawable.Drawable drawable = null;
			if (res > 0)
			{
				drawable = r.getDrawable(res);
			}
			a.recycle();
			int outerDepth = parser.getDepth();
			int type;
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
				 (type != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser.getDepth() > outerDepth
				))
			{
				if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					continue;
				}
				if ((drawable = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, 
					attrs)) == null)
				{
					android.util.Log.w("drawable", "Bad element under <rotate>: " + parser.getName());
				}
			}
			if (drawable == null)
			{
				android.util.Log.w("drawable", "No drawable specified for <rotate>");
			}
			mState.mDrawable = drawable;
			mState.mPivotXRel = pivotXRel;
			mState.mPivotX = pivotX;
			mState.mPivotYRel = pivotYRel;
			mState.mPivotY = pivotY;
			mState.mFromDegrees = mState.mCurrentDegrees = fromDegrees;
			mState.mToDegrees = toDegrees;
			if (drawable != null)
			{
				drawable.setCallback(this);
			}
		}
示例#14
0
		public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
			 parser, android.util.AttributeSet attrs)
		{
			android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
				styleable.AnimationDrawable);
			base.inflateWithAttributes(r, parser, a, [email protected]_visible
				);
			mAnimationState.setVariablePadding(a.getBoolean([email protected]_variablePadding
				, false));
			mAnimationState.mOneShot = a.getBoolean([email protected]_oneshot
				, false);
			a.recycle();
			int type;
			int innerDepth = parser.getDepth() + 1;
			int depth;
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
				 ((depth = parser.getDepth()) >= innerDepth || type != org.xmlpull.v1.XmlPullParserClass.END_TAG
				))
			{
				if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					continue;
				}
				if (depth > innerDepth || !parser.getName().Equals("item"))
				{
					continue;
				}
				a = r.obtainAttributes(attrs, [email protected]
					);
				int duration = a.getInt([email protected]_duration
					, -1);
				if (duration < 0)
				{
					throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
						 ": <item> tag requires a 'duration' attribute");
				}
				int drawableRes = a.getResourceId([email protected]_drawable
					, 0);
				a.recycle();
				android.graphics.drawable.Drawable dr;
				if (drawableRes != 0)
				{
					dr = r.getDrawable(drawableRes);
				}
				else
				{
					while ((type = parser.next()) == org.xmlpull.v1.XmlPullParserClass.TEXT)
					{
					}
					// Empty
					if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
					{
						throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
							 ": <item> tag requires a 'drawable' attribute or child tag" + " defining a drawable"
							);
					}
					dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs);
				}
				mAnimationState.addFrame(dr, duration);
				if (dr != null)
				{
					dr.setCallback(this);
				}
			}
			setFrame(0, true, false);
		}
示例#15
0
		/// <summary>Read an int[] object from an XmlPullParser.</summary>
		/// <remarks>
		/// Read an int[] object from an XmlPullParser.  The XML data could
		/// previously have been generated by writeIntArrayXml().  The XmlPullParser
		/// must be positioned <em>after</em> the tag that begins the list.
		/// </remarks>
		/// <param name="parser">The XmlPullParser from which to read the list data.</param>
		/// <param name="endTag">Name of the tag that will end the list, usually "list".</param>
		/// <param name="name">
		/// An array of one string, used to return the name attribute
		/// of the list's tag.
		/// </param>
		/// <returns>Returns a newly generated int[].</returns>
		/// <seealso cref="readListXml(java.io.InputStream)">readListXml(java.io.InputStream)
		/// 	</seealso>
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public static int[] readThisIntArrayXml(org.xmlpull.v1.XmlPullParser parser, string
			 endTag, string[] name)
		{
			int num;
			try
			{
				num = System.Convert.ToInt32(parser.getAttributeValue(null, "num"));
			}
			catch (System.ArgumentNullException)
			{
				throw new org.xmlpull.v1.XmlPullParserException("Need num attribute in byte-array"
					);
			}
			catch (System.ArgumentException)
			{
				throw new org.xmlpull.v1.XmlPullParserException("Not a number in num attribute in byte-array"
					);
			}
			int[] array = new int[num];
			int i = 0;
			int eventType = parser.getEventType();
			do
			{
				if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					if (parser.getName().Equals("item"))
					{
						try
						{
							array[i] = System.Convert.ToInt32(parser.getAttributeValue(null, "value"));
						}
						catch (System.ArgumentNullException)
						{
							throw new org.xmlpull.v1.XmlPullParserException("Need value attribute in item");
						}
						catch (System.ArgumentException)
						{
							throw new org.xmlpull.v1.XmlPullParserException("Not a number in value attribute in item"
								);
						}
					}
					else
					{
						throw new org.xmlpull.v1.XmlPullParserException("Expected item tag at: " + parser
							.getName());
					}
				}
				else
				{
					if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
					{
						if (parser.getName().Equals(endTag))
						{
							return array;
						}
						else
						{
							if (parser.getName().Equals("item"))
							{
								i++;
							}
							else
							{
								throw new org.xmlpull.v1.XmlPullParserException("Expected " + endTag + " end tag at: "
									 + parser.getName());
							}
						}
					}
				}
				eventType = parser.next();
			}
			while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT);
			throw new org.xmlpull.v1.XmlPullParserException("Document ended before " + endTag
				 + " end tag");
		}
示例#16
0
		public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
			 parser, android.util.AttributeSet attrs)
		{
			base.inflate(r, parser, attrs);
			int type;
			android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
				styleable.LayerDrawable);
			mOpacityOverride = a.getInt([email protected]_opacity, 
				android.graphics.PixelFormat.UNKNOWN);
			a.recycle();
			int innerDepth = parser.getDepth() + 1;
			int depth;
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
				 ((depth = parser.getDepth()) >= innerDepth || type != org.xmlpull.v1.XmlPullParserClass.END_TAG
				))
			{
				if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					continue;
				}
				if (depth > innerDepth || !parser.getName().Equals("item"))
				{
					continue;
				}
				a = r.obtainAttributes(attrs, [email protected]);
				int left = a.getDimensionPixelOffset([email protected]_left
					, 0);
				int top = a.getDimensionPixelOffset([email protected]_top
					, 0);
				int right = a.getDimensionPixelOffset([email protected]_right
					, 0);
				int bottom = a.getDimensionPixelOffset([email protected]_bottom
					, 0);
				int drawableRes = a.getResourceId([email protected]_drawable
					, 0);
				int id = a.getResourceId([email protected]_id, android.view.View
					.NO_ID);
				a.recycle();
				android.graphics.drawable.Drawable dr;
				if (drawableRes != 0)
				{
					dr = r.getDrawable(drawableRes);
				}
				else
				{
					while ((type = parser.next()) == org.xmlpull.v1.XmlPullParserClass.TEXT)
					{
					}
					if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
					{
						throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
							 ": <item> tag requires a 'drawable' attribute or " + "child tag defining a drawable"
							);
					}
					dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs);
				}
				addLayer(dr, id, left, top, right, bottom);
			}
			ensurePadding();
			onStateChange(getState());
		}
示例#17
0
		/// <summary>Read a flattened object from an XmlPullParser.</summary>
		/// <remarks>
		/// Read a flattened object from an XmlPullParser.  The XML data could
		/// previously have been written with writeMapXml(), writeListXml(), or
		/// writeValueXml().  The XmlPullParser must be positioned <em>at</em> the
		/// tag that defines the value.
		/// </remarks>
		/// <param name="parser">The XmlPullParser from which to read the object.</param>
		/// <param name="name">
		/// An array of one string, used to return the name attribute
		/// of the value's tag.
		/// </param>
		/// <returns>Object The newly generated value object.</returns>
		/// <seealso cref="readMapXml(java.io.InputStream)">readMapXml(java.io.InputStream)</seealso>
		/// <seealso cref="readListXml(java.io.InputStream)">readListXml(java.io.InputStream)
		/// 	</seealso>
		/// <seealso cref="writeValueXml(object, string, org.xmlpull.v1.XmlSerializer)">writeValueXml(object, string, org.xmlpull.v1.XmlSerializer)
		/// 	</seealso>
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public static object readValueXml(org.xmlpull.v1.XmlPullParser parser, string[] name
			)
		{
			int eventType = parser.getEventType();
			do
			{
				if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					return readThisValueXml(parser, name);
				}
				else
				{
					if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
					{
						throw new org.xmlpull.v1.XmlPullParserException("Unexpected end tag at: " + parser
							.getName());
					}
					else
					{
						if (eventType == org.xmlpull.v1.XmlPullParserClass.TEXT)
						{
							throw new org.xmlpull.v1.XmlPullParserException("Unexpected text: " + parser.getText
								());
						}
					}
				}
				eventType = parser.next();
			}
			while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT);
			throw new org.xmlpull.v1.XmlPullParserException("Unexpected end of document");
		}
示例#18
0
		public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
			 parser, android.util.AttributeSet attrs)
		{
			base.inflate(r, parser, attrs);
			android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
				styleable.ShapeDrawable);
			int color = mShapeState.mPaint.getColor();
			color = a.getColor([email protected]_color, color);
			mShapeState.mPaint.setColor(color);
			bool dither = a.getBoolean([email protected]_dither, false
				);
			mShapeState.mPaint.setDither(dither);
			setIntrinsicWidth((int)a.getDimension([email protected]_width
				, 0f));
			setIntrinsicHeight((int)a.getDimension([email protected]_height
				, 0f));
			a.recycle();
			int type;
			int outerDepth = parser.getDepth();
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
				 (type != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser.getDepth() > outerDepth
				))
			{
				if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					continue;
				}
				string name = parser.getName();
				// call our subclass
				if (!inflateTag(name, r, parser, attrs))
				{
					android.util.Log.w("drawable", "Unknown element: " + name + " for ShapeDrawable "
						 + this);
				}
			}
		}
示例#19
0
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private static android.view.animation.LayoutAnimationController createLayoutAnimationFromXml
			(android.content.Context c, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet
			 attrs)
		{
			android.view.animation.LayoutAnimationController controller = null;
			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 ("layoutAnimation".Equals(name))
				{
					controller = new android.view.animation.LayoutAnimationController(c, attrs);
				}
				else
				{
					if ("gridLayoutAnimation".Equals(name))
					{
						controller = new android.view.animation.GridLayoutAnimationController(c, attrs);
					}
					else
					{
						throw new java.lang.RuntimeException("Unknown layout animation name: " + name);
					}
				}
			}
			return controller;
		}
示例#20
0
		/// <summary>Create from inside an XML document.</summary>
		/// <remarks>
		/// Create from inside an XML document.  Called on a parser positioned at
		/// a tag in an XML document, tries to create a Drawable from that tag.
		/// Returns null if the tag is not a valid drawable.
		/// </remarks>
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public static android.graphics.drawable.Drawable createFromXmlInner(android.content.res.Resources
			 r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs)
		{
			android.graphics.drawable.Drawable drawable;
			string name = parser.getName();
			if (name.Equals("selector"))
			{
				drawable = new android.graphics.drawable.StateListDrawable();
			}
			else
			{
				if (name.Equals("level-list"))
				{
					drawable = new android.graphics.drawable.LevelListDrawable();
				}
				else
				{
					if (name.Equals("layer-list"))
					{
						drawable = new android.graphics.drawable.LayerDrawable();
					}
					else
					{
						if (name.Equals("transition"))
						{
							drawable = new android.graphics.drawable.TransitionDrawable();
						}
						else
						{
							if (name.Equals("color"))
							{
								drawable = new android.graphics.drawable.ColorDrawable();
							}
							else
							{
								if (name.Equals("shape"))
								{
									drawable = new android.graphics.drawable.GradientDrawable();
								}
								else
								{
									if (name.Equals("scale"))
									{
										drawable = new android.graphics.drawable.ScaleDrawable();
									}
									else
									{
										if (name.Equals("clip"))
										{
											drawable = new android.graphics.drawable.ClipDrawable();
										}
										else
										{
											if (name.Equals("rotate"))
											{
												drawable = new android.graphics.drawable.RotateDrawable();
											}
											else
											{
												if (name.Equals("animated-rotate"))
												{
													drawable = new android.graphics.drawable.AnimatedRotateDrawable();
												}
												else
												{
													if (name.Equals("animation-list"))
													{
														drawable = new android.graphics.drawable.AnimationDrawable();
													}
													else
													{
														if (name.Equals("inset"))
														{
															drawable = new android.graphics.drawable.InsetDrawable();
														}
														else
														{
															if (name.Equals("bitmap"))
															{
																drawable = new android.graphics.drawable.BitmapDrawable(r);
																if (r != null)
																{
																	((android.graphics.drawable.BitmapDrawable)drawable).setTargetDensity(r.getDisplayMetrics
																		());
																}
															}
															else
															{
																if (name.Equals("nine-patch"))
																{
																	drawable = new android.graphics.drawable.NinePatchDrawable();
																	if (r != null)
																	{
																		((android.graphics.drawable.NinePatchDrawable)drawable).setTargetDensity(r.getDisplayMetrics
																			());
																	}
																}
																else
																{
																	throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
																		 ": invalid drawable tag " + name);
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			drawable.inflate(r, parser, attrs);
			return drawable;
		}
示例#21
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;
		}
示例#22
0
		/// <summary>Create a drawable from an XML document.</summary>
		/// <remarks>
		/// Create a drawable from an XML document. For more information on how to
		/// create resources in XML, see
		/// &lt;a href="
		/// <docRoot></docRoot>
		/// guide/topics/resources/drawable-resource.html"&gt;Drawable Resources</a>.
		/// </remarks>
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public static android.graphics.drawable.Drawable createFromXml(android.content.res.Resources
			 r, org.xmlpull.v1.XmlPullParser parser)
		{
			android.util.AttributeSet attrs = android.util.Xml.asAttributeSet(parser);
			int type;
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.START_TAG && type
				 != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT)
			{
			}
			// Empty loop
			if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
			{
				throw new org.xmlpull.v1.XmlPullParserException("No start tag found");
			}
			android.graphics.drawable.Drawable drawable = createFromXmlInner(r, parser, attrs
				);
			if (drawable == null)
			{
				throw new java.lang.RuntimeException("Unknown initial tag: " + parser.getName());
			}
			return drawable;
		}
示例#23
0
		/// <summary>
		/// Recursive method used to descend down the xml hierarchy and instantiate
		/// views, instantiate their children, and then call onFinishInflate().
		/// </summary>
		/// <remarks>
		/// Recursive method used to descend down the xml hierarchy and instantiate
		/// views, instantiate their children, and then call onFinishInflate().
		/// </remarks>
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		internal virtual void rInflate(org.xmlpull.v1.XmlPullParser parser, android.view.View
			 parent, android.util.AttributeSet attrs, bool finishInflate)
		{
			int depth = parser.getDepth();
			int type;
			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 (TAG_REQUEST_FOCUS.Equals(name))
				{
					parseRequestFocus(parser, parent);
				}
				else
				{
					if (TAG_INCLUDE.Equals(name))
					{
						if (parser.getDepth() == 0)
						{
							throw new android.view.InflateException("<include /> cannot be the root element");
						}
						parseInclude(parser, parent, attrs);
					}
					else
					{
						if (TAG_MERGE.Equals(name))
						{
							throw new android.view.InflateException("<merge /> must be the root element");
						}
						else
						{
							if (TAG_1995.Equals(name))
							{
								android.view.View view = new android.view.LayoutInflater.BlinkLayout(mContext, attrs
									);
								android.view.ViewGroup viewGroup = (android.view.ViewGroup)parent;
								android.view.ViewGroup.LayoutParams @params = viewGroup.generateLayoutParams(attrs
									);
								rInflate(parser, view, attrs, true);
								viewGroup.addView(view, @params);
							}
							else
							{
								android.view.View view = createViewFromTag(parent, name, attrs);
								android.view.ViewGroup viewGroup = (android.view.ViewGroup)parent;
								android.view.ViewGroup.LayoutParams @params = viewGroup.generateLayoutParams(attrs
									);
								rInflate(parser, view, attrs, true);
								viewGroup.addView(view, @params);
							}
						}
					}
				}
			}
			if (finishInflate)
			{
				parent.onFinishInflate();
			}
		}
示例#24
0
		public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
			 parser, android.util.AttributeSet attrs)
		{
			android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
				styleable.AnimatedRotateDrawable);
			base.inflateWithAttributes(r, parser, a, [email protected]_visible
				);
			android.util.TypedValue tv = a.peekValue([email protected]_pivotX
				);
			bool pivotXRel = tv.type == android.util.TypedValue.TYPE_FRACTION;
			float pivotX = pivotXRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
			tv = a.peekValue([email protected]_pivotY);
			bool pivotYRel = tv.type == android.util.TypedValue.TYPE_FRACTION;
			float pivotY = pivotYRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
			setFramesCount(a.getInt([email protected]_framesCount
				, 12));
			setFramesDuration(a.getInt([email protected]_frameDuration
				, 150));
			int res = a.getResourceId([email protected]_drawable
				, 0);
			android.graphics.drawable.Drawable drawable = null;
			if (res > 0)
			{
				drawable = r.getDrawable(res);
			}
			a.recycle();
			int outerDepth = parser.getDepth();
			int type;
			while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
				 (type != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser.getDepth() > outerDepth
				))
			{
				if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					continue;
				}
				if ((drawable = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, 
					attrs)) == null)
				{
					android.util.Log.w("drawable", "Bad element under <animated-rotate>: " + parser.getName
						());
				}
			}
			if (drawable == null)
			{
				android.util.Log.w("drawable", "No drawable specified for <animated-rotate>");
			}
			android.graphics.drawable.AnimatedRotateDrawable.AnimatedRotateState rotateState = 
				mState;
			rotateState.mDrawable = drawable;
			rotateState.mPivotXRel = pivotXRel;
			rotateState.mPivotX = pivotX;
			rotateState.mPivotYRel = pivotYRel;
			rotateState.mPivotY = pivotY;
			init();
			if (drawable != null)
			{
				drawable.setCallback(this);
			}
		}