Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt null resource to be treated as reference instead of empty string. #3417

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ public ResValueFactory(ResPackage package_) {
public ResScalarValue factory(int type, int value, String rawValue) throws AndrolibException {
switch (type) {
case TypedValue.TYPE_NULL:
if (value == TypedValue.DATA_NULL_UNDEFINED) { // Special case $empty as explicitly defined empty value
return new ResStringValue(null, value);
} else if (value == TypedValue.DATA_NULL_EMPTY) {
if (value == TypedValue.DATA_NULL_EMPTY) {
return new ResEmptyValue(value, rawValue, type);
}
return new ResReferenceValue(mPackage, 0, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public void buildAndDecodeTest() {
assertTrue(sTestNewDir.isDirectory());
}

@Test
public void valuesColorsTest() throws BrutException {
compareValuesFiles("values/colors.xml");
}

@Test
public void valuesStringsTest() throws BrutException {
compareValuesFiles("values/strings.xml");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="test_color1">#ff123456</color>
<color name="test_color2">@android:color/white</color>
<color name="test_color3">#00000000</color>
<color name="issue_3416">@null</color>
</resources>