Search in sources :

Example 46 with MatrixCursor

use of android.database.MatrixCursor in project Android-Developers-Samples by johnjohndoe.

the class MyCloudProvider method queryDocument.

// END_INCLUDE(open_document_thumbnail)
// BEGIN_INCLUDE(query_document)
@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
    Log.v(TAG, "queryDocument");
    // Create a cursor with the requested projection, or the default projection.
    final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
    includeFile(result, documentId, null);
    return result;
}
Also used : MatrixCursor(android.database.MatrixCursor)

Example 47 with MatrixCursor

use of android.database.MatrixCursor in project Timber by naman14.

the class MusicService method updateCursorForDownloadedFile.

private void updateCursorForDownloadedFile(Context context, Uri uri) {
    synchronized (this) {
        closeCursor();
        MatrixCursor cursor = new MatrixCursor(PROJECTION_MATRIX);
        String title = getValueForDownloadedFile(this, uri, "title");
        cursor.addRow(new Object[] { null, null, null, title, null, null, null, null });
        mCursor = cursor;
        mCursor.moveToFirst();
    }
}
Also used : MatrixCursor(android.database.MatrixCursor)

Example 48 with MatrixCursor

use of android.database.MatrixCursor in project Etar-Calendar by Etar-Group.

the class Utils method matrixCursorFromCursor.

public static MatrixCursor matrixCursorFromCursor(Cursor cursor) {
    if (cursor == null) {
        return null;
    }
    String[] columnNames = cursor.getColumnNames();
    if (columnNames == null) {
        columnNames = new String[] {};
    }
    MatrixCursor newCursor = new MatrixCursor(columnNames);
    int numColumns = cursor.getColumnCount();
    String[] data = new String[numColumns];
    cursor.moveToPosition(-1);
    while (cursor.moveToNext()) {
        for (int i = 0; i < numColumns; i++) {
            data[i] = cursor.getString(i);
        }
        newCursor.addRow(data);
    }
    return newCursor;
}
Also used : SpannableString(android.text.SpannableString) MatrixCursor(android.database.MatrixCursor)

Example 49 with MatrixCursor

use of android.database.MatrixCursor in project android_frameworks_base by ResurrectionRemix.

the class StressProvider method queryDocument.

@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
    final MatrixCursor result = new MatrixCursor(DEFAULT_DOCUMENT_PROJECTION);
    final StubDocument document = mDocuments.get(documentId);
    includeDocument(result, document);
    return result;
}
Also used : MatrixCursor(android.database.MatrixCursor)

Example 50 with MatrixCursor

use of android.database.MatrixCursor in project android_frameworks_base by ResurrectionRemix.

the class StubProvider method queryRoots.

@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
    final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_ROOT_PROJECTION);
    for (Map.Entry<String, RootInfo> entry : mRoots.entrySet()) {
        final String id = entry.getKey();
        final RootInfo info = entry.getValue();
        final RowBuilder row = result.newRow();
        row.add(Root.COLUMN_ROOT_ID, id);
        row.add(Root.COLUMN_FLAGS, info.flags);
        row.add(Root.COLUMN_TITLE, id);
        row.add(Root.COLUMN_DOCUMENT_ID, info.document.documentId);
        row.add(Root.COLUMN_AVAILABLE_BYTES, info.getRemainingCapacity());
    }
    return result;
}
Also used : RowBuilder(android.database.MatrixCursor.RowBuilder) HashMap(java.util.HashMap) Map(java.util.Map) MatrixCursor(android.database.MatrixCursor)

Aggregations

MatrixCursor (android.database.MatrixCursor)259 Cursor (android.database.Cursor)37 DirectoryResult (com.android.documentsui.DirectoryResult)35 RowBuilder (android.database.MatrixCursor.RowBuilder)30 File (java.io.File)30 MergeCursor (android.database.MergeCursor)18 Uri (android.net.Uri)18 Test (org.junit.Test)17 Setting (com.android.providers.settings.SettingsState.Setting)15 FileNotFoundException (java.io.FileNotFoundException)15 ArrayList (java.util.ArrayList)13 Bundle (android.os.Bundle)10 BitSet (java.util.BitSet)10 Random (java.util.Random)10 IOException (java.io.IOException)7 LinkedList (java.util.LinkedList)7 ContentValues (android.content.ContentValues)6 HashSet (java.util.HashSet)6 Map (java.util.Map)6 SQLiteQueryBuilder (android.database.sqlite.SQLiteQueryBuilder)5