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
some fixes to make NewPipe not crash when layouting
This commit is contained in:
@@ -323,9 +323,22 @@ public final class AssetManager {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ident = 0;
|
||||
if (valueItem != null && valueItem.getValueType() == ValueType.REFERENCE) {
|
||||
while (valueItem.getValueType() == ValueType.REFERENCE) {
|
||||
ident = valueItem.getData();
|
||||
valueItem = null;
|
||||
if (ident == 0)
|
||||
break;
|
||||
valueItem = tableBlockSearch(ident).pickOne().getResValue();
|
||||
if (valueItem == null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (valueItem == null)
|
||||
return false;
|
||||
outValue.resourceId = 0;
|
||||
outValue.resourceId = ident;
|
||||
outValue.type = valueItem.getType();
|
||||
outValue.data = valueItem.getData();
|
||||
outValue.assetCookie = -1;
|
||||
@@ -925,31 +938,20 @@ public final class AssetManager {
|
||||
if (valueItem.getValueType() == ValueType.REFERENCE) {
|
||||
while (valueItem.getValueType() == ValueType.REFERENCE) {
|
||||
resId = valueItem.getData();
|
||||
valueItem = null;
|
||||
if (resId == 0)
|
||||
break;
|
||||
valueItem = tableBlockSearch(resId).pickOne().getResValue();
|
||||
if (valueItem == null)
|
||||
entry = tableBlockSearch(resId).pickOne();
|
||||
if (entry == null || entry.getResValue() == null)
|
||||
break;
|
||||
valueItem = entry.getResValue();
|
||||
}
|
||||
|
||||
outValues[d + AssetManager.STYLE_RESOURCE_ID] = resId;
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
outValues[d+AssetManager.STYLE_RESOURCE_ID] = 0;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -314,7 +314,8 @@ public class TypedArray {
|
||||
return defValue;
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Can't convert to color: type=0x" + Integer.toHexString(type));
|
||||
Log.e(Resources.TAG, "Can't convert to color: type=0x" + Integer.toHexString(type));
|
||||
return defValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,6 +332,8 @@ public class TypedArray {
|
||||
if (getValueAt(index * AssetManager.STYLE_NUM_ENTRIES, value)) {
|
||||
if (value.type == -1)
|
||||
return null;
|
||||
if (value.type == TypedValue.TYPE_REFERENCE && value.data == 0)
|
||||
return null;
|
||||
return mResources.loadColorStateList(value, value.resourceId);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user