Java Code Examples for com.android.resources.ResourceType#LAYOUT

The following examples show how to use com.android.resources.ResourceType#LAYOUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceFolder.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private ResourceFile createResourceFile(IAbstractFile file) {
    // check if that's a single or multi resource type folder. For now we define this by
    // the number of possible resource type output by files in the folder.
    // We have a special case for layout/menu folders which can also generate IDs.
    // This does
    // not make the difference between several resource types from a single file or
    // the ability to have 2 files in the same folder generating 2 different types of
    // resource. The former is handled by MultiResourceFile properly while we don't
    // handle the latter. If we were to add this behavior we'd have to change this call.
    List<ResourceType> types = FolderTypeRelationship.getRelatedResourceTypes(mType);

    ResourceFile resFile = null;
    if (types.size() == 1) {
        resFile = new SingleResourceFile(file, this);
    } else if (types.contains(ResourceType.LAYOUT)) {
        resFile = new IdGeneratingResourceFile(file, this, ResourceType.LAYOUT);
    } else if (types.contains(ResourceType.MENU)) {
        resFile = new IdGeneratingResourceFile(file, this, ResourceType.MENU);
    } else {
        resFile = new MultiResourceFile(file, this);
    }
    return resFile;
}
 
Example 2
Source File: ResourceFolder.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private ResourceFile createResourceFile(IAbstractFile file) {
    // check if that's a single or multi resource type folder. For now we define this by
    // the number of possible resource type output by files in the folder.
    // We have a special case for layout/menu folders which can also generate IDs.
    // This does
    // not make the difference between several resource types from a single file or
    // the ability to have 2 files in the same folder generating 2 different types of
    // resource. The former is handled by MultiResourceFile properly while we don't
    // handle the latter. If we were to add this behavior we'd have to change this call.
    List<ResourceType> types = FolderTypeRelationship.getRelatedResourceTypes(mType);

    ResourceFile resFile = null;
    if (types.size() == 1) {
        resFile = new SingleResourceFile(file, this);
    } else if (types.contains(ResourceType.LAYOUT)) {
        resFile = new IdGeneratingResourceFile(file, this, ResourceType.LAYOUT);
    } else if (types.contains(ResourceType.MENU)) {
        resFile = new IdGeneratingResourceFile(file, this, ResourceType.MENU);
    } else {
        resFile = new MultiResourceFile(file, this);
    }
    return resFile;
}