@Override
public ElementDrawableChildRoot createElementDrawableChildRoot(DOMElemDrawable rootElem, AttrDrawableContext attrCtx)
{
ElementDrawableChildRoot elementDrawableRoot = new ElementDrawableChildRoot();
RotateDrawable drawable = new RotateDrawable();
XMLInflaterContext xmlInflaterContext = attrCtx.getXMLInflaterContext();
XMLInflaterDrawable xmlInflaterDrawable = attrCtx.getXMLInflaterDrawable();
xmlInflaterDrawable.processChildElements(rootElem, elementDrawableRoot,attrCtx);
ArrayList<ElementDrawableChildBase> childList = elementDrawableRoot.getElementDrawableChildList();
XMLInflaterRegistry xmlInflaterRegistry = classMgr.getXMLInflaterRegistry();
Drawable.ConstantState rotateState = rotateStateField.get(drawable);
Drawable childDrawable = getDrawableChild("drawable", rootElem, xmlInflaterContext, childList);
if (Build.VERSION.SDK_INT >= MiscUtil.MARSHMALLOW) // level 23, v6.0
mDrawableField.set(drawable,childDrawable);
else
mDrawableField.set(rotateState,childDrawable);
DOMAttr pivotXAttr = rootElem.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "pivotX");
PercFloatImpl pivotXObj = pivotXAttr != null ? xmlInflaterRegistry.getDimensionPercFloat(pivotXAttr.getResourceDesc(),xmlInflaterContext) : null;
boolean pivotXRel;
float pivotX;
if (pivotXObj == null)
{
pivotXRel = true;
pivotX = 0.5f;
}
else
{
pivotXRel = pivotXObj.getDataType() == TypedValue.TYPE_FRACTION;
pivotX = pivotXObj.toFloatBasedOnDataType();
}
mPivotXRelField.set(rotateState,pivotXRel);
mPivotXField.set(rotateState,pivotX);
DOMAttr pivotYAttr = rootElem.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "pivotY");
PercFloatImpl pivotYObj = pivotYAttr != null ? xmlInflaterRegistry.getDimensionPercFloat(pivotYAttr.getResourceDesc(),xmlInflaterContext) : null;
boolean pivotYRel;
float pivotY;
if (pivotYObj == null)
{
pivotYRel = true;
pivotY = 0.5f;
}
else
{
pivotYRel = pivotYObj.getDataType() == TypedValue.TYPE_FRACTION;
pivotY = pivotYObj.toFloatBasedOnDataType();
}
mPivotYRelField.set(rotateState,pivotYRel);
mPivotYField.set(rotateState,pivotY);
DOMAttr fromDegreesAttr = rootElem.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "fromDegrees");
float fromDegrees = fromDegreesAttr != null ? xmlInflaterRegistry.getFloat(fromDegreesAttr.getResourceDesc(),xmlInflaterContext) : 0.0f;
mFromDegreesField.set(rotateState,fromDegrees);
mCurrentDegreesField.set(rotateState,fromDegrees);
DOMAttr toDegreesAttr = rootElem.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "toDegrees");
float toDegrees = toDegreesAttr != null ? xmlInflaterRegistry.getFloat(toDegreesAttr.getResourceDesc(),xmlInflaterContext) : 360.0f;
mToDegreesField.set(rotateState,toDegrees);
setCallback(childDrawable,drawable); // childDrawable no puede ser nulo
elementDrawableRoot.setDrawable(drawable);
return elementDrawableRoot;
}
ClassDescRotateDrawable.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:itsnat_droid
作者:
评论列表
文章目录