FilteringCursorWrapperpublic class FilteringCursorWrapper extends android.database.AbstractCursor Cursor wrapper that filters MIME types not matching given list. |
Fields Summary |
---|
private final android.database.Cursor | mCursor | private final int[] | mPosition | private int | mCount |
Constructors Summary |
---|
public FilteringCursorWrapper(android.database.Cursor cursor, String[] acceptMimes)
this(cursor, acceptMimes, null, Long.MIN_VALUE);
| public FilteringCursorWrapper(android.database.Cursor cursor, String[] acceptMimes, String[] rejectMimes)
this(cursor, acceptMimes, rejectMimes, Long.MIN_VALUE);
| public FilteringCursorWrapper(android.database.Cursor cursor, String[] acceptMimes, String[] rejectMimes, long rejectBefore)
mCursor = cursor;
final int count = cursor.getCount();
mPosition = new int[count];
cursor.moveToPosition(-1);
while (cursor.moveToNext() && mCount < count) {
final String mimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE);
final long lastModified = getCursorLong(cursor, Document.COLUMN_LAST_MODIFIED);
if (rejectMimes != null && MimePredicate.mimeMatches(rejectMimes, mimeType)) {
continue;
}
if (lastModified < rejectBefore) {
continue;
}
if (MimePredicate.mimeMatches(acceptMimes, mimeType)) {
mPosition[mCount++] = cursor.getPosition();
}
}
Log.d(TAG, "Before filtering " + cursor.getCount() + ", after " + mCount);
|
Methods Summary |
---|
public void | close()
super.close();
mCursor.close();
| public java.lang.String[] | getColumnNames()
return mCursor.getColumnNames();
| public int | getCount()
return mCount;
| public double | getDouble(int column)
return mCursor.getDouble(column);
| public android.os.Bundle | getExtras()
return mCursor.getExtras();
| public float | getFloat(int column)
return mCursor.getFloat(column);
| public int | getInt(int column)
return mCursor.getInt(column);
| public long | getLong(int column)
return mCursor.getLong(column);
| public short | getShort(int column)
return mCursor.getShort(column);
| public java.lang.String | getString(int column)
return mCursor.getString(column);
| public int | getType(int column)
return mCursor.getType(column);
| public boolean | isNull(int column)
return mCursor.isNull(column);
| public boolean | onMove(int oldPosition, int newPosition)
return mCursor.moveToPosition(mPosition[newPosition]);
|
|