mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-04-29 22:04:25 +02:00
fix issue on attribute format encoding
This commit is contained in:
parent
0ec2b3fe1c
commit
1037986e95
@ -63,8 +63,7 @@ class XMLValuesEncoderAttr extends XMLValuesEncoderBag{
|
||||
AttributeValueType[] valueTypes = AttributeValueType
|
||||
.valuesOf(parentElement.getAttributeValue("formats"));
|
||||
|
||||
formatItem.setDataLow((short) (0xffff &
|
||||
AttributeValueType.getByte(valueTypes)));
|
||||
formatItem.setDataLow((short) (0xff & AttributeValueType.sumValues(valueTypes)));
|
||||
|
||||
bagIndex++;
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class AttributeBagItem {
|
||||
if(valueType == null || getItemType()!=AttributeItemType.FORMAT){
|
||||
return false;
|
||||
}
|
||||
int value = 0xff & valueType.getByte();
|
||||
int value = 0xff & valueType.sumValues();
|
||||
int dataLow = 0xffff & getBagItem().getData();
|
||||
return (dataLow & value) == value;
|
||||
}
|
||||
@ -97,7 +97,7 @@ public class AttributeBagItem {
|
||||
if(valueType == null || getItemType()!=AttributeItemType.FORMAT){
|
||||
return false;
|
||||
}
|
||||
int value = 0xff & valueType.getByte();
|
||||
int value = 0xff & valueType.sumValues();
|
||||
int dataLow = 0xffff & getBagItem().getData();
|
||||
return (dataLow == value);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2022 github.com/REAndroid
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -34,7 +34,7 @@ import java.util.*;
|
||||
AttributeValueType(byte b) {
|
||||
this.mByte=b;
|
||||
}
|
||||
public byte getByte(){
|
||||
public byte sumValues(){
|
||||
return mByte;
|
||||
}
|
||||
@Override
|
||||
@ -65,18 +65,18 @@ import java.util.*;
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
public static byte getByte(AttributeValueType[] valueTypes){
|
||||
public static int sumValues(AttributeValueType[] valueTypes){
|
||||
if(valueTypes==null){
|
||||
return 0;
|
||||
}
|
||||
int i=0;
|
||||
int result = 0;
|
||||
for(AttributeValueType vt:valueTypes){
|
||||
if(vt==null){
|
||||
if(vt == null){
|
||||
continue;
|
||||
}
|
||||
i=i|(0xff & vt.mByte);
|
||||
result = result | (0xff & vt.mByte);
|
||||
}
|
||||
return (byte) (0xff & i);
|
||||
return result;
|
||||
}
|
||||
public static AttributeValueType valueOf(byte b){
|
||||
AttributeValueType[] all=values();
|
||||
|
Loading…
x
Reference in New Issue
Block a user