Search in sources :

Example 26 with RowBuilder

use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.

the class MediaDocumentsProvider method includeVideosBucket.

private void includeVideosBucket(MatrixCursor result, Cursor cursor) {
    final long id = cursor.getLong(VideosBucketQuery.BUCKET_ID);
    final String docId = getDocIdForIdent(TYPE_VIDEOS_BUCKET, id);
    final RowBuilder row = result.newRow();
    row.add(Document.COLUMN_DOCUMENT_ID, docId);
    row.add(Document.COLUMN_DISPLAY_NAME, cursor.getString(VideosBucketQuery.BUCKET_DISPLAY_NAME));
    row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
    row.add(Document.COLUMN_LAST_MODIFIED, cursor.getLong(VideosBucketQuery.DATE_MODIFIED) * DateUtils.SECOND_IN_MILLIS);
    row.add(Document.COLUMN_FLAGS, Document.FLAG_DIR_PREFERS_GRID | Document.FLAG_SUPPORTS_THUMBNAIL | Document.FLAG_DIR_PREFERS_LAST_MODIFIED | Document.FLAG_DIR_HIDE_GRID_TITLES | Document.FLAG_SUPPORTS_DELETE);
}
Also used : RowBuilder(dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder)

Example 27 with RowBuilder

use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.

the class MediaDocumentsProvider method includeVideosRoot.

private void includeVideosRoot(MatrixCursor result) {
    int flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_RECENTS;
    if (isEmpty(Video.Media.EXTERNAL_CONTENT_URI)) {
        flags |= Root.FLAG_EMPTY;
        sReturnedVideosEmpty = true;
    }
    final RowBuilder row = result.newRow();
    row.add(Root.COLUMN_ROOT_ID, TYPE_VIDEOS_ROOT);
    row.add(Root.COLUMN_FLAGS, flags);
    row.add(Root.COLUMN_TITLE, getContext().getString(R.string.root_videos));
    row.add(Root.COLUMN_DOCUMENT_ID, TYPE_VIDEOS_ROOT);
    row.add(Root.COLUMN_MIME_TYPES, VIDEO_MIME_TYPES);
}
Also used : RowBuilder(dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder) Point(android.graphics.Point)

Example 28 with RowBuilder

use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.

the class MediaDocumentsProvider method includeAudioRoot.

private void includeAudioRoot(MatrixCursor result) {
    int flags = Root.FLAG_LOCAL_ONLY;
    if (isEmpty(Audio.Media.EXTERNAL_CONTENT_URI)) {
        flags |= Root.FLAG_EMPTY;
        sReturnedAudioEmpty = true;
    }
    final RowBuilder row = result.newRow();
    row.add(Root.COLUMN_ROOT_ID, TYPE_AUDIO_ROOT);
    row.add(Root.COLUMN_FLAGS, flags);
    row.add(Root.COLUMN_TITLE, getContext().getString(R.string.root_audio));
    row.add(Root.COLUMN_DOCUMENT_ID, TYPE_AUDIO_ROOT);
    row.add(Root.COLUMN_MIME_TYPES, AUDIO_MIME_TYPES);
}
Also used : RowBuilder(dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder) Point(android.graphics.Point)

Example 29 with RowBuilder

use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.

the class MediaDocumentsProvider method includeImagesBucket.

private void includeImagesBucket(MatrixCursor result, Cursor cursor) {
    final long id = cursor.getLong(ImagesBucketQuery.BUCKET_ID);
    final String docId = getDocIdForIdent(TYPE_IMAGES_BUCKET, id);
    final RowBuilder row = result.newRow();
    row.add(Document.COLUMN_DOCUMENT_ID, docId);
    row.add(Document.COLUMN_DISPLAY_NAME, cursor.getString(ImagesBucketQuery.BUCKET_DISPLAY_NAME));
    row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
    row.add(Document.COLUMN_LAST_MODIFIED, cursor.getLong(ImagesBucketQuery.DATE_MODIFIED) * DateUtils.SECOND_IN_MILLIS);
    row.add(Document.COLUMN_FLAGS, Document.FLAG_DIR_PREFERS_GRID | Document.FLAG_SUPPORTS_THUMBNAIL | Document.FLAG_DIR_PREFERS_LAST_MODIFIED | Document.FLAG_DIR_HIDE_GRID_TITLES | Document.FLAG_SUPPORTS_DELETE);
}
Also used : RowBuilder(dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder)

Example 30 with RowBuilder

use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.

the class MediaDocumentsProvider method includeAudioRootDocument.

private void includeAudioRootDocument(MatrixCursor result) {
    final RowBuilder row = result.newRow();
    row.add(Document.COLUMN_DOCUMENT_ID, TYPE_AUDIO_ROOT);
    row.add(Document.COLUMN_DISPLAY_NAME, getContext().getString(R.string.root_audio));
    row.add(Document.COLUMN_FLAGS, Document.FLAG_DIR_PREFERS_GRID | Document.FLAG_DIR_PREFERS_LAST_MODIFIED | Document.FLAG_SUPPORTS_DELETE);
    row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
}
Also used : RowBuilder(dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder)

Aggregations

RowBuilder (dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder)34 Point (android.graphics.Point)11 SuppressLint (android.annotation.SuppressLint)7 MatrixCursor (dev.dworks.apps.anexplorer.cursor.MatrixCursor)7 ApplicationInfo (android.content.pm.ApplicationInfo)4 File (java.io.File)3 FileNotFoundException (java.io.FileNotFoundException)3 DocumentFile (android.support.provider.DocumentFile)2 ArrayMap (android.support.v4.util.ArrayMap)1 FileUtils.getTypeForFile (dev.dworks.apps.anexplorer.misc.FileUtils.getTypeForFile)1 StorageUtils (dev.dworks.apps.anexplorer.misc.StorageUtils)1 DocumentInfo.getCursorString (dev.dworks.apps.anexplorer.model.DocumentInfo.getCursorString)1 NetworkConnection (dev.dworks.apps.anexplorer.network.NetworkConnection)1 Map (java.util.Map)1