Skip to content

Commit

Permalink
bug fix,trim id value.
Browse files Browse the repository at this point in the history
  • Loading branch information
oneliang committed Jan 5, 2017
1 parent 54b5ed0 commit c741ff5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public AaptResourceCollector(Map<RType, Set<RDotTxtEntry>> rTypeResourceMap) {
originalResourceMap.put(rDotTxtEntry, rDotTxtEntry);
ResourceIdEnumerator resourceIdEnumerator = null;
if (!rDotTxtEntry.idType.equals(IdType.INT_ARRAY)) {
int resourceId = Integer.decode(rDotTxtEntry.idValue).intValue();
int resourceId = Integer.decode(rDotTxtEntry.idValue.trim()).intValue();
int typeId = ((resourceId & 0x00FF0000) / 0x00010000);
if (typeId >= currentTypeId) {
currentTypeId = typeId + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public static Map<String, Map<RType, Set<com.tencent.tinker.build.aapt.RDotTxtEn
if (rDotTxtEntry.idType.equals(IdType.INT)) {
aaptResourceCollector.addIntResourceIfNotPresent(rType, rDotTxtEntry.name);
} else if (rDotTxtEntry.idType.equals(IdType.INT_ARRAY)) {
aaptResourceCollector.addResource(rType, rDotTxtEntry.idType, rDotTxtEntry.name, rDotTxtEntry.idValue);
aaptResourceCollector.addResource(rType, rDotTxtEntry.idType, rDotTxtEntry.name, rDotTxtEntry.idValue.trim());
}
}
}
Expand Down Expand Up @@ -388,7 +388,7 @@ public static void writeRJava(String outputDirectory, String packageName, Map<RT
for (com.tencent.tinker.build.aapt.RDotTxtEntry rDotTxtEntry : rTypeResourceMap.get(rType)) {
// Write out the resource.
// Write as an int.
writer.format(" public static%s%s %s=%s;\n", isFinal ? " final " : " ", rDotTxtEntry.idType, rDotTxtEntry.name, rDotTxtEntry.idValue);
writer.format(" public static%s%s %s=%s;\n", isFinal ? " final " : " ", rDotTxtEntry.idType, rDotTxtEntry.name, rDotTxtEntry.idValue.trim());
}
writer.println(" }\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static void generatePublicResourceXml(AaptResourceCollector aaptResourceC
// System.err.println("Blank?" + rDotTxtEntry.name);
rawName = rDotTxtEntry.name;
}
publicWriter.println("<public type=\"" + rType + "\" name=\"" + rawName + "\" id=\"" + rDotTxtEntry.idValue + "\" />");
publicWriter.println("<public type=\"" + rType + "\" name=\"" + rawName + "\" id=\"" + rDotTxtEntry.idValue.trim() + "\" />");
// } else {
// publicWriter.println("<public type=\"" + rType + "\" name=\"" + rDotTxtEntry.name + "\" id=\"" + rDotTxtEntry.idValue + "\" />");
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public int hashCode() {

@Override
public String toString() {
return Objects.toStringHelper(RDotTxtEntry.class).add("idType", idType).add("type", type).add("name", name).add("idValue", idValue).toString();
return Objects.toStringHelper(RDotTxtEntry.class).add("idType", idType).add("type", type).add("name", name).add("idValue", idValue.trim()).toString();
}

// Taken from http://developer.android.com/reference/android/R.html
Expand Down

0 comments on commit c741ff5

Please sign in to comment.