Fixes improper decoding of @empty value

- fixes #1270
 - references #1116
This commit is contained in:
Connor Tumbleson 2016-06-13 08:40:00 -04:00
parent 606e47bf55
commit a684bae43a
No known key found for this signature in database
GPG Key ID: C3CC0A201EC7DA75
3 changed files with 7 additions and 10 deletions

View File

@ -17,14 +17,10 @@
package brut.androlib.res.data.value; package brut.androlib.res.data.value;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResValuesXmlSerializable;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer;
public class ResEmptyValue extends ResScalarValue { public class ResEmptyValue extends ResScalarValue {
protected final int mValue; protected final int mValue;
private int type; protected int type;
public ResEmptyValue(int value, String rawValue, int type) { public ResEmptyValue(int value, String rawValue, int type) {
this(value, rawValue, "integer"); this(value, rawValue, "integer");
@ -33,8 +29,8 @@ public class ResEmptyValue extends ResScalarValue {
public ResEmptyValue(int value, String rawValue, String type) { public ResEmptyValue(int value, String rawValue, String type) {
super(type, value, rawValue); super(type, value, rawValue);
if(value != 1) if (value != 1)
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
this.mValue = value; this.mValue = value;
} }
@ -46,4 +42,4 @@ public class ResEmptyValue extends ResScalarValue {
protected String encodeAsResXml() throws AndrolibException { protected String encodeAsResXml() throws AndrolibException {
return "@empty"; return "@empty";
} }
} }

View File

@ -37,8 +37,8 @@ public class ResValueFactory {
if (value == TypedValue.DATA_NULL_UNDEFINED) { // Special case $empty as explicitly defined empty value if (value == TypedValue.DATA_NULL_UNDEFINED) { // Special case $empty as explicitly defined empty value
return new ResStringValue(null, value); return new ResStringValue(null, value);
} else if (value == TypedValue.DATA_NULL_EMPTY) { } else if (value == TypedValue.DATA_NULL_EMPTY) {
return new ResEmptyValue(value, rawValue, type); return new ResEmptyValue(value, rawValue, type);
} }
return new ResReferenceValue(mPackage, 0, null); return new ResReferenceValue(mPackage, 0, null);
case TypedValue.TYPE_REFERENCE: case TypedValue.TYPE_REFERENCE:
return newReference(value, rawValue); return newReference(value, rawValue);

View File

@ -3,6 +3,7 @@
<style name="TextAppearance" parent="@android:style/TextAppearance" /> <style name="TextAppearance" parent="@android:style/TextAppearance" />
<style name="TextAppearance.EditEvent_Label" parent="@style/TextAppearance"> <style name="TextAppearance.EditEvent_Label" parent="@style/TextAppearance">
<item name="android:gravity">center_vertical</item> <item name="android:gravity">center_vertical</item>
<item name="android:popupAnimationStyle">@empty</item>
</style> </style>
<style name="TextAppearance.EditEvent_Button" parent="@style/TextAppearance.EditEvent_Label"> <style name="TextAppearance.EditEvent_Button" parent="@style/TextAppearance.EditEvent_Label">
<item name="android:textColor">#ff777777</item> <item name="android:textColor">#ff777777</item>