summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-11-10 22:05:27 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-10 22:05:27 +0000
commit7d3d5feb31e393c97381f512995d9d799d18304f (patch)
treee97942cd7b001f91a469bf420b5e97f123c12556 /tools
parent828db35568459638e09f86be40340d281804858d (diff)
parent4c0f0e6c852dd933bcfaf95380cca49a46fa3912 (diff)
downloadframeworks_base-7d3d5feb31e393c97381f512995d9d799d18304f.zip
frameworks_base-7d3d5feb31e393c97381f512995d9d799d18304f.tar.gz
frameworks_base-7d3d5feb31e393c97381f512995d9d799d18304f.tar.bz2
am 4c0f0e6c: Merge "Fix setting styles in custom views." into lmp-dev automerge: 5c22a79
* commit '4c0f0e6c852dd933bcfaf95380cca49a46fa3912': Fix setting styles in custom views.
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index 3d3afa4..aeb70e9 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -479,6 +479,23 @@ public final class BridgeContext extends Context {
StyleResourceValue style = getStyleByDynamicId(resid);
if (style == null) {
+ // In some cases, style may not be a dynamic id, so we do a full search.
+ ResourceReference ref = resolveId(resid);
+ if (ref != null) {
+ if (ref.isFramework()) {
+ ref =
+ getRenderResources().getFrameworkResource(ResourceType.STYLE, ref.getName());
+ } else {
+ ref =
+ getRenderResources().getProjectResource(ResourceType.STYLE, ref.getName());
+ }
+ if (ref instanceof StyleResourceValue) {
+ style = ((StyleResourceValue) ref);
+ }
+ }
+ }
+
+ if (style == null) {
throw new Resources.NotFoundException();
}