Search in sources :

Example 11 with MatrixCursor

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

the class HeatMapProvider method queryRoots.

@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
    final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
    final RowBuilder row = result.newRow();
    row.add(Root.COLUMN_ROOT_ID, ROOT_ID_HEAT_MAP);
    row.add(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_ADVANCED);
    row.add(Root.COLUMN_ICON, R.drawable.ic_root_usb);
    row.add(Root.COLUMN_TITLE, getContext().getString(R.string.root_heat_map));
    row.add(Root.COLUMN_DOCUMENT_ID, ROOT_ID_HEAT_MAP);
    row.add(Root.COLUMN_AVAILABLE_BYTES, -1);
    row.add(Root.COLUMN_CAPACITY_BYTES, -1);
    return result;
}
Also used : RowBuilder(dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder) MatrixCursor(dev.dworks.apps.anexplorer.cursor.MatrixCursor)

Example 12 with MatrixCursor

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

the class NonMediaDocumentsProvider method queryRoots.

@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
    final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
    includeFileRoot(result, TYPE_DOCUMENT_ROOT, R.string.root_document, DOCUMENT_MIME_TYPES, true);
    includeFileRoot(result, TYPE_ARCHIVE_ROOT, R.string.root_archive, ARCHIVE_MIME_TYPES, false);
    includeFileRoot(result, TYPE_APK_ROOT, R.string.root_apk, APK_MIME_TYPES, false);
    return result;
}
Also used : MatrixCursor(dev.dworks.apps.anexplorer.cursor.MatrixCursor)

Example 13 with MatrixCursor

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

the class NonMediaDocumentsProvider method queryRecentDocuments.

@Override
public Cursor queryRecentDocuments(String rootId, String[] projection) throws FileNotFoundException {
    final ContentResolver resolver = getContext().getContentResolver();
    final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
    final long token = Binder.clearCallingIdentity();
    Cursor cursor = null;
    try {
        if (TYPE_DOCUMENT_ROOT.equals(rootId)) {
            queryRecentFile(resolver, cursor, result, DOCUMENT_MIMES);
        } else {
            throw new UnsupportedOperationException("Unsupported root " + rootId);
        }
    } finally {
        IoUtils.closeQuietly(cursor);
        Binder.restoreCallingIdentity(token);
    }
    return result;
}
Also used : MatrixCursor(dev.dworks.apps.anexplorer.cursor.MatrixCursor) Cursor(android.database.Cursor) MatrixCursor(dev.dworks.apps.anexplorer.cursor.MatrixCursor) ContentResolver(android.content.ContentResolver)

Example 14 with MatrixCursor

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

the class RootedStorageProvider method queryRoots.

@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
    final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
    synchronized (mRootsLock) {
        for (RootInfo root : mRoots.values()) {
            final RowBuilder row = result.newRow();
            row.add(Root.COLUMN_ROOT_ID, root.rootId);
            row.add(Root.COLUMN_FLAGS, root.flags);
            row.add(Root.COLUMN_TITLE, root.title);
            row.add(Root.COLUMN_PATH, root.path);
            row.add(Root.COLUMN_DOCUMENT_ID, root.docId);
        }
    }
    return result;
}
Also used : RowBuilder(dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder) MatrixCursor(dev.dworks.apps.anexplorer.cursor.MatrixCursor)

Example 15 with MatrixCursor

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

the class RootedStorageProvider method queryDocument.

@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
    final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
    includeRootFile(result, documentId, null);
    return result;
}
Also used : MatrixCursor(dev.dworks.apps.anexplorer.cursor.MatrixCursor)

Aggregations

MatrixCursor (dev.dworks.apps.anexplorer.cursor.MatrixCursor)37 Cursor (android.database.Cursor)10 RowBuilder (dev.dworks.apps.anexplorer.cursor.MatrixCursor.RowBuilder)7 ContentResolver (android.content.ContentResolver)6 File (java.io.File)6 FileNotFoundException (java.io.FileNotFoundException)6 IOException (java.io.IOException)5 Query (android.app.DownloadManager.Query)4 DocumentFile (android.support.provider.DocumentFile)3 UsbFile (com.github.mjdev.libaums.fs.UsbFile)3 FileUtils.getTypeForFile (dev.dworks.apps.anexplorer.misc.FileUtils.getTypeForFile)3 ArrayMap (android.support.v4.util.ArrayMap)2 NetworkConnection (dev.dworks.apps.anexplorer.network.NetworkConnection)2 RootFile (dev.dworks.apps.anexplorer.root.RootFile)2 BufferedReader (java.io.BufferedReader)2 Scanner (java.util.Scanner)2 ZipEntry (java.util.zip.ZipEntry)2 RunningAppProcessInfo (android.app.ActivityManager.RunningAppProcessInfo)1 RunningServiceInfo (android.app.ActivityManager.RunningServiceInfo)1 DownloadManager (android.app.DownloadManager)1