use of dev.dworks.apps.anexplorer.cursor.MatrixCursor in project AnExplorer by 1hakr.
the class AppsProvider method queryDocument.
@Override
public Cursor queryDocument(String docId, String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
includeDefaultDocument(result, docId);
return result;
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor in project AnExplorer by 1hakr.
the class AppsProvider method queryRoots.
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
StorageUtils storageUtils = new StorageUtils(getContext());
final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
final RowBuilder row = result.newRow();
row.add(Root.COLUMN_ROOT_ID, ROOT_ID_USER_APP);
row.add(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_ADVANCED | Root.FLAG_SUPER_ADVANCED | Root.FLAG_SUPPORTS_SEARCH);
row.add(Root.COLUMN_ICON, R.drawable.ic_root_apps);
row.add(Root.COLUMN_TITLE, getContext().getString(R.string.root_apps));
row.add(Root.COLUMN_DOCUMENT_ID, ROOT_ID_USER_APP);
row.add(Root.COLUMN_AVAILABLE_BYTES, storageUtils.getPartionSize(StorageUtils.PARTITION_DATA, false));
row.add(Root.COLUMN_CAPACITY_BYTES, storageUtils.getPartionSize(StorageUtils.PARTITION_DATA, true));
final RowBuilder row1 = result.newRow();
row1.add(Root.COLUMN_ROOT_ID, ROOT_ID_SYSTEM_APP);
row1.add(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_ADVANCED | Root.FLAG_SUPER_ADVANCED | Root.FLAG_SUPPORTS_SEARCH);
row1.add(Root.COLUMN_ICON, R.drawable.ic_root_apps);
row1.add(Root.COLUMN_TITLE, getContext().getString(R.string.root_system_apps));
row1.add(Root.COLUMN_DOCUMENT_ID, ROOT_ID_SYSTEM_APP);
row1.add(Root.COLUMN_AVAILABLE_BYTES, storageUtils.getPartionSize(StorageUtils.PARTITION_DATA, false));
row1.add(Root.COLUMN_CAPACITY_BYTES, storageUtils.getPartionSize(StorageUtils.PARTITION_DATA, true));
final RowBuilder row2 = result.newRow();
row2.add(Root.COLUMN_ROOT_ID, ROOT_ID_PROCESS);
row2.add(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_ADVANCED | Root.FLAG_SUPER_ADVANCED | Root.FLAG_SUPPORTS_SEARCH);
row2.add(Root.COLUMN_ICON, R.drawable.ic_root_process);
row2.add(Root.COLUMN_TITLE, getContext().getString(R.string.root_processes));
row2.add(Root.COLUMN_DOCUMENT_ID, ROOT_ID_PROCESS);
row2.add(Root.COLUMN_AVAILABLE_BYTES, storageUtils.getPartionSize(StorageUtils.PARTITION_RAM, false));
row2.add(Root.COLUMN_CAPACITY_BYTES, storageUtils.getPartionSize(StorageUtils.PARTITION_RAM, true));
return result;
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor in project AnExplorer by 1hakr.
the class DownloadStorageProvider method queryRecentDocuments.
@Override
public Cursor queryRecentDocuments(String rootId, String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
// Delegate to real provider
final long token = Binder.clearCallingIdentity();
Cursor cursor = null;
try {
cursor = mDm.query(// .setOnlyIncludeVisibleInDownloadsUi(true)
new DownloadManager.Query().setFilterByStatus(DownloadManager.STATUS_SUCCESSFUL));
// copyNotificationUri(result, cursor);
while (cursor.moveToNext() && result.getCount() < 12) {
final String mimeType = cursor.getString(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_MEDIA_TYPE));
final String uri = cursor.getString(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_MEDIAPROVIDER_URI));
// don't duplicate them in the recents list.
if (mimeType == null || (mimeType.startsWith("image/") && !TextUtils.isEmpty(uri))) {
continue;
}
includeDownloadFromCursor(result, cursor);
}
} finally {
IoUtils.closeQuietly(cursor);
Binder.restoreCallingIdentity(token);
}
return result;
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor in project AnExplorer by 1hakr.
the class DownloadStorageProvider method queryDocument.
@Override
public Cursor queryDocument(String docId, String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
if (DOC_ID_ROOT.equals(docId)) {
includeDefaultDocument(result);
} else {
// Delegate to real provider
final long token = Binder.clearCallingIdentity();
Cursor cursor = null;
try {
cursor = mDm.query(new Query().setFilterById(Long.parseLong(docId)));
// copyNotificationUri(result, cursor);
if (cursor.moveToFirst()) {
includeDownloadFromCursor(result, cursor);
}
} finally {
IoUtils.closeQuietly(cursor);
Binder.restoreCallingIdentity(token);
}
}
return result;
}
use of dev.dworks.apps.anexplorer.cursor.MatrixCursor in project AnExplorer by 1hakr.
the class ExternalStorageProvider method queryDocument.
@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
if (mArchiveHelper.isArchivedDocument(documentId)) {
return mArchiveHelper.queryDocument(documentId, projection);
}
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
updateSettings();
includeFile(result, documentId, null);
return result;
}
Aggregations