remove redundant ValueType enum entries

This commit is contained in:
REAndroid 2023-01-10 08:51:57 -05:00
parent d18006c74b
commit c0a02f1f55
3 changed files with 3 additions and 16 deletions

View File

@ -311,8 +311,7 @@ import java.util.Set;
}
public boolean hasIntegerValue(){
ValueType valueType=getValueType();
return valueType==ValueType.INT_DEC
||valueType==ValueType.FIRST_INT;
return valueType==ValueType.INT_DEC;
}
public Integer getValueAsInteger(){
if(hasIntegerValue()){

View File

@ -390,7 +390,7 @@ import java.util.regex.Pattern;
// Should not happen the string could be in ResXmlBlock, but if you are lazy here it goes
return decodeString(entryStore, currentPackageId, rawVal);
}
if(valueType==ValueType.FIRST_INT||valueType==ValueType.INT_DEC||valueType==ValueType.INT_HEX){
if(valueType==ValueType.INT_DEC||valueType==ValueType.INT_HEX){
result=decodeAttribute(entryStore, nameResourceId, rawVal);
if(result!=null){
return result;
@ -409,7 +409,6 @@ import java.util.regex.Pattern;
case INT_COLOR_ARGB8:
case INT_COLOR_RGB4:
case INT_COLOR_RGB8:
case LAST_COLOR_INT:
return decodeColor(data);
case DIMENSION:
case FLOAT:
@ -418,8 +417,6 @@ import java.util.regex.Pattern;
case INT_HEX:
return decodeHex(data);
case INT_DEC:
case FIRST_INT:
case LAST_INT:
return decodeInt(data);
}
return null;

View File

@ -27,16 +27,13 @@ public enum ValueType {
FRACTION((byte) 0x06),
DYNAMIC_REFERENCE((byte) 0x07),
DYNAMIC_ATTRIBUTE((byte) 0x08),
FIRST_INT((byte) 0x10),
INT_DEC((byte) 0x10),
INT_HEX((byte) 0x11),
INT_BOOLEAN((byte) 0x12),
INT_COLOR_ARGB8((byte) 0x1c),
INT_COLOR_RGB8((byte) 0x1d),
INT_COLOR_ARGB4((byte) 0x1e),
INT_COLOR_RGB4((byte) 0x1f),
LAST_COLOR_INT((byte) 0x1f),
LAST_INT((byte) 0x1f);
INT_COLOR_RGB4((byte) 0x1f);
private final byte mByte;
ValueType(byte b) {
@ -49,9 +46,6 @@ public enum ValueType {
ValueType[] all=values();
for(ValueType vt:all){
if(vt.mByte==b){
if(vt==FIRST_INT){
return INT_DEC;
}
return vt;
}
}
@ -65,9 +59,6 @@ public enum ValueType {
ValueType[] all=values();
for(ValueType vt:all){
if(name.equals(vt.name())){
if(vt==FIRST_INT){
return INT_DEC;
}
return vt;
}
}