fix check resource id is zero when search attribute by name

This commit is contained in:
REAndroid 2023-03-28 06:44:31 -04:00
parent 0e161a4321
commit 5d834d9cd7
2 changed files with 3 additions and 1 deletions

View File

@ -244,6 +244,7 @@
} }
return searchAttributeByResourceId(resourceId); return searchAttributeByResourceId(resourceId);
} }
// Searches attribute with resource id = 0
public ResXmlAttribute searchAttributeByName(String name){ public ResXmlAttribute searchAttributeByName(String name){
ResXmlStartElement startElement=getStartElement(); ResXmlStartElement startElement=getStartElement();
if(startElement!=null){ if(startElement!=null){

View File

@ -168,12 +168,13 @@
} }
return null; return null;
} }
// Searches attribute with resource id = 0
public ResXmlAttribute searchAttributeByName(String name){ public ResXmlAttribute searchAttributeByName(String name){
if(name==null){ if(name==null){
return null; return null;
} }
for(ResXmlAttribute attribute:listResXmlAttributes()){ for(ResXmlAttribute attribute:listResXmlAttributes()){
if(name.equals(attribute.getFullName()) || name.equals(attribute.getName())){ if(name.equals(attribute.getName()) || name.equals(attribute.getFullName())){
return attribute; return attribute;
} }
} }