Methods Summary |
---|
public static com.android.layoutlib.bridge.impl.DelegateManager | getDelegateManager()
return sManager;
|
static TypedArray | obtainStyledAttributes(Resources thisResources, android.content.res.Resources.Theme thisTheme, int[] attrs)
boolean changed = setupResources(thisTheme);
BridgeTypedArray ta = RenderSessionImpl.getCurrentContext().obtainStyledAttributes(attrs);
ta.setTheme(thisTheme);
restoreResources(changed);
return ta;
|
static TypedArray | obtainStyledAttributes(Resources thisResources, android.content.res.Resources.Theme thisTheme, int resid, int[] attrs)
boolean changed = setupResources(thisTheme);
BridgeTypedArray ta = RenderSessionImpl.getCurrentContext().obtainStyledAttributes(resid,
attrs);
ta.setTheme(thisTheme);
restoreResources(changed);
return ta;
|
static TypedArray | obtainStyledAttributes(Resources thisResources, android.content.res.Resources.Theme thisTheme, android.util.AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes)
boolean changed = setupResources(thisTheme);
BridgeTypedArray ta = RenderSessionImpl.getCurrentContext().obtainStyledAttributes(set,
attrs, defStyleAttr, defStyleRes);
ta.setTheme(thisTheme);
restoreResources(changed);
return ta;
|
static boolean | resolveAttribute(Resources thisResources, android.content.res.Resources.Theme thisTheme, int resid, android.util.TypedValue outValue, boolean resolveRefs)
boolean changed = setupResources(thisTheme);
boolean found = RenderSessionImpl.getCurrentContext().resolveThemeAttribute(resid,
outValue, resolveRefs);
restoreResources(changed);
return found;
|
static TypedArray | resolveAttributes(Resources thisResources, android.content.res.Resources.Theme thisTheme, int[] values, int[] attrs)
// FIXME
return null;
|
private static com.android.ide.common.rendering.api.StyleResourceValue | resolveStyle(int nativeResid)
if (nativeResid == 0) {
return null;
}
BridgeContext context = RenderSessionImpl.getCurrentContext();
ResourceReference theme = context.resolveId(nativeResid);
if (theme.isFramework()) {
return (StyleResourceValue) context.getRenderResources()
.getFrameworkResource(ResourceType.STYLE, theme.getName());
} else {
return (StyleResourceValue) context.getRenderResources()
.getProjectResource(ResourceType.STYLE, theme.getName());
}
|
private static void | restoreResources(boolean changed)
if (changed) {
RenderSessionImpl.getCurrentContext().getRenderResources().clearStyles();
}
|
private static boolean | setupResources(android.content.res.Resources.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(" ");
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, force);
changed = true;
}
}
return changed;
|