use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.
the class MediaDocumentsProvider method includeVideo.
private void includeVideo(MatrixCursor result, Cursor cursor) {
final long id = cursor.getLong(VideoQuery._ID);
final String docId = getDocIdForIdent(TYPE_VIDEO, id);
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, docId);
row.add(Document.COLUMN_DISPLAY_NAME, cursor.getString(VideoQuery.DISPLAY_NAME));
row.add(Document.COLUMN_SIZE, cursor.getLong(VideoQuery.SIZE));
row.add(Document.COLUMN_MIME_TYPE, cursor.getString(VideoQuery.MIME_TYPE));
row.add(Document.COLUMN_PATH, cursor.getString(VideoQuery.DATA));
row.add(Document.COLUMN_LAST_MODIFIED, cursor.getLong(VideoQuery.DATE_MODIFIED) * DateUtils.SECOND_IN_MILLIS);
row.add(Document.COLUMN_FLAGS, Document.FLAG_SUPPORTS_THUMBNAIL | Document.FLAG_SUPPORTS_DELETE);
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.
the class MediaDocumentsProvider method includeImagesRoot.
private void includeImagesRoot(MatrixCursor result) {
int flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_RECENTS;
if (isEmpty(Images.Media.EXTERNAL_CONTENT_URI)) {
flags |= Root.FLAG_EMPTY;
sReturnedImagesEmpty = true;
}
final RowBuilder row = result.newRow();
row.add(Root.COLUMN_ROOT_ID, TYPE_IMAGES_ROOT);
row.add(Root.COLUMN_FLAGS, flags);
row.add(Root.COLUMN_TITLE, getContext().getString(R.string.root_images));
row.add(Root.COLUMN_DOCUMENT_ID, TYPE_IMAGES_ROOT);
row.add(Root.COLUMN_MIME_TYPES, IMAGE_MIME_TYPES);
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.
the class MediaDocumentsProvider method includeImage.
private void includeImage(MatrixCursor result, Cursor cursor) {
final long id = cursor.getLong(ImageQuery._ID);
final String docId = getDocIdForIdent(TYPE_IMAGE, id);
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, docId);
row.add(Document.COLUMN_DISPLAY_NAME, cursor.getString(ImageQuery.DISPLAY_NAME));
row.add(Document.COLUMN_SIZE, cursor.getLong(ImageQuery.SIZE));
row.add(Document.COLUMN_MIME_TYPE, cursor.getString(ImageQuery.MIME_TYPE));
row.add(Document.COLUMN_PATH, cursor.getString(ImageQuery.DATA));
row.add(Document.COLUMN_LAST_MODIFIED, cursor.getLong(ImageQuery.DATE_MODIFIED) * DateUtils.SECOND_IN_MILLIS);
row.add(Document.COLUMN_FLAGS, Document.FLAG_SUPPORTS_THUMBNAIL | Document.FLAG_SUPPORTS_DELETE);
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.
the class MediaDocumentsProvider method includeImagesRootDocument.
private void includeImagesRootDocument(MatrixCursor result) {
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, TYPE_IMAGES_ROOT);
row.add(Document.COLUMN_DISPLAY_NAME, getContext().getString(R.string.root_images));
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);
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.
the class NetworkStorageProvider method includeFile.
/**
* Add a representation of a file to a cursor.
*
* @param result the cursor to modify
* @param docId the document ID representing the desired file (may be null if given file)
* @param file the File object representing the desired file (may be null if given docID)
* @throws java.io.FileNotFoundException
*/
private void includeFile(MatrixCursor result, String docId, NetworkFile file) throws FileNotFoundException {
if (docId == null) {
docId = getDocIdForFile(file);
} else {
file = getFileForDocId(docId);
}
int flags = 0;
if (file.canWrite()) {
if (file.isDirectory()) {
flags |= Document.FLAG_DIR_SUPPORTS_CREATE;
} else {
flags |= Document.FLAG_SUPPORTS_WRITE;
}
/* flags |= Document.FLAG_SUPPORTS_DELETE;
flags |= Document.FLAG_SUPPORTS_RENAME;
flags |= Document.FLAG_SUPPORTS_MOVE;
flags |= Document.FLAG_SUPPORTS_EDIT;*/
}
final String mimeType = getTypeForFile(file);
final String displayName = file.getName();
if (!TextUtils.isEmpty(displayName)) {
if (displayName.charAt(0) == '.') {
return;
}
}
if (MimePredicate.mimeMatches(MimePredicate.VISUAL_MIMES, mimeType)) {
flags |= Document.FLAG_SUPPORTS_THUMBNAIL;
}
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, docId);
row.add(Document.COLUMN_DISPLAY_NAME, displayName);
row.add(Document.COLUMN_SIZE, file.getSize());
row.add(Document.COLUMN_MIME_TYPE, mimeType);
row.add(Document.COLUMN_PATH, file.getAbsolutePath());
row.add(Document.COLUMN_FLAGS, flags);
// Only publish dates reasonably after epoch
long lastModified = file.lastModified();
if (lastModified > 31536000000L) {
row.add(Document.COLUMN_LAST_MODIFIED, lastModified);
}
}
Aggregations