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(mResXmlIDMap);
|
||||||
addChild(mResXmlElementContainer);
|
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(){
|
void linkStringReferences(){
|
||||||
ResXmlElement element=getResXmlElement();
|
ResXmlElement element=getResXmlElement();
|
||||||
if(element!=null){
|
if(element!=null){
|
||||||
|
@ -55,6 +55,9 @@ import java.util.*;
|
|||||||
addChild(4, mEndElementContainer);
|
addChild(4, mEndElementContainer);
|
||||||
addChild(5, mEndNamespaceList);
|
addChild(5, mEndNamespaceList);
|
||||||
}
|
}
|
||||||
|
public ResXmlAttribute newAttribute(){
|
||||||
|
return getStartElement().newAttribute();
|
||||||
|
}
|
||||||
Set<ResXmlString> clearStringReferences(){
|
Set<ResXmlString> clearStringReferences(){
|
||||||
Set<ResXmlString> results=new HashSet<>();
|
Set<ResXmlString> results=new HashSet<>();
|
||||||
for(ResXmlStartNamespace startNamespace:getStartNamespaceList()){
|
for(ResXmlStartNamespace startNamespace:getStartNamespaceList()){
|
||||||
@ -229,6 +232,9 @@ import java.util.*;
|
|||||||
public void addElement(ResXmlElement element){
|
public void addElement(ResXmlElement element){
|
||||||
mBody.add(element);
|
mBody.add(element);
|
||||||
}
|
}
|
||||||
|
public boolean removeAttribute(ResXmlAttribute resXmlAttribute){
|
||||||
|
return getStartElement().getResXmlAttributeArray().remove(resXmlAttribute);
|
||||||
|
}
|
||||||
public boolean removeElement(ResXmlElement element){
|
public boolean removeElement(ResXmlElement element){
|
||||||
if(element.getParent()!=null){
|
if(element.getParent()!=null){
|
||||||
// TODO: Find a way to remove properly from StringPool
|
// TODO: Find a way to remove properly from StringPool
|
||||||
@ -330,7 +336,7 @@ import java.util.*;
|
|||||||
mEndNamespaceList.add(item);
|
mEndNamespaceList.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResXmlStartElement newStartElement(int lineNo){
|
ResXmlStartElement newStartElement(int lineNo){
|
||||||
ResXmlStartElement startElement=new ResXmlStartElement();
|
ResXmlStartElement startElement=new ResXmlStartElement();
|
||||||
setStartElement(startElement);
|
setStartElement(startElement);
|
||||||
|
|
||||||
|
@ -50,6 +50,10 @@ import java.util.Set;
|
|||||||
addChild(mStyleAttributePosition);
|
addChild(mStyleAttributePosition);
|
||||||
addChild(mAttributeArray);
|
addChild(mAttributeArray);
|
||||||
}
|
}
|
||||||
|
public ResXmlAttribute newAttribute(){
|
||||||
|
ResXmlAttributeArray attributeArray = getResXmlAttributeArray();
|
||||||
|
return attributeArray.createNext();
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
void linkStringReferences(){
|
void linkStringReferences(){
|
||||||
super.linkStringReferences();
|
super.linkStringReferences();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user