mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-05-01 14:44:27 +02:00
Simplify create root ResXmlElement
This commit is contained in:
parent
6abaaebdb4
commit
c288c50c89
@ -48,6 +48,18 @@ public class ResXmlBlock extends BaseChunk implements JSONConvert<JSONObject> {
|
||||
addChild(mResXmlIDMap);
|
||||
addChild(mResXmlElementContainer);
|
||||
}
|
||||
public ResXmlElement createRootElement(String tag){
|
||||
int lineNo=1;
|
||||
ResXmlElement resXmlElement=new ResXmlElement();
|
||||
resXmlElement.newStartElement(lineNo);
|
||||
|
||||
setResXmlElement(resXmlElement);
|
||||
|
||||
if(tag!=null){
|
||||
resXmlElement.setTag(tag);
|
||||
}
|
||||
return resXmlElement;
|
||||
}
|
||||
void linkStringReferences(){
|
||||
ResXmlElement element=getResXmlElement();
|
||||
if(element!=null){
|
||||
|
@ -55,6 +55,9 @@ import java.util.*;
|
||||
addChild(4, mEndElementContainer);
|
||||
addChild(5, mEndNamespaceList);
|
||||
}
|
||||
public ResXmlAttribute newAttribute(){
|
||||
return getStartElement().newAttribute();
|
||||
}
|
||||
Set<ResXmlString> clearStringReferences(){
|
||||
Set<ResXmlString> results=new HashSet<>();
|
||||
for(ResXmlStartNamespace startNamespace:getStartNamespaceList()){
|
||||
@ -229,6 +232,9 @@ import java.util.*;
|
||||
public void addElement(ResXmlElement element){
|
||||
mBody.add(element);
|
||||
}
|
||||
public boolean removeAttribute(ResXmlAttribute resXmlAttribute){
|
||||
return getStartElement().getResXmlAttributeArray().remove(resXmlAttribute);
|
||||
}
|
||||
public boolean removeElement(ResXmlElement element){
|
||||
if(element.getParent()!=null){
|
||||
// TODO: Find a way to remove properly from StringPool
|
||||
@ -330,7 +336,7 @@ import java.util.*;
|
||||
mEndNamespaceList.add(item);
|
||||
}
|
||||
|
||||
private ResXmlStartElement newStartElement(int lineNo){
|
||||
ResXmlStartElement newStartElement(int lineNo){
|
||||
ResXmlStartElement startElement=new ResXmlStartElement();
|
||||
setStartElement(startElement);
|
||||
|
||||
|
@ -50,6 +50,10 @@ import java.util.Set;
|
||||
addChild(mStyleAttributePosition);
|
||||
addChild(mAttributeArray);
|
||||
}
|
||||
public ResXmlAttribute newAttribute(){
|
||||
ResXmlAttributeArray attributeArray = getResXmlAttributeArray();
|
||||
return attributeArray.createNext();
|
||||
}
|
||||
@Override
|
||||
void linkStringReferences(){
|
||||
super.linkStringReferences();
|
||||
|
Loading…
x
Reference in New Issue
Block a user