Search in sources :

Example 11 with AttributeFormat

use of org.jetbrains.android.dom.attrs.AttributeFormat in project android by JetBrains.

the class BrowsePanel method getResourceTypes.

@NotNull
public static EnumSet<ResourceType> getResourceTypes(@NotNull String propertyName, @Nullable AttributeDefinition definition) {
    Set<AttributeFormat> formats = definition != null ? definition.getFormats() : EnumSet.allOf(AttributeFormat.class);
    // for some special known properties, we can narrow down the possible types (rather than the all encompassing reference type)
    ResourceType type = AndroidDomUtil.SPECIAL_RESOURCE_TYPES.get(propertyName);
    return type == null ? AttributeFormat.convertTypes(formats) : EnumSet.of(type);
}
Also used : AttributeFormat(org.jetbrains.android.dom.attrs.AttributeFormat) ResourceType(com.android.resources.ResourceType) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

AttributeFormat (org.jetbrains.android.dom.attrs.AttributeFormat)11 AttributeDefinition (org.jetbrains.android.dom.attrs.AttributeDefinition)6 NotNull (org.jetbrains.annotations.NotNull)4 Nullable (org.jetbrains.annotations.Nullable)4 ResourceType (com.android.resources.ResourceType)3 ResourceValue (com.android.ide.common.rendering.api.ResourceValue)2 ViewGroup (android.view.ViewGroup)1 LinearLayout (android.widget.LinearLayout)1 SdkConstants (com.android.SdkConstants)1 ATTR_LAYOUT_RESOURCE_PREFIX (com.android.SdkConstants.ATTR_LAYOUT_RESOURCE_PREFIX)1 ItemResourceValue (com.android.ide.common.rendering.api.ItemResourceValue)1 StyleResourceValue (com.android.ide.common.rendering.api.StyleResourceValue)1 ResourceResolver (com.android.ide.common.resources.ResourceResolver)1 ID (com.android.resources.ResourceType.ID)1 IAndroidTarget (com.android.sdklib.IAndroidTarget)1 Configuration (com.android.tools.idea.configurations.Configuration)1 ResolutionUtils (com.android.tools.idea.editors.theme.ResolutionUtils)1 AppResourceRepository (com.android.tools.idea.res.AppResourceRepository)1 ResourceHelper (com.android.tools.idea.res.ResourceHelper)1 HtmlBuilder (com.android.utils.HtmlBuilder)1