Merge "Fix overrides for BridgeResources." into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8562b08f04
@@ -169,7 +169,7 @@ public final class BridgeResources extends Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColor(int id) throws NotFoundException {
|
public int getColor(int id, Theme theme) throws NotFoundException {
|
||||||
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
|
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
@@ -192,22 +192,21 @@ public final class BridgeResources extends Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// id was not found or not resolved. Throw a NotFoundException.
|
// Suppress possible NPE. getColorStateList will never return null, it will instead
|
||||||
throwException(id);
|
// throw an exception, but intelliJ can't figure that out
|
||||||
|
//noinspection ConstantConditions
|
||||||
// this is not used since the method above always throws
|
return getColorStateList(id, theme).getDefaultColor();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ColorStateList getColorStateList(int id) throws NotFoundException {
|
public ColorStateList getColorStateList(int id, Theme theme) throws NotFoundException {
|
||||||
Pair<String, ResourceValue> resValue = getResourceValue(id, mPlatformResourceFlag);
|
Pair<String, ResourceValue> resValue = getResourceValue(id, mPlatformResourceFlag);
|
||||||
|
|
||||||
if (resValue != null) {
|
if (resValue != null) {
|
||||||
ColorStateList stateList = ResourceHelper.getColorStateList(resValue.getSecond(),
|
ColorStateList stateList = ResourceHelper.getColorStateList(resValue.getSecond(),
|
||||||
mContext);
|
mContext);
|
||||||
if (stateList != null) {
|
if (stateList != null) {
|
||||||
return stateList;
|
return stateList.obtainForTheme(theme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user