当前位置: 首页>>代码示例>>Java>>正文


Java ResourceType.getEnum方法代码示例

本文整理汇总了Java中com.android.resources.ResourceType.getEnum方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceType.getEnum方法的具体用法?Java ResourceType.getEnum怎么用?Java ResourceType.getEnum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.resources.ResourceType的用法示例。


在下文中一共展示了ResourceType.getEnum方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getType

import com.android.resources.ResourceType; //导入方法依赖的package包/类
@Nullable
private ResourceType getType(String qName, NamedNodeMap attributes) {
    String typeValue;

    // if the node is <item>, we get the type from the attribute "type"
    if (SdkConstants.TAG_ITEM.equals(qName)) {
        typeValue = getAttributeValue(attributes, ATTR_TYPE);
    } else {
        // the type is the name of the node.
        typeValue = qName;
    }

    return ResourceType.getEnum(typeValue);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:15,代码来源:ResourceItem.java

示例2: getType

import com.android.resources.ResourceType; //导入方法依赖的package包/类
/**
 * Returns the type of the ResourceItem based on a node's attributes.
 * @param node the node
 * @return the ResourceType or null if it could not be inferred.
 */
static ResourceType getType(@NonNull Node node, @Nullable File from) {
    String nodeName = node.getLocalName();
    String typeString = null;

    if (TAG_ITEM.equals(nodeName)) {
        Attr attribute = (Attr) node.getAttributes().getNamedItemNS(null, ATTR_TYPE);
        if (attribute != null) {
            typeString = attribute.getValue();
        }
    } else if (TAG_EAT_COMMENT.equals(nodeName) || TAG_SKIP.equals(nodeName)) {
        return null;
    } else {
        // the type is the name of the node.
        typeString = nodeName;
    }

    if (typeString != null) {
        ResourceType type = ResourceType.getEnum(typeString);
        if (type != null) {
            return type;
        }

        if (from != null) {
            throw new RuntimeException(String.format("Unsupported type '%s' in file %s", typeString, from));
        }
        throw new RuntimeException(String.format("Unsupported type '%s'", typeString));
    }

    if (from != null) {
        throw new RuntimeException(String.format("Unsupported node '%s' in file %s", nodeName, from));
    }
    throw new RuntimeException(String.format("Unsupported node '%s'", nodeName));
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:39,代码来源:ValueResourceParser2.java

示例3: getType

import com.android.resources.ResourceType; //导入方法依赖的package包/类
private ResourceType getType(String qName, Attributes attributes) {
    String typeValue;

    // if the node is <item>, we get the type from the attribute "type"
    if (NODE_ITEM.equals(qName)) {
        typeValue = attributes.getValue(ATTR_TYPE);
    } else {
        // the type is the name of the node.
        typeValue = qName;
    }

    ResourceType type = ResourceType.getEnum(typeValue);
    return type;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:15,代码来源:ValueResourceParser.java


注:本文中的com.android.resources.ResourceType.getEnum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。