本文整理汇总了C#中org.getDepth方法的典型用法代码示例。如果您正苦于以下问题:C# org.getDepth方法的具体用法?C# org.getDepth怎么用?C# org.getDepth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org
的用法示例。
在下文中一共展示了org.getDepth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: inflate
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.ClipDrawable);
int orientation = a.getInt([email protected]_clipOrientation
, HORIZONTAL);
int g = a.getInt([email protected]_gravity, android.view.Gravity
.LEFT);
android.graphics.drawable.Drawable dr = a.getDrawable([email protected]
.ClipDrawable_drawable);
a.recycle();
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;
}
dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs);
}
if (dr == null)
{
throw new System.ArgumentException("No drawable specified for <clip>");
}
mClipState.mDrawable = dr;
mClipState.mOrientation = orientation;
mClipState.mGravity = g;
dr.setCallback(this);
}
示例2: skipCurrentTag
/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
/// <exception cref="System.IO.IOException"></exception>
public static void skipCurrentTag(org.xmlpull.v1.XmlPullParser parser)
{
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
))
{
}
}
示例3: rInflate
/// <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();
}
}
示例4: createAnimationFromXml
/// <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;
}
示例5: createInterpolatorFromXml
/// <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;
}
示例6: while
/// <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;
}
示例7: inflate
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);
}
}
}
示例8: inflate
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;
}
//.........这里部分代码省略.........
示例9: inflate
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.ScaleDrawable);
float sw = getPercent(a, [email protected]_scaleWidth);
float sh = getPercent(a, [email protected]_scaleHeight);
int g = a.getInt([email protected]_scaleGravity, android.view.Gravity
.LEFT);
bool min = a.getBoolean([email protected]_useIntrinsicSizeAsMinimum
, false);
android.graphics.drawable.Drawable dr = a.getDrawable([email protected]
.ScaleDrawable_drawable);
a.recycle();
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;
}
dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs);
}
if (dr == null)
{
throw new System.ArgumentException("No drawable specified for <scale>");
}
mScaleState.mDrawable = dr;
mScaleState.mScaleWidth = sw;
mScaleState.mScaleHeight = sh;
mScaleState.mGravity = g;
mScaleState.mUseIntrinsicSizeAsMin = min;
if (dr != null)
{
dr.setCallback(this);
}
}
示例10: createAnimatorFromXml
/// <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: inflate
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: inflate
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: inflate
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: inflate
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]ationDrawable_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: parseRequestFocus
/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
/// <exception cref="System.IO.IOException"></exception>
private void parseRequestFocus(org.xmlpull.v1.XmlPullParser parser, android.view.View
parent)
{
int type;
parent.requestFocus();
int currentDepth = parser.getDepth();
while (((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser
.getDepth() > currentDepth) && type != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT
)
{
}
}