mirror of
https://github.com/iBotPeaches/Apktool.git
synced 2024-11-23 12:39:43 +00:00
Adapt null resource to be treated as reference instead of empty string. (#3417)
* fix: handle null resolved items as references * test: add color null test for aapt2
This commit is contained in:
parent
63b1976448
commit
eec0288e69
@ -32,9 +32,7 @@ public class ResValueFactory {
|
||||
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);
|
||||
|
@ -71,6 +71,11 @@ public class BuildAndDecodeTest extends BaseTest {
|
||||
assertTrue(sTestNewDir.isDirectory());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void valuesColorsTest() throws BrutException {
|
||||
compareValuesFiles("values/colors.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void valuesStringsTest() throws BrutException {
|
||||
compareValuesFiles("values/strings.xml");
|
||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user