Skip to content

Commit

Permalink
feat: adapter int value
Browse files Browse the repository at this point in the history
  • Loading branch information
huhuang03 committed May 7, 2024
1 parent cc501d0 commit cdf6751
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ gradle.properties
**/out/

# Patches
*.patch
*.patch

apk_*/
/*.apk
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,19 @@ public String getAttributeValue(int index) {
} catch (UndefinedResObjectException | ClassCastException ignored) {}
}

return decoded != null ? decoded : resValue.encodeAsResXmlAttr();

String rst = decoded != null ? decoded : resValue.encodeAsResXmlAttr();
if (rst == null || rst.isEmpty()) {
if (valueType == TypedValue.TYPE_INT_DEC || valueType == TypedValue.TYPE_INT_HEX || valueType == TypedValue.TYPE_INT_BOOLEAN) {
if (valueType == TypedValue.TYPE_INT_DEC) {
return String.valueOf(valueData);
}
if (valueType == TypedValue.TYPE_INT_HEX) {
return "0x" + Integer.toHexString(valueData).toUpperCase();
}
return valueData == 0? "false": "true";
}
}
return rst;
} catch (AndrolibException ex) {
setFirstError(ex);
LOGGER.log(Level.WARNING, String.format("Could not decode attr value, using undecoded value "
Expand Down

0 comments on commit cdf6751

Please sign in to comment.