diff --git a/src/main/java/com/reandroid/lib/arsc/value/EntryBlock.java b/src/main/java/com/reandroid/lib/arsc/value/EntryBlock.java index e20bc97..ca67f92 100755 --- a/src/main/java/com/reandroid/lib/arsc/value/EntryBlock.java +++ b/src/main/java/com/reandroid/lib/arsc/value/EntryBlock.java @@ -278,6 +278,10 @@ public class EntryBlock extends Block implements JSONConvert { mSpecReference.set(ref); updateSpecRef(old, ref); } + public void setSpecReference(SpecString specString){ + removeSpecRef(); + mSpecReference.set(specString.getIndex()); + } public BaseResValue getResValue(){ return mResValue; } @@ -620,6 +624,21 @@ public class EntryBlock extends Block implements JSONConvert { specStringNew.addReference(getSpecReferenceBlock()); } } + private void removeSpecRef(){ + TypeBlock typeBlock=getTypeBlock(); + if(typeBlock==null){ + return; + } + PackageBlock packageBlock=typeBlock.getPackageBlock(); + if(packageBlock==null){ + return; + } + SpecStringPool specStringPool=packageBlock.getSpecStringPool(); + SpecString specString=specStringPool.get(getSpecReference()); + if(specString!=null){ + specString.removeReference(getSpecReferenceBlock()); + } + } private void updatePackage(){ TypeBlock typeBlock=getTypeBlock(); if(typeBlock==null){