Merge "Fix setting styles in custom views." into lmp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5c22a79baf
@ -478,6 +478,23 @@ public final class BridgeContext extends Context {
|
|||||||
// get the StyleResourceValue based on the resId;
|
// get the StyleResourceValue based on the resId;
|
||||||
StyleResourceValue style = getStyleByDynamicId(resid);
|
StyleResourceValue style = getStyleByDynamicId(resid);
|
||||||
|
|
||||||
|
if (style == null) {
|
||||||
|
// In some cases, style may not be a dynamic id, so we do a full search.
|
||||||
|
ResourceReference ref = resolveId(resid);
|
||||||
|
if (ref != null) {
|
||||||
|
if (ref.isFramework()) {
|
||||||
|
ref =
|
||||||
|
getRenderResources().getFrameworkResource(ResourceType.STYLE, ref.getName());
|
||||||
|
} else {
|
||||||
|
ref =
|
||||||
|
getRenderResources().getProjectResource(ResourceType.STYLE, ref.getName());
|
||||||
|
}
|
||||||
|
if (ref instanceof StyleResourceValue) {
|
||||||
|
style = ((StyleResourceValue) ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (style == null) {
|
if (style == null) {
|
||||||
throw new Resources.NotFoundException();
|
throw new Resources.NotFoundException();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user