Search in sources :

Example 36 with MatrixCursor

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

the class UsbStorageProvider method querySearchDocuments.

@Override
public Cursor querySearchDocuments(String rootId, String query, String[] projection) throws FileNotFoundException {
    UsbPartition usbPartition = mRoots.get(rootId);
    final UsbFile parent = usbPartition.fileSystem.getRootDirectory();
    updateSettings();
    final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
    // TODO implement actual search
    return result;
}
Also used : UsbFile(com.github.mjdev.libaums.fs.UsbFile) MatrixCursor(dev.dworks.apps.anexplorer.cursor.MatrixCursor)

Example 37 with MatrixCursor

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

the class DocumentArchive method queryChildDocuments.

/**
 * Lists child documents of an archive or a directory within an
 * archive. Must be called only for archives with supported mime type,
 * or for documents within archives.
 */
public Cursor queryChildDocuments(String documentId, @Nullable String[] projection, @Nullable String sortOrder) throws FileNotFoundException {
    final ParsedDocumentId parsedParentId = ParsedDocumentId.fromDocumentId(documentId, mIdDelimiter);
    Preconditions.checkArgumentEquals(mDocumentId, parsedParentId.mArchiveId, "Mismatching document ID. Expected: %s, actual: %s.");
    final String parentPath = parsedParentId.mPath != null ? parsedParentId.mPath : "/";
    final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_PROJECTION);
    if (mNotificationUri != null) {
        result.setNotificationUri(mContext.getContentResolver(), mNotificationUri);
    }
    final List<ZipEntry> parentList = mTree.get(parentPath);
    if (parentList == null) {
        throw new FileNotFoundException();
    }
    for (final ZipEntry entry : parentList) {
        addCursorRow(result, entry);
    }
    return result;
}
Also used : ZipEntry(java.util.zip.ZipEntry) FileNotFoundException(java.io.FileNotFoundException) 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