You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
AssetManager.java: fill indices array when loading TypedArray
This is needed for TypedArray.getIndexCount() and related functions
This commit is contained in:
@@ -878,6 +878,7 @@ public final class AssetManager {
|
||||
Map<Integer,ValueItem> defStyle = loadStyle(defStyleRes);
|
||||
|
||||
ResXmlPullParser parser = (ResXmlPullParser)set;
|
||||
outIndices[0] = 0;
|
||||
|
||||
for (int i = 0; i < inAttrs.length; i++) {
|
||||
int d = i*AssetManager.STYLE_NUM_ENTRIES;
|
||||
@@ -923,17 +924,22 @@ public final class AssetManager {
|
||||
if (valueItem == null)
|
||||
continue;
|
||||
if (valueItem.getValueType() == ValueType.REFERENCE) {
|
||||
while (valueItem.getValueType() == ValueType.REFERENCE) {
|
||||
resId = valueItem.getData();
|
||||
valueItem = null;
|
||||
if (resId == 0)
|
||||
continue;
|
||||
entry = tableBlockSearch(resId).pickOne();
|
||||
break;
|
||||
valueItem = tableBlockSearch(resId).pickOne().getResValue();
|
||||
if (valueItem == null)
|
||||
break;
|
||||
}
|
||||
|
||||
outValues[d + AssetManager.STYLE_RESOURCE_ID] = resId;
|
||||
ResValue resValue = entry.getResValue();
|
||||
if (resValue != null) {
|
||||
outValues[d + AssetManager.STYLE_TYPE] = entry.getResValue().getType();
|
||||
outValues[d + AssetManager.STYLE_DATA] = entry.getResValue().getData();
|
||||
if (valueItem != null) {
|
||||
outValues[d + AssetManager.STYLE_TYPE] = valueItem.getType();
|
||||
outValues[d + AssetManager.STYLE_DATA] = valueItem.getData();
|
||||
outValues[d + AssetManager.STYLE_ASSET_COOKIE] = getCookie(valueItem);
|
||||
outIndices[++outIndices[0]] = i;
|
||||
} else {
|
||||
outValues[d + AssetManager.STYLE_TYPE] = -1;
|
||||
outValues[d + AssetManager.STYLE_ASSET_COOKIE] = -1;
|
||||
@@ -943,6 +949,7 @@ public final class AssetManager {
|
||||
outValues[d+AssetManager.STYLE_TYPE] = valueItem.getType();
|
||||
outValues[d+AssetManager.STYLE_DATA] = valueItem.getData();
|
||||
outValues[d+AssetManager.STYLE_ASSET_COOKIE] = getCookie(valueItem);
|
||||
outIndices[++outIndices[0]] = i;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user