summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-05-07 16:24:10 -0700
committerAlan Viverette <alanv@google.com>2015-05-07 16:24:10 -0700
commit78f12e43f08a1b2acda7b565a310c48e507f5e47 (patch)
tree91016036ebf5d585653a9e9f13a6b975a46893f3 /tools/layoutlib
parent1e6be7285d4dc8b494c70aef8d2ed8b8c1d8e0de (diff)
downloadframeworks_base-78f12e43f08a1b2acda7b565a310c48e507f5e47.zip
frameworks_base-78f12e43f08a1b2acda7b565a310c48e507f5e47.tar.gz
frameworks_base-78f12e43f08a1b2acda7b565a310c48e507f5e47.tar.bz2
Update LayoutLib for theme key changes to fix build
Change-Id: I47b400b320f16688cd32c1d8955a660637d93f4d
Diffstat (limited to 'tools/layoutlib')
-rw-r--r--tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java23
1 files changed, 9 insertions, 14 deletions
diff --git a/tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java b/tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java
index 4bd83e9..41d94b7 100644
--- a/tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java
@@ -27,6 +27,7 @@ import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
import android.content.res.Resources.NotFoundException;
import android.content.res.Resources.Theme;
+import android.content.res.Resources.ThemeKey;
import android.util.AttributeSet;
import android.util.TypedValue;
@@ -110,22 +111,16 @@ public class Resources_Theme_Delegate {
private static boolean setupResources(Theme thisTheme) {
// Key is a space-separated list of theme ids applied that have been merged into the
// BridgeContext's theme to make thisTheme.
- String[] appliedStyles = thisTheme.getKey().split(" ");
+ final ThemeKey key = thisTheme.getKey();
+ final int[] resId = key.mResId;
+ final boolean[] force = key.mForce;
+
boolean changed = false;
- for (String s : appliedStyles) {
- if (s.isEmpty()) {
- continue;
- }
- // See the definition of force parameter in Theme.applyStyle().
- boolean force = false;
- if (s.charAt(s.length() - 1) == '!') {
- force = true;
- s = s.substring(0, s.length() - 1);
- }
- int styleId = Integer.parseInt(s, 16);
- StyleResourceValue style = resolveStyle(styleId);
+ for (int i = 0, N = key.mCount; i < N; i++) {
+ StyleResourceValue style = resolveStyle(resId[i]);
if (style != null) {
- RenderSessionImpl.getCurrentContext().getRenderResources().applyStyle(style, force);
+ RenderSessionImpl.getCurrentContext().getRenderResources().applyStyle(
+ style, force[i]);
changed = true;
}