MimePredicatepublic class MimePredicate extends Object implements com.android.internal.util.Predicate
Fields Summary |
---|
private final String[] | mFilters | public static final String[] | VISUAL_MIMESMIME 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 boolean | apply(com.android.documentsui.model.DocumentInfo doc)
if (doc.isDirectory()) {
return true;
}
if (mimeMatches(mFilters, doc.mimeType)) {
return true;
}
return false;
| public static boolean | mimeMatches(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 boolean | mimeMatches(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 boolean | mimeMatches(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 boolean | mimeMatches(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;
}
|
|