mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-04-30 22:34:24 +02:00
relate ResValueMap and ResXmlAttribute with AttributeValue
This commit is contained in:
parent
cd481f2e19
commit
80309a32c7
@ -21,6 +21,7 @@
|
||||
import com.reandroid.arsc.item.*;
|
||||
import com.reandroid.arsc.pool.ResXmlStringPool;
|
||||
import com.reandroid.arsc.pool.StringPool;
|
||||
import com.reandroid.arsc.value.AttributeValue;
|
||||
import com.reandroid.arsc.value.ValueItem;
|
||||
import com.reandroid.arsc.value.ValueType;
|
||||
import com.reandroid.common.EntryStore;
|
||||
@ -31,7 +32,7 @@
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ResXmlAttribute extends ValueItem implements Comparable<ResXmlAttribute>{
|
||||
public class ResXmlAttribute extends ValueItem implements AttributeValue, Comparable<ResXmlAttribute>{
|
||||
private ReferenceItem mNSReference;
|
||||
private ReferenceItem mNameReference;
|
||||
private ReferenceItem mNameIdReference;
|
||||
@ -79,6 +80,7 @@
|
||||
public String getValueString(){
|
||||
return getString(getValueStringReference());
|
||||
}
|
||||
@Override
|
||||
public int getNameResourceID(){
|
||||
ResXmlID xmlID = getResXmlID();
|
||||
if(xmlID != null){
|
||||
@ -86,6 +88,7 @@
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public void setNameResourceID(int resourceId){
|
||||
ResXmlIDMap xmlIDMap=getResXmlIDMap();
|
||||
if(xmlIDMap==null){
|
||||
|
21
src/main/java/com/reandroid/arsc/value/AttributeValue.java
Normal file
21
src/main/java/com/reandroid/arsc/value/AttributeValue.java
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2022 github.com/REAndroid
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.reandroid.arsc.value;
|
||||
|
||||
public interface AttributeValue extends Value{
|
||||
int getNameResourceID();
|
||||
void setNameResourceID(int resourceId);
|
||||
}
|
@ -19,7 +19,7 @@ import com.reandroid.arsc.base.Block;
|
||||
import com.reandroid.arsc.chunk.PackageBlock;
|
||||
import com.reandroid.json.JSONObject;
|
||||
|
||||
public class ResValueMap extends ValueItem{
|
||||
public class ResValueMap extends ValueItem implements AttributeValue{
|
||||
|
||||
public ResValueMap() {
|
||||
super(12, OFFSET_SIZE);
|
||||
@ -55,6 +55,14 @@ public class ResValueMap extends ValueItem{
|
||||
putInteger(getBytesInternal(), OFFSET_NAME, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNameResourceID() {
|
||||
return getName();
|
||||
}
|
||||
@Override
|
||||
public void setNameResourceID(int resourceId){
|
||||
setName(resourceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject toJson() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user