Java Code Examples for com.android.resources.ResourceFolderType#DRAWABLE

The following examples show how to use com.android.resources.ResourceFolderType#DRAWABLE . 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: OverdrawDetector.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void beforeCheckFile(@NonNull Context context) {
    if (endsWith(context.file.getName(), DOT_XML)) {
        // Drawable XML files should not be considered for overdraw, except for <bitmap>'s.
        // The bitmap elements are handled in the scanBitmap() method; it will clear
        // out anything added by this method.
        File parent = context.file.getParentFile();
        ResourceFolderType type = ResourceFolderType.getFolderType(parent.getName());
        if (type == ResourceFolderType.DRAWABLE) {
            if (mValidDrawables == null) {
                mValidDrawables = new ArrayList<String>();
            }
            String resource = getDrawableResource(context.file);
            mValidDrawables.add(resource);
        }
    }
}
 
Example 2
Source File: ApiDetector.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns true if this attribute is in a drawable document with one of the
 * root tags that require API 21
 */
private static boolean isAlreadyWarnedDrawableFile(@NonNull XmlContext context,
        @NonNull Attr attribute, int attributeApiLevel) {
    // Don't complain if it's in a drawable file where we've already
    // flagged the root drawable type as being unsupported
    if (context.getResourceFolderType() == ResourceFolderType.DRAWABLE
            && attributeApiLevel == 21) {
        String root = attribute.getOwnerDocument().getDocumentElement().getTagName();
        if (TAG_RIPPLE.equals(root)
                || TAG_VECTOR.equals(root)
                || TAG_ANIMATED_VECTOR.equals(root)
                || TAG_ANIMATED_SELECTOR.equals(root)) {
            return true;
        }
    }

    return false;
}
 
Example 3
Source File: OverdrawDetector.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    // Look in layouts for drawable resources
    return super.appliesTo(folderType)
            // and in resource files for theme definitions
            || folderType == ResourceFolderType.VALUES
            // and in drawable files for bitmap tiling modes
            || folderType == ResourceFolderType.DRAWABLE;
}
 
Example 4
Source File: ResourceCycleDetector.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    return folderType == ResourceFolderType.VALUES
            || folderType == ResourceFolderType.COLOR
            || folderType == ResourceFolderType.DRAWABLE
            || folderType == ResourceFolderType.LAYOUT;
}
 
Example 5
Source File: ExtraTextDetector.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    return folderType == ResourceFolderType.LAYOUT
            || folderType == ResourceFolderType.MENU
            || folderType == ResourceFolderType.ANIM
            || folderType == ResourceFolderType.ANIMATOR
            || folderType == ResourceFolderType.DRAWABLE
            || folderType == ResourceFolderType.COLOR;
}
 
Example 6
Source File: StateListDetector.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean appliesTo(@NonNull ResourceFolderType folderType) {
    return folderType == ResourceFolderType.DRAWABLE;
}
 
Example 7
Source File: VectorDrawableRenderer.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
private boolean isInDrawable(@NonNull File inputXmlFile) {
    ResourceFolderType folderType =
            ResourceFolderType.getFolderType(inputXmlFile.getParentFile().getName());

    return folderType == ResourceFolderType.DRAWABLE;
}