use of org.robolectric.res.ThemeStyleSet in project robolectric by robolectric.
the class ShadowAssetManager method resolveStyle.
private Style resolveStyle(@NotNull ResName themeStyleName, Style themeStyleSet) {
TypedResource themeStyleResource = resourceTable.getValue(themeStyleName, RuntimeEnvironment.getQualifiers());
if (themeStyleResource == null)
return null;
StyleData themeStyleData = (StyleData) themeStyleResource.getData();
if (themeStyleSet == null) {
themeStyleSet = new ThemeStyleSet();
}
return new StyleResolver(resourceTable, shadowOf(AssetManager.getSystem()).getResourceTable(), themeStyleData, themeStyleSet, themeStyleName, RuntimeEnvironment.getQualifiers());
}
use of org.robolectric.res.ThemeStyleSet in project robolectric by robolectric.
the class ShadowAssetManager method getThemeValue.
@HiddenApi
@Implementation(minSdk = LOLLIPOP)
public boolean getThemeValue(long themePtr, int ident, TypedValue outValue, boolean resolveRefs) {
ResName resName = resourceTable.getResName(ident);
ThemeStyleSet themeStyleSet = getNativeTheme(themePtr).themeStyleSet;
AttributeResource attrValue = themeStyleSet.getAttrValue(resName);
while (attrValue != null && attrValue.isStyleReference()) {
ResName attrResName = attrValue.getStyleReference();
if (attrValue.resName.equals(attrResName)) {
Logger.info("huh... circular reference for %s?", attrResName.getFullyQualifiedName());
return false;
}
attrValue = themeStyleSet.getAttrValue(attrResName);
}
if (attrValue != null) {
convertAndFill(attrValue, outValue, RuntimeEnvironment.getQualifiers(), resolveRefs);
return true;
}
return false;
}
Aggregations