Loading tools/layoutlib/bridge/src/android/content/res/AssetManager_Delegate.java +0 −4 Original line number Diff line number Diff line Loading @@ -38,8 +38,4 @@ public class AssetManager_Delegate { Resources_Theme_Delegate.getDelegateManager().removeJavaReferenceFor(theme); } @LayoutlibDelegate /*package*/ static void applyThemeStyle(long theme, int styleRes, boolean force) { Resources_Theme_Delegate.getDelegateManager().getDelegate(theme).force = force; } } tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java +22 −10 Original line number Diff line number Diff line Loading @@ -39,9 +39,6 @@ import android.util.TypedValue; */ public class Resources_Theme_Delegate { // Whether to use the Theme.mThemeResId as primary theme. boolean force; // ---- delegate manager ---- private static final DelegateManager<Resources_Theme_Delegate> sManager = Loading Loading @@ -111,14 +108,29 @@ public class Resources_Theme_Delegate { // ---- private helper methods ---- private static boolean setupResources(Theme thisTheme) { Resources_Theme_Delegate themeDelegate = sManager.getDelegate(thisTheme.getNativeTheme()); StyleResourceValue style = resolveStyle(thisTheme.getAppliedStyleResId()); // 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(" "); 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); if (style != null) { RenderSessionImpl.getCurrentContext().getRenderResources() .applyStyle(style, themeDelegate.force); return true; RenderSessionImpl.getCurrentContext().getRenderResources().applyStyle(style, force); changed = true; } } return false; return changed; } private static void restoreResources(boolean changed) { Loading tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +0 −1 Original line number Diff line number Diff line Loading @@ -143,7 +143,6 @@ public final class CreateInfo implements ICreateInfo { "android.content.res.Resources$Theme#resolveAttributes", "android.content.res.AssetManager#newTheme", "android.content.res.AssetManager#deleteTheme", "android.content.res.AssetManager#applyThemeStyle", "android.content.res.TypedArray#getValueAt", "android.content.res.TypedArray#obtain", "android.graphics.BitmapFactory#finishDecode", Loading Loading
tools/layoutlib/bridge/src/android/content/res/AssetManager_Delegate.java +0 −4 Original line number Diff line number Diff line Loading @@ -38,8 +38,4 @@ public class AssetManager_Delegate { Resources_Theme_Delegate.getDelegateManager().removeJavaReferenceFor(theme); } @LayoutlibDelegate /*package*/ static void applyThemeStyle(long theme, int styleRes, boolean force) { Resources_Theme_Delegate.getDelegateManager().getDelegate(theme).force = force; } }
tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java +22 −10 Original line number Diff line number Diff line Loading @@ -39,9 +39,6 @@ import android.util.TypedValue; */ public class Resources_Theme_Delegate { // Whether to use the Theme.mThemeResId as primary theme. boolean force; // ---- delegate manager ---- private static final DelegateManager<Resources_Theme_Delegate> sManager = Loading Loading @@ -111,14 +108,29 @@ public class Resources_Theme_Delegate { // ---- private helper methods ---- private static boolean setupResources(Theme thisTheme) { Resources_Theme_Delegate themeDelegate = sManager.getDelegate(thisTheme.getNativeTheme()); StyleResourceValue style = resolveStyle(thisTheme.getAppliedStyleResId()); // 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(" "); 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); if (style != null) { RenderSessionImpl.getCurrentContext().getRenderResources() .applyStyle(style, themeDelegate.force); return true; RenderSessionImpl.getCurrentContext().getRenderResources().applyStyle(style, force); changed = true; } } return false; return changed; } private static void restoreResources(boolean changed) { Loading
tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +0 −1 Original line number Diff line number Diff line Loading @@ -143,7 +143,6 @@ public final class CreateInfo implements ICreateInfo { "android.content.res.Resources$Theme#resolveAttributes", "android.content.res.AssetManager#newTheme", "android.content.res.AssetManager#deleteTheme", "android.content.res.AssetManager#applyThemeStyle", "android.content.res.TypedArray#getValueAt", "android.content.res.TypedArray#obtain", "android.graphics.BitmapFactory#finishDecode", Loading