Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ private void encodeValues(List<File> pubXmlFileList) throws IOException, XmlPull
filePathEncoder.encodePackageResDir(packageBlock, resDir);

packageBlock.sortTypes();
packageBlock.refresh();
}
}
private void encodeAttrs(List<File> pubXmlFileList) throws IOException, XmlPullParserException {
Expand Down
19 changes: 15 additions & 4 deletions src/main/java/com/reandroid/arsc/chunk/TypeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ public SpecTypePair getParentSpecTypePair() {
return getParent(SpecTypePair.class);
}
public Entry getOrCreateDefinedEntry(String name) {
Entry entry = getEntry(name);
if (entry != null) {
return entry;
}
PackageBlock packageBlock = getPackageBlock();
if (packageBlock == null) {
return null;
Expand All @@ -198,6 +194,21 @@ public Entry getOrCreateDefinedEntry(String name) {
if (id == 0) {
return null;
}
Entry entry = getEntry(id & 0xffff);
if (entry != null) {
String entryName = entry.getName();
if (name.equals(entryName)) {
return entry;
}
if (entryName != null && !entry.isNull()) {
// The defined id holds a different name; fall back to
// scanning this type block by name.
Entry existing = getEntry(name);
if (existing != null) {
return existing;
}
}
}
SpecStringPool stringPool = packageBlock.getSpecStringPool();
SpecString specString = stringPool.getOrCreate(name);
entry = getOrCreateEntry(id & 0xffff);
Expand Down
13 changes: 2 additions & 11 deletions src/main/java/com/reandroid/arsc/container/BlockList.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,10 @@ public void destroy() {
onChanged();
}
public boolean sort(Comparator<? super T> comparator) {
if (size() < 2) {
if (!needsSort(comparator)) {
return false;
}
boolean sorted = mItems.sort(comparator, (i, j) -> {
T item1 = get(i);
T item2 = get(j);
if (item1 != null) {
item1.setIndex(i);
}
if (item2 != null) {
item2.setIndex(j);
}
});
boolean sorted = mItems.sortItems(comparator);
if (sorted) {
updateIndex();
}
Expand Down