mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-05-01 06:34:26 +02:00
accessible parent chunk from Value
This commit is contained in:
parent
a92e929812
commit
63478aaa1b
@ -170,6 +170,10 @@ package com.reandroid.arsc.chunk;
|
||||
public SpecStringPool getSpecStringPool(){
|
||||
return mSpecStringPool;
|
||||
}
|
||||
@Override
|
||||
public TableBlock getMainChunk(){
|
||||
return getTableBlock();
|
||||
}
|
||||
public PackageBody getPackageBody() {
|
||||
return mBody;
|
||||
}
|
||||
|
@ -19,4 +19,5 @@ import com.reandroid.arsc.pool.StringPool;
|
||||
|
||||
public interface ParentChunk {
|
||||
public StringPool<?> getSpecStringPool();
|
||||
public MainChunk getMainChunk();
|
||||
}
|
||||
|
@ -237,6 +237,15 @@
|
||||
setValueStringReference(-1);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ResXmlDocument getParentChunk() {
|
||||
ResXmlElement element = getParentResXmlElement();
|
||||
if(element!=null){
|
||||
return element.getParentDocument();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void linkNameId(){
|
||||
ResXmlID xmlID = getResXmlID();
|
||||
if(xmlID==null){
|
||||
|
@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.reandroid.arsc.value;
|
||||
|
||||
import com.reandroid.arsc.chunk.PackageBlock;
|
||||
|
||||
public class ResValue extends ValueItem {
|
||||
public ResValue() {
|
||||
super(8, OFFSET_SIZE);
|
||||
@ -24,5 +26,14 @@ package com.reandroid.arsc.value;
|
||||
return getParent(Entry.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageBlock getParentChunk(){
|
||||
Entry entry = getEntry();
|
||||
if(entry != null){
|
||||
return entry.getPackageBlock();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final int OFFSET_SIZE = 0;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
package com.reandroid.arsc.value;
|
||||
|
||||
import com.reandroid.arsc.base.Block;
|
||||
import com.reandroid.arsc.chunk.PackageBlock;
|
||||
import com.reandroid.json.JSONObject;
|
||||
|
||||
public class ResValueMap extends ValueItem{
|
||||
@ -27,6 +28,14 @@ public class ResValueMap extends ValueItem{
|
||||
public Entry getEntry(){
|
||||
return getParent(Entry.class);
|
||||
}
|
||||
@Override
|
||||
public PackageBlock getParentChunk(){
|
||||
Entry entry = getEntry();
|
||||
if(entry!=null){
|
||||
return entry.getPackageBlock();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResTableMapEntry getParentMapEntry(){
|
||||
Block parent=getParent();
|
||||
|
@ -15,9 +15,20 @@
|
||||
*/
|
||||
package com.reandroid.arsc.value;
|
||||
|
||||
import com.reandroid.arsc.chunk.MainChunk;
|
||||
import com.reandroid.arsc.chunk.ParentChunk;
|
||||
|
||||
public interface Value {
|
||||
void setValueType(ValueType valueType);
|
||||
ValueType getValueType();
|
||||
int getData();
|
||||
void setData(int data);
|
||||
ParentChunk getParentChunk();
|
||||
default MainChunk getMainChunk(){
|
||||
ParentChunk parentChunk = getParentChunk();
|
||||
if(parentChunk!=null){
|
||||
return parentChunk.getMainChunk();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user