Loading tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java +9 −14 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading
tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java +9 −14 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading