use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.
the class DownloadStorageProvider method includeDefaultDocument.
/* @Override
public AssetFileDescriptor openDocumentThumbnail(
String docId, Point sizeHint, CancellationSignal signal) throws FileNotFoundException {
// TODO: extend ExifInterface to support fds
final ParcelFileDescriptor pfd = openDocument(docId, "r", signal);
return new AssetFileDescriptor(pfd, 0, AssetFileDescriptor.UNKNOWN_LENGTH);
}*/
private void includeDefaultDocument(MatrixCursor result) {
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, DOC_ID_ROOT);
row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
row.add(Document.COLUMN_FLAGS, Document.FLAG_DIR_PREFERS_LAST_MODIFIED | Document.FLAG_DIR_SUPPORTS_CREATE);
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.
the class ExternalStorageProvider method includeFile.
private void includeFile(MatrixCursor result, String docId, File file) throws FileNotFoundException {
if (docId == null) {
docId = getDocIdForFile(file);
} else {
file = getFileForDocId(docId);
}
DocumentFile documentFile = getDocumentFile(docId, file);
int flags = 0;
if (documentFile.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_COPY;
flags |= Document.FLAG_SUPPORTS_ARCHIVE;
flags |= Document.FLAG_SUPPORTS_BOOKMARK;
flags |= Document.FLAG_SUPPORTS_EDIT;
if (isTelevision()) {
flags |= Document.FLAG_DIR_PREFERS_GRID;
}
}
final String mimeType = getTypeForFile(file);
if (DocumentArchiveHelper.isSupportedArchiveType(mimeType)) {
flags |= Document.FLAG_ARCHIVE;
}
final String displayName = file.getName();
if (!showFilesHidden && !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.length());
row.add(Document.COLUMN_MIME_TYPE, mimeType);
row.add(Document.COLUMN_PATH, file.getAbsolutePath());
row.add(Document.COLUMN_FLAGS, flags);
if (file.isDirectory() && null != file.list()) {
row.add(Document.COLUMN_SUMMARY, FileUtils.formatFileCount(file.list().length));
}
// Only publish dates reasonably after epoch
long lastModified = file.lastModified();
if (lastModified > 31536000000L) {
row.add(Document.COLUMN_LAST_MODIFIED, lastModified);
}
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.
the class MediaDocumentsProvider method includeAlbum.
private void includeAlbum(MatrixCursor result, Cursor cursor) {
final long id = cursor.getLong(AlbumQuery._ID);
final String docId = getDocIdForIdent(TYPE_ALBUM, id);
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, docId);
row.add(Document.COLUMN_DISPLAY_NAME, cleanUpMediaDisplayName(cursor.getString(AlbumQuery.ALBUM)));
row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
row.add(Document.COLUMN_FLAGS, Document.FLAG_DIR_PREFERS_GRID | Document.FLAG_SUPPORTS_THUMBNAIL | Document.FLAG_DIR_PREFERS_LAST_MODIFIED | Document.FLAG_SUPPORTS_DELETE);
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder in project AnExplorer by 1hakr.
the class MediaDocumentsProvider method includeArtist.
private void includeArtist(MatrixCursor result, Cursor cursor) {
final long id = cursor.getLong(ArtistQuery._ID);
final String docId = getDocIdForIdent(TYPE_ARTIST, id);
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, docId);
row.add(Document.COLUMN_DISPLAY_NAME, cleanUpMediaDisplayName(cursor.getString(ArtistQuery.ARTIST)));
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 MediaDocumentsProvider method includeAudio.
private void includeAudio(MatrixCursor result, Cursor cursor) {
final long id = cursor.getLong(SongQuery._ID);
final String docId = getDocIdForIdent(TYPE_AUDIO, id);
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, docId);
row.add(Document.COLUMN_DISPLAY_NAME, cursor.getString(SongQuery.TITLE));
row.add(Document.COLUMN_SIZE, cursor.getLong(SongQuery.SIZE));
row.add(Document.COLUMN_MIME_TYPE, cursor.getString(SongQuery.MIME_TYPE));
row.add(Document.COLUMN_PATH, cursor.getString(SongQuery.DATA));
row.add(Document.COLUMN_LAST_MODIFIED, cursor.getLong(SongQuery.DATE_MODIFIED) * DateUtils.SECOND_IN_MILLIS);
row.add(Document.COLUMN_FLAGS, Document.FLAG_SUPPORTS_THUMBNAIL | Document.FLAG_SUPPORTS_DELETE);
}
Aggregations