Search in sources :

Example 96 with DocumentInfo

use of com.android.documentsui.model.DocumentInfo in project android_frameworks_base by DirtyUnicorns.

the class BaseActivity method reloadSearch.

private void reloadSearch(String query) {
    FragmentManager fm = getFragmentManager();
    RootInfo root = getCurrentRoot();
    DocumentInfo cwd = getCurrentDirectory();
    DirectoryFragment.reloadSearch(fm, root, cwd, query);
}
Also used : FragmentManager(android.app.FragmentManager) RootInfo(com.android.documentsui.model.RootInfo) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 97 with DocumentInfo

use of com.android.documentsui.model.DocumentInfo in project android_frameworks_base by DirtyUnicorns.

the class FilesActivity method refreshDirectory.

@Override
void refreshDirectory(int anim) {
    final FragmentManager fm = getFragmentManager();
    final RootInfo root = getCurrentRoot();
    final DocumentInfo cwd = getCurrentDirectory();
    assert (!mSearchManager.isSearching());
    if (cwd == null) {
        DirectoryFragment.showRecentsOpen(fm, anim);
    } else {
        // Normal boring directory
        DirectoryFragment.showDirectory(fm, root, cwd, anim);
    }
}
Also used : FragmentManager(android.app.FragmentManager) RootInfo(com.android.documentsui.model.RootInfo) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 98 with DocumentInfo

use of com.android.documentsui.model.DocumentInfo in project android_frameworks_base by DirtyUnicorns.

the class DocumentsProviderHelper method listChildren.

public List<DocumentInfo> listChildren(String documentId) throws Exception {
    Uri uri = buildChildDocumentsUri(mAuthority, documentId);
    List<DocumentInfo> children = new ArrayList<>();
    try (Cursor cursor = mClient.query(uri, null, null, null, null, null)) {
        Cursor wrapper = new RootCursorWrapper(mAuthority, "totally-fake", cursor, 100);
        while (wrapper.moveToNext()) {
            children.add(DocumentInfo.fromDirectoryCursor(wrapper));
        }
    }
    return children;
}
Also used : ArrayList(java.util.ArrayList) Cursor(android.database.Cursor) Uri(android.net.Uri) DocumentsContract.buildDocumentUri(android.provider.DocumentsContract.buildDocumentUri) DocumentsContract.buildChildDocumentsUri(android.provider.DocumentsContract.buildChildDocumentsUri) DocumentsContract.buildRootsUri(android.provider.DocumentsContract.buildRootsUri) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 99 with DocumentInfo

use of com.android.documentsui.model.DocumentInfo in project android_frameworks_base by DirtyUnicorns.

the class DocumentsProviderHelper method assertFileContents.

public void assertFileContents(String parentId, String fileName, byte[] expected) throws Exception {
    DocumentInfo file = findFile(parentId, fileName);
    assertNotNull(file);
    assertFileContents(file.derivedUri, expected);
}
Also used : DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 100 with DocumentInfo

use of com.android.documentsui.model.DocumentInfo in project android_frameworks_base by DirtyUnicorns.

the class AbstractCopyJobTest method runCopyDirRecursivelyTest.

public void runCopyDirRecursivelyTest() throws Exception {
    Uri testDir1 = mDocs.createFolder(mSrcRoot, "dir1");
    mDocs.createDocument(testDir1, "text/plain", "test1.txt");
    Uri testDir2 = mDocs.createFolder(testDir1, "dir2");
    mDocs.createDocument(testDir2, "text/plain", "test2.txt");
    createJob(newArrayList(testDir1)).run();
    mJobListener.waitForFinished();
    DocumentInfo dir1Copy = mDocs.findDocument(mDestRoot.documentId, "dir1");
    mDocs.assertChildCount(dir1Copy.derivedUri, 2);
    mDocs.assertHasDirectory(dir1Copy.derivedUri, "dir2");
    mDocs.assertHasFile(dir1Copy.derivedUri, "test1.txt");
    DocumentInfo dir2Copy = mDocs.findDocument(dir1Copy.documentId, "dir2");
    mDocs.assertChildCount(dir2Copy.derivedUri, 1);
    mDocs.assertHasFile(dir2Copy.derivedUri, "test2.txt");
}
Also used : Uri(android.net.Uri) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Aggregations

DocumentInfo (com.android.documentsui.model.DocumentInfo)150 Uri (android.net.Uri)40 Cursor (android.database.Cursor)30 DocumentInfo.getCursorString (com.android.documentsui.model.DocumentInfo.getCursorString)30 FragmentManager (android.app.FragmentManager)20 Point (android.graphics.Point)20 RootInfo (com.android.documentsui.model.RootInfo)20 ArrayList (java.util.ArrayList)20 Intent (android.content.Intent)15 DocumentsContract.buildChildDocumentsUri (android.provider.DocumentsContract.buildChildDocumentsUri)15 DocumentsContract.buildDocumentUri (android.provider.DocumentsContract.buildDocumentUri)15 ClipData (android.content.ClipData)10 ContentResolver (android.content.ContentResolver)10 DialogInterface (android.content.DialogInterface)10 RemoteException (android.os.RemoteException)10 BaseActivity (com.android.documentsui.BaseActivity)10 DocumentStack (com.android.documentsui.model.DocumentStack)10 Activity (android.app.Activity)5 AlertDialog (android.app.AlertDialog)5 ContentProviderClient (android.content.ContentProviderClient)5