FileDocCategorySizeDatePackage
MimePredicate.javaAPI DocAndroid 5.1 API2759Thu Mar 12 22:22:40 GMT 2015com.android.documentsui

MimePredicate

public class MimePredicate extends Object implements com.android.internal.util.Predicate

Fields Summary
private final String[]
mFilters
public static final String[]
VISUAL_MIMES
MIME types that are visual in nature. For example, they should always be shown as thumbnails in list mode.
Constructors Summary
public MimePredicate(String[] filters)


       
        mFilters = filters;
    
Methods Summary
public booleanapply(com.android.documentsui.model.DocumentInfo doc)

        if (doc.isDirectory()) {
            return true;
        }
        if (mimeMatches(mFilters, doc.mimeType)) {
            return true;
        }
        return false;
    
public static booleanmimeMatches(java.lang.String[] filters, java.lang.String[] tests)

        if (tests == null) {
            return false;
        }
        for (String test : tests) {
            if (mimeMatches(filters, test)) {
                return true;
            }
        }
        return false;
    
public static booleanmimeMatches(java.lang.String filter, java.lang.String[] tests)

        if (tests == null) {
            return true;
        }
        for (String test : tests) {
            if (mimeMatches(filter, test)) {
                return true;
            }
        }
        return false;
    
public static booleanmimeMatches(java.lang.String[] filters, java.lang.String test)

        if (filters == null) {
            return true;
        }
        for (String filter : filters) {
            if (mimeMatches(filter, test)) {
                return true;
            }
        }
        return false;
    
public static booleanmimeMatches(java.lang.String filter, java.lang.String test)

        if (test == null) {
            return false;
        } else if (filter == null || "*/*".equals(filter)) {
            return true;
        } else if (filter.equals(test)) {
            return true;
        } else if (filter.endsWith("/*")) {
            return filter.regionMatches(0, test, 0, filter.indexOf('/"));
        } else {
            return false;
        }