summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib/bridge/src
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2015-05-21 01:50:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-21 01:50:23 +0000
commit8562b08f04c1309cf40db1e749d612b6824f1d12 (patch)
tree367b8d37d962d4a9b6daf48bbe64caa21e2b0a56 /tools/layoutlib/bridge/src
parent84fd4af05353303750427b19ea20992694f864f8 (diff)
parent4d8e078c7c9c9f8407ebc7e88673e53b67723e18 (diff)
downloadframeworks_base-8562b08f04c1309cf40db1e749d612b6824f1d12.zip
frameworks_base-8562b08f04c1309cf40db1e749d612b6824f1d12.tar.gz
frameworks_base-8562b08f04c1309cf40db1e749d612b6824f1d12.tar.bz2
Merge "Fix overrides for BridgeResources." into mnc-dev
Diffstat (limited to 'tools/layoutlib/bridge/src')
-rw-r--r--tools/layoutlib/bridge/src/android/content/res/BridgeResources.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
index 2c2c672..fdb6e75 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
@@ -169,7 +169,7 @@ public final class BridgeResources extends Resources {
}
@Override
- public int getColor(int id) throws NotFoundException {
+ public int getColor(int id, Theme theme) throws NotFoundException {
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
if (value != null) {
@@ -192,22 +192,21 @@ public final class BridgeResources extends Resources {
}
}
- // id was not found or not resolved. Throw a NotFoundException.
- throwException(id);
-
- // this is not used since the method above always throws
- return 0;
+ // Suppress possible NPE. getColorStateList will never return null, it will instead
+ // throw an exception, but intelliJ can't figure that out
+ //noinspection ConstantConditions
+ return getColorStateList(id, theme).getDefaultColor();
}
@Override
- public ColorStateList getColorStateList(int id) throws NotFoundException {
+ public ColorStateList getColorStateList(int id, Theme theme) throws NotFoundException {
Pair<String, ResourceValue> resValue = getResourceValue(id, mPlatformResourceFlag);
if (resValue != null) {
ColorStateList stateList = ResourceHelper.getColorStateList(resValue.getSecond(),
mContext);
if (stateList != null) {
- return stateList;
+ return stateList.obtainForTheme(theme);
}
}