Search in sources :

Example 21 with MatrixCursor

use of android.database.MatrixCursor in project iosched by google.

the class SpeakersMockCursor method getCursorForNoSpeaker.

public static MatrixCursor getCursorForNoSpeaker() {
    String[] data = { "", "", "", "", "", "", "" };
    String[] columns = { "speaker_name", "speaker_image_url", "speaker_company", "speaker_abstract", "speaker_url", "plusone_url", "twitter_url" };
    MatrixCursor matrixCursor = new MatrixCursor(columns);
    matrixCursor.addRow(data);
    return matrixCursor;
}
Also used : MatrixCursor(android.database.MatrixCursor)

Example 22 with MatrixCursor

use of android.database.MatrixCursor in project reark by reark.

the class SimpleMockContentProvider method getCursor.

// Crude imitation of the behavior of SQL content provider
private Cursor getCursor(Uri uri, String... projection) {
    MatrixCursor cursor = new MatrixCursor(projection);
    if (values.containsKey(uri)) {
        String[] result = { uri.getLastPathSegment(), values.get(uri) };
        cursor.addRow(result);
    } else if ("0".equals(uri.getLastPathSegment())) {
        for (Uri key : values.keySet()) {
            String[] result = { key.getLastPathSegment(), values.get(key) };
            cursor.addRow(result);
        }
    }
    return cursor;
}
Also used : Uri(android.net.Uri) MatrixCursor(android.database.MatrixCursor)

Example 23 with MatrixCursor

use of android.database.MatrixCursor in project glide by bumptech.

the class ThumbnailStreamOpenerTest method testReturnsNullIfCursorIsEmpty.

@Test
public void testReturnsNullIfCursorIsEmpty() throws FileNotFoundException {
    when(harness.query.query(eq(harness.uri))).thenReturn(new MatrixCursor(new String[1]));
    assertNull(harness.get().open(harness.uri));
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) MatrixCursor(android.database.MatrixCursor) Test(org.junit.Test)

Example 24 with MatrixCursor

use of android.database.MatrixCursor in project glide by bumptech.

the class ThumbnailStreamOpenerTest method testReturnsNullIfCursorHasEmptyPath.

@Test
public void testReturnsNullIfCursorHasEmptyPath() throws FileNotFoundException {
    MatrixCursor cursor = new MatrixCursor(new String[1]);
    cursor.addRow(new Object[] { "" });
    when(harness.query.query(eq(harness.uri))).thenReturn(cursor);
    assertNull(harness.get().open(harness.uri));
}
Also used : MatrixCursor(android.database.MatrixCursor) Test(org.junit.Test)

Example 25 with MatrixCursor

use of android.database.MatrixCursor in project facebook-android-sdk by facebook.

the class MessengerUtilsTest method setupContentResolverForProtocolVersions.

/**
   * Sets up the Messenger content resolver to reply that it supports the specified versions.
   *
   * @param versions the versions that it should support
   */
private void setupContentResolverForProtocolVersions(int... versions) {
    MatrixCursor matrixCursor = new MatrixCursor(new String[] { "version" });
    for (int version : versions) {
        matrixCursor.addRow(new Object[] { version });
    }
    when(mMockContentResolver.query(Uri.parse("content://com.facebook.orca.provider.MessengerPlatformProvider/versions"), new String[] { "version" }, null, null, null)).thenReturn(matrixCursor);
}
Also used : 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