Search in sources :

Example 1 with CrossProcessCursor

use of android.database.CrossProcessCursor in project platform_frameworks_base by android.

the class CrossProcessCursorWrapper method fillWindow.

@Override
public void fillWindow(int position, CursorWindow window) {
    if (mCursor instanceof CrossProcessCursor) {
        final CrossProcessCursor crossProcessCursor = (CrossProcessCursor) mCursor;
        crossProcessCursor.fillWindow(position, window);
        return;
    }
    DatabaseUtils.cursorFillWindow(mCursor, position, window);
}
Also used : CrossProcessCursor(android.database.CrossProcessCursor)

Example 2 with CrossProcessCursor

use of android.database.CrossProcessCursor in project android_frameworks_base by ParanoidAndroid.

the class CrossProcessCursorWrapper method fillWindow.

@Override
public void fillWindow(int position, CursorWindow window) {
    if (mCursor instanceof CrossProcessCursor) {
        final CrossProcessCursor crossProcessCursor = (CrossProcessCursor) mCursor;
        crossProcessCursor.fillWindow(position, window);
        return;
    }
    DatabaseUtils.cursorFillWindow(mCursor, position, window);
}
Also used : CrossProcessCursor(android.database.CrossProcessCursor)

Example 3 with CrossProcessCursor

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

the class CrossProcessCursorWrapper method fillWindow.

@Override
public void fillWindow(int position, CursorWindow window) {
    if (mCursor instanceof CrossProcessCursor) {
        final CrossProcessCursor crossProcessCursor = (CrossProcessCursor) mCursor;
        crossProcessCursor.fillWindow(position, window);
        return;
    }
    DatabaseUtils.cursorFillWindow(mCursor, position, window);
}
Also used : CrossProcessCursor(android.database.CrossProcessCursor)

Example 4 with CrossProcessCursor

use of android.database.CrossProcessCursor in project android_frameworks_base by crdroidandroid.

the class CrossProcessCursorWrapper method fillWindow.

@Override
public void fillWindow(int position, CursorWindow window) {
    if (mCursor instanceof CrossProcessCursor) {
        final CrossProcessCursor crossProcessCursor = (CrossProcessCursor) mCursor;
        crossProcessCursor.fillWindow(position, window);
        return;
    }
    DatabaseUtils.cursorFillWindow(mCursor, position, window);
}
Also used : CrossProcessCursor(android.database.CrossProcessCursor)

Example 5 with CrossProcessCursor

use of android.database.CrossProcessCursor in project greenDAO by greenrobot.

the class AbstractDao method loadAllFromCursor.

/**
 * Reads all available rows from the given cursor and returns a list of entities.
 */
protected List<T> loadAllFromCursor(Cursor cursor) {
    int count = cursor.getCount();
    if (count == 0) {
        return new ArrayList<T>();
    }
    List<T> list = new ArrayList<T>(count);
    CursorWindow window = null;
    boolean useFastCursor = false;
    if (cursor instanceof CrossProcessCursor) {
        window = ((CrossProcessCursor) cursor).getWindow();
        if (window != null) {
            // E.g. Robolectric has no Window at this point
            if (window.getNumRows() == count) {
                cursor = new FastCursor(window);
                useFastCursor = true;
            } else {
                DaoLog.d("Window vs. result size: " + window.getNumRows() + "/" + count);
            }
        }
    }
    if (cursor.moveToFirst()) {
        if (identityScope != null) {
            identityScope.lock();
            identityScope.reserveRoom(count);
        }
        try {
            if (!useFastCursor && window != null && identityScope != null) {
                loadAllUnlockOnWindowBounds(cursor, window, list);
            } else {
                do {
                    list.add(loadCurrent(cursor, 0, false));
                } while (cursor.moveToNext());
            }
        } finally {
            if (identityScope != null) {
                identityScope.unlock();
            }
        }
    }
    return list;
}
Also used : CrossProcessCursor(android.database.CrossProcessCursor) FastCursor(org.greenrobot.greendao.internal.FastCursor) ArrayList(java.util.ArrayList) CursorWindow(android.database.CursorWindow)

Aggregations

CrossProcessCursor (android.database.CrossProcessCursor)7 CursorWindow (android.database.CursorWindow)1 ArrayList (java.util.ArrayList)1 FastCursor (org.greenrobot.greendao.internal.FastCursor)1