diff options
author | 2015-05-07 16:24:10 -0700 | |
---|---|---|
committer | 2015-05-07 16:24:10 -0700 | |
commit | 78f12e43f08a1b2acda7b565a310c48e507f5e47 (patch) | |
tree | 91016036ebf5d585653a9e9f13a6b975a46893f3 | |
parent | 1e6be7285d4dc8b494c70aef8d2ed8b8c1d8e0de (diff) |
Update LayoutLib for theme key changes to fix build
Change-Id: I47b400b320f16688cd32c1d8955a660637d93f4d
-rw-r--r-- | tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java | 23 |
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 4bd83e92fa3c..41d94b7d03e0 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; } |