Merge "Add theme information during throwing exception"
This commit is contained in:
committed by
Android (Google) Code Review
commit
3cb6aeccbd
@@ -80,6 +80,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
@@ -1942,6 +1943,16 @@ public class Resources {
|
||||
final Theme other = (Theme) o;
|
||||
return getKey().equals(other.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append('{');
|
||||
sb.append("id=0x").append(Integer.toHexString(getAppliedStyleResId())).append(", ");
|
||||
sb.append("themes=").append(Arrays.deepToString(getTheme()));
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
static class ThemeKey implements Cloneable {
|
||||
|
||||
@@ -527,11 +527,12 @@ public class TypedArray implements AutoCloseable {
|
||||
final TypedValue value = mValue;
|
||||
getValueAt(index, value);
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value);
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Can't convert value at index " + attrIndex
|
||||
+ " to color: type=0x" + Integer.toHexString(type));
|
||||
+ " to color: type=0x" + Integer.toHexString(type) + ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -561,7 +562,8 @@ public class TypedArray implements AutoCloseable {
|
||||
if (getValueAt(index * STYLE_NUM_ENTRIES, value)) {
|
||||
if (value.type == TypedValue.TYPE_ATTRIBUTE) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + index + ": " + value);
|
||||
"Failed to resolve attribute at index " + index + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
return mResources.loadComplexColor(value, value.resourceId, mTheme);
|
||||
}
|
||||
@@ -596,7 +598,8 @@ public class TypedArray implements AutoCloseable {
|
||||
if (getValueAt(index * STYLE_NUM_ENTRIES, value)) {
|
||||
if (value.type == TypedValue.TYPE_ATTRIBUTE) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + index + ": " + value);
|
||||
"Failed to resolve attribute at index " + index + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
return mResources.loadColorStateList(value, value.resourceId, mTheme);
|
||||
}
|
||||
@@ -637,11 +640,12 @@ public class TypedArray implements AutoCloseable {
|
||||
final TypedValue value = mValue;
|
||||
getValueAt(index, value);
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value);
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Can't convert value at index " + attrIndex
|
||||
+ " to integer: type=0x" + Integer.toHexString(type));
|
||||
+ " to integer: type=0x" + Integer.toHexString(type) + ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -684,11 +688,12 @@ public class TypedArray implements AutoCloseable {
|
||||
final TypedValue value = mValue;
|
||||
getValueAt(index, value);
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value);
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Can't convert value at index " + attrIndex
|
||||
+ " to dimension: type=0x" + Integer.toHexString(type));
|
||||
+ " to dimension: type=0x" + Integer.toHexString(type) + ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -732,11 +737,12 @@ public class TypedArray implements AutoCloseable {
|
||||
final TypedValue value = mValue;
|
||||
getValueAt(index, value);
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value);
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Can't convert value at index " + attrIndex
|
||||
+ " to dimension: type=0x" + Integer.toHexString(type));
|
||||
+ " to dimension: type=0x" + Integer.toHexString(type) + ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -781,11 +787,12 @@ public class TypedArray implements AutoCloseable {
|
||||
final TypedValue value = mValue;
|
||||
getValueAt(index, value);
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value);
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Can't convert value at index " + attrIndex
|
||||
+ " to dimension: type=0x" + Integer.toHexString(type));
|
||||
+ " to dimension: type=0x" + Integer.toHexString(type) + ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -825,11 +832,12 @@ public class TypedArray implements AutoCloseable {
|
||||
final TypedValue value = mValue;
|
||||
getValueAt(index, value);
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value);
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException(getPositionDescription()
|
||||
+ ": You must supply a " + name + " attribute.");
|
||||
+ ": You must supply a " + name + " attribute." + ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -900,11 +908,12 @@ public class TypedArray implements AutoCloseable {
|
||||
final TypedValue value = mValue;
|
||||
getValueAt(index, value);
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value);
|
||||
"Failed to resolve attribute at index " + attrIndex + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Can't convert value at index " + attrIndex
|
||||
+ " to fraction: type=0x" + Integer.toHexString(type));
|
||||
+ " to fraction: type=0x" + Integer.toHexString(type) + ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -996,7 +1005,8 @@ public class TypedArray implements AutoCloseable {
|
||||
if (getValueAt(index * STYLE_NUM_ENTRIES, value)) {
|
||||
if (value.type == TypedValue.TYPE_ATTRIBUTE) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + index + ": " + value);
|
||||
"Failed to resolve attribute at index " + index + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
|
||||
if (density > 0) {
|
||||
@@ -1032,7 +1042,8 @@ public class TypedArray implements AutoCloseable {
|
||||
if (getValueAt(index * STYLE_NUM_ENTRIES, value)) {
|
||||
if (value.type == TypedValue.TYPE_ATTRIBUTE) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Failed to resolve attribute at index " + index + ": " + value);
|
||||
"Failed to resolve attribute at index " + index + ": " + value
|
||||
+ ", theme=" + mTheme);
|
||||
}
|
||||
return mResources.getFont(value, value.resourceId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user