Refactoring: handle base AndroidResource class (in order to support <fragment>)
This commit is contained in:
+1
-2
@@ -44,10 +44,9 @@ class AndroidXmlVisitor(val elementCallback: (String, String, XmlAttribute) -> U
|
||||
if (idAttributeValue != null) {
|
||||
val classAttributeValue = tag?.getAttribute(AndroidConst.CLASS_ATTRIBUTE_NO_NAMESPACE)?.getValue()
|
||||
val xmlType = classAttributeValue ?: localName
|
||||
val widgetType = xmlType.let { getRealWidgetType(it) }
|
||||
if (isResourceDeclarationOrUsage(idAttributeValue)) {
|
||||
val name = idToName(idAttributeValue)
|
||||
if (name != null) elementCallback(name, widgetType, idAttribute)
|
||||
if (name != null) elementCallback(name, xmlType, idAttribute)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -41,10 +41,10 @@ class IDEAndroidUIXmlProcessor(val module: Module) : AndroidUIXmlProcessor(modul
|
||||
}
|
||||
}
|
||||
|
||||
override fun parseLayout(files: List<PsiFile>): List<AndroidWidget> {
|
||||
val widgets = arrayListOf<AndroidWidget>()
|
||||
override fun parseLayout(files: List<PsiFile>): List<AndroidResource> {
|
||||
val widgets = arrayListOf<AndroidResource>()
|
||||
val visitor = AndroidXmlVisitor { id, widgetType, attribute ->
|
||||
widgets.add(AndroidWidget(id, widgetType))
|
||||
widgets.add(parseAndroidResource(id, widgetType))
|
||||
}
|
||||
|
||||
files.forEach { it.accept(visitor) }
|
||||
|
||||
Reference in New Issue
Block a user