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);
|
Map<Integer,ValueItem> defStyle = loadStyle(defStyleRes);
|
||||||
|
|
||||||
ResXmlPullParser parser = (ResXmlPullParser)set;
|
ResXmlPullParser parser = (ResXmlPullParser)set;
|
||||||
|
outIndices[0] = 0;
|
||||||
|
|
||||||
for (int i = 0; i < inAttrs.length; i++) {
|
for (int i = 0; i < inAttrs.length; i++) {
|
||||||
int d = i*AssetManager.STYLE_NUM_ENTRIES;
|
int d = i*AssetManager.STYLE_NUM_ENTRIES;
|
||||||
@@ -923,17 +924,22 @@ public final class AssetManager {
|
|||||||
if (valueItem == null)
|
if (valueItem == null)
|
||||||
continue;
|
continue;
|
||||||
if (valueItem.getValueType() == ValueType.REFERENCE) {
|
if (valueItem.getValueType() == ValueType.REFERENCE) {
|
||||||
resId = valueItem.getData();
|
while (valueItem.getValueType() == ValueType.REFERENCE) {
|
||||||
if (resId == 0)
|
resId = valueItem.getData();
|
||||||
continue;
|
valueItem = null;
|
||||||
entry = tableBlockSearch(resId).pickOne();
|
if (resId == 0)
|
||||||
|
break;
|
||||||
|
valueItem = tableBlockSearch(resId).pickOne().getResValue();
|
||||||
|
if (valueItem == null)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
outValues[d + AssetManager.STYLE_RESOURCE_ID] = resId;
|
outValues[d + AssetManager.STYLE_RESOURCE_ID] = resId;
|
||||||
ResValue resValue = entry.getResValue();
|
if (valueItem != null) {
|
||||||
if (resValue != null) {
|
outValues[d + AssetManager.STYLE_TYPE] = valueItem.getType();
|
||||||
outValues[d + AssetManager.STYLE_TYPE] = entry.getResValue().getType();
|
outValues[d + AssetManager.STYLE_DATA] = valueItem.getData();
|
||||||
outValues[d + AssetManager.STYLE_DATA] = entry.getResValue().getData();
|
|
||||||
outValues[d + AssetManager.STYLE_ASSET_COOKIE] = getCookie(valueItem);
|
outValues[d + AssetManager.STYLE_ASSET_COOKIE] = getCookie(valueItem);
|
||||||
|
outIndices[++outIndices[0]] = i;
|
||||||
} else {
|
} else {
|
||||||
outValues[d + AssetManager.STYLE_TYPE] = -1;
|
outValues[d + AssetManager.STYLE_TYPE] = -1;
|
||||||
outValues[d + AssetManager.STYLE_ASSET_COOKIE] = -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_TYPE] = valueItem.getType();
|
||||||
outValues[d+AssetManager.STYLE_DATA] = valueItem.getData();
|
outValues[d+AssetManager.STYLE_DATA] = valueItem.getData();
|
||||||
outValues[d+AssetManager.STYLE_ASSET_COOKIE] = getCookie(valueItem);
|
outValues[d+AssetManager.STYLE_ASSET_COOKIE] = getCookie(valueItem);
|
||||||
|
outIndices[++outIndices[0]] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user