Ignore some XML tags

This commit is contained in:
Yan Zhulanow
2015-03-25 17:15:09 +03:00
parent 938248bd29
commit 2af538e854
9 changed files with 18 additions and 13 deletions
@@ -35,14 +35,17 @@ class AndroidXmlVisitor(val elementCallback: (String, String, XmlAttribute) -> U
}
override fun visitXmlTag(tag: XmlTag?) {
val localName = tag?.getLocalName() ?: ""
if (isWidgetTypeIgnored(localName)) return
val idAttribute = tag?.getAttribute(AndroidConst.ID_ATTRIBUTE)
if (idAttribute != null) {
val idAttributeValue = idAttribute.getValue()
if (idAttributeValue != null) {
val classAttributeValue = tag?.getAttribute(AndroidConst.CLASS_ATTRIBUTE_NO_NAMESPACE)?.getValue()
val xmlType = classAttributeValue ?: tag?.getLocalName()
val widgetType = xmlType?.let { getRealWidgetType(it) }
if (widgetType != null && isResourceDeclarationOrUsage(idAttributeValue)) {
val xmlType = classAttributeValue ?: localName
val widgetType = xmlType.let { getRealWidgetType(it) }
if (isResourceDeclarationOrUsage(idAttributeValue)) {
val name = idToName(idAttributeValue)
if (name != null) elementCallback(name, widgetType, idAttribute)
}