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); } }
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); } }