Skip to content

Commit

Permalink
update ARSCLib 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
REAndroid committed Jul 9, 2023
1 parent 21d8efe commit b88d653
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 27 deletions.
Binary file modified libs/ARSCLib.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/java/com/reandroid/apkeditor/info/Info.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.reandroid.arsc.coder.ReferenceString;
import com.reandroid.arsc.coder.ValueCoder;
import com.reandroid.arsc.model.ResourceEntry;
import com.reandroid.arsc.util.HexUtil;
import com.reandroid.utils.HexUtil;
import com.reandroid.arsc.value.AttributeDataFormat;
import com.reandroid.arsc.value.Entry;
import com.reandroid.arsc.value.ResValue;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/reandroid/apkeditor/info/InfoWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.reandroid.arsc.coder.ValueCoder;
import com.reandroid.arsc.container.SpecTypePair;
import com.reandroid.arsc.model.ResourceEntry;
import com.reandroid.arsc.util.HexUtil;
import com.reandroid.utils.HexUtil;
import com.reandroid.arsc.value.*;

import java.io.Closeable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import com.reandroid.arsc.chunk.PackageBlock;
import com.reandroid.arsc.container.SpecTypePair;
import com.reandroid.arsc.model.ResourceEntry;
import com.reandroid.arsc.util.HexUtil;
import com.reandroid.arsc.value.Entry;
import com.reandroid.arsc.value.ResTableMapEntry;
import com.reandroid.arsc.value.ResValue;
import com.reandroid.arsc.value.ResValueMap;
import com.reandroid.utils.HexUtil;

import java.io.IOException;
import java.io.Writer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.reandroid.arsc.chunk.PackageBlock;
import com.reandroid.arsc.container.SpecTypePair;
import com.reandroid.arsc.model.ResourceEntry;
import com.reandroid.arsc.util.HexUtil;
import com.reandroid.utils.HexUtil;
import com.reandroid.arsc.value.Entry;
import com.reandroid.arsc.value.ResTableMapEntry;
import com.reandroid.arsc.value.ResValue;
Expand Down Expand Up @@ -303,13 +303,6 @@ private void writeIndent(KXmlSerializer serializer, int level) throws IOExceptio
}
serializer.text(builder.toString());
}
private void setRootTag(String tag){
KXmlSerializer serializer = this.mSerializer;
if(serializer != null){
return;
}
mRootTag = tag;
}
private KXmlSerializer getSerializer() throws IOException {
KXmlSerializer serializer = this.mSerializer;
if(serializer != null){
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/com/reandroid/apkeditor/merge/Merger.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.reandroid.archive2.ArchiveEntry;
import com.reandroid.arsc.container.SpecTypePair;
import com.reandroid.arsc.model.ResourceEntry;
import com.reandroid.arsc.util.HexUtil;
import com.reandroid.utils.HexUtil;
import com.reandroid.arsc.value.ResValue;
import com.reandroid.commons.command.ARGException;
import com.reandroid.apk.ApkBundle;
Expand Down Expand Up @@ -108,13 +108,12 @@ private File extractFile(File file) throws IOException {
}
tmp.deleteOnExit();
Archive archive = new Archive(file);
archive.extractAll(tmp, new Predicate<ArchiveEntry>() {
@Override
public boolean test(ArchiveEntry archiveEntry) {
return archiveEntry.getName().endsWith(".apk");
}
});
Predicate <ArchiveEntry> filter = archiveEntry -> archiveEntry.getName().endsWith(".apk");
int count = archive.extractAll(tmp, filter, this);
archive.close();
if(count == 0){
throw new IOException("No *.apk files found on: " + file);
}
return tmp;
}
private File toTmpDir(File file){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2022 github.com/REAndroid
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -42,7 +42,7 @@ public XMLDocument toXMLDocument(){
XMLElement documentElement=new XMLElement("resources");
xmlDocument.setDocumentElement(documentElement);
for(TypeName typeName:listTypeNames()){
documentElement.addChild(typeName.toXMLElement());
documentElement.add(typeName.toXMLElement());
}
return xmlDocument;
}
Expand All @@ -59,8 +59,9 @@ public void add(XMLDocument xmlDocument){
if(documentElement==null){
return;
}
for(XMLElement element:documentElement.listChildElements()){
add(TypeName.fromXMLElement(element));
Iterator<? extends XMLElement> iterator = documentElement.getElements();
while (iterator.hasNext()){
add(TypeName.fromXMLElement(iterator.next()));
}
}
public void add(int id, String name){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.reandroid.arsc.chunk.xml.ResXmlElement;
import com.reandroid.arsc.model.ResourceEntry;
import com.reandroid.arsc.item.TypeString;
import com.reandroid.arsc.util.FrameworkTable;
import com.reandroid.arsc.model.FrameworkTable;
import com.reandroid.arsc.value.AttributeDataFormat;
import com.reandroid.arsc.value.Entry;
import com.reandroid.arsc.value.ResTableMapEntry;
Expand Down Expand Up @@ -69,8 +69,8 @@ private void logFinished(){
if(refactoredTypeMap.count()>0){
log.append("\n");
XMLElement element=refactoredTypeMap.toXMLDocument().getDocumentElement();
element.setTagName("renamed");
element.setAttribute("count", refactoredTypeMap.count());
element.setName("renamed");
element.setAttribute("count", String.valueOf(refactoredTypeMap.count()));
log.append(element.toText(2, false));
}
TypeNameMap remain=new TypeNameMap();
Expand All @@ -81,7 +81,7 @@ private void logFinished(){
log.append("\n");
XMLDocument xmlDocument=remain.toXMLDocument();
XMLElement element=xmlDocument.getDocumentElement();
element.setTagName("remain");
element.setName("remain");
log.append(xmlDocument.toText(2, false));
}
logMessage(log.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.reandroid.apk.DexEncoder;
import com.reandroid.archive.FileInputSource;
import com.reandroid.archive.InputSource;
import com.reandroid.arsc.util.StringsUtil;
import com.reandroid.utils.StringsUtil;
import org.jf.smali.Smali;
import org.jf.smali.SmaliOptions;

Expand Down

0 comments on commit b88d653

Please sign in to comment.