* commit '147c0506d5425633f0d45e1489262d4e27a35921': LayoutLib: Fix Status/Navigation Bar color. [DO NOT MERGE]
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.layoutlib.bridge.bars;
|
package com.android.layoutlib.bridge.bars;
|
||||||
|
|
||||||
|
import com.android.ide.common.rendering.api.LayoutLog;
|
||||||
import com.android.ide.common.rendering.api.RenderResources;
|
import com.android.ide.common.rendering.api.RenderResources;
|
||||||
import com.android.ide.common.rendering.api.ResourceValue;
|
import com.android.ide.common.rendering.api.ResourceValue;
|
||||||
import com.android.ide.common.rendering.api.StyleResourceValue;
|
import com.android.ide.common.rendering.api.StyleResourceValue;
|
||||||
@@ -258,8 +259,21 @@ abstract class CustomBar extends LinearLayout {
|
|||||||
ResourceValue resource = renderResources.findItemInTheme(attr, true);
|
ResourceValue resource = renderResources.findItemInTheme(attr, true);
|
||||||
// Form @color/bar to the #AARRGGBB
|
// Form @color/bar to the #AARRGGBB
|
||||||
resource = renderResources.resolveResValue(resource);
|
resource = renderResources.resolveResValue(resource);
|
||||||
if (resource != null && ResourceType.COLOR.equals(resource.getResourceType())) {
|
if (resource != null) {
|
||||||
return ResourceHelper.getColor(resource.getValue());
|
ResourceType type = resource.getResourceType();
|
||||||
|
if (type == null || type == ResourceType.COLOR) {
|
||||||
|
// if no type is specified, the value may have been specified directly in the style
|
||||||
|
// file, rather than referencing a color resource value.
|
||||||
|
try {
|
||||||
|
return ResourceHelper.getColor(resource.getValue());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// Conversion failed.
|
||||||
|
Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
|
||||||
|
"Theme attribute @android:" + attr +
|
||||||
|
" does not reference a color, instead is '" +
|
||||||
|
resource.getValue() + "'.", resource);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user