Search in sources :

Example 61 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by AOSPA.

the class FilesActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    final RootInfo root = getCurrentRoot();
    final MenuItem createDir = menu.findItem(R.id.menu_create_dir);
    final MenuItem pasteFromCb = menu.findItem(R.id.menu_paste_from_clipboard);
    final MenuItem settings = menu.findItem(R.id.menu_settings);
    final MenuItem newWindow = menu.findItem(R.id.menu_new_window);
    createDir.setVisible(true);
    createDir.setEnabled(canCreateDirectory());
    pasteFromCb.setEnabled(mClipper.hasItemsToPaste());
    settings.setVisible(root.hasSettings());
    newWindow.setVisible(Shared.shouldShowFancyFeatures(this));
    Menus.disableHiddenItems(menu, pasteFromCb);
    // It hides icon if searching in progress
    mSearchManager.updateMenu();
    return true;
}
Also used : RootInfo(com.android.documentsui.model.RootInfo) MenuItem(android.view.MenuItem)

Example 62 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by AOSPA.

the class DocumentsActivity method refreshDirectory.

@Override
void refreshDirectory(int anim) {
    final FragmentManager fm = getFragmentManager();
    final RootInfo root = getCurrentRoot();
    final DocumentInfo cwd = getCurrentDirectory();
    if (cwd == null) {
        // No directory means recents
        if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE || mState.action == ACTION_PICK_COPY_DESTINATION) {
            RecentsCreateFragment.show(fm);
        } else {
            DirectoryFragment.showRecentsOpen(fm, anim);
            // In recents we pick layout mode based on the mimetype,
            // picking GRID for visual types. We intentionally don't
            // consult a user's saved preferences here since they are
            // set per root (not per root and per mimetype).
            boolean visualMimes = MimePredicate.mimeMatches(MimePredicate.VISUAL_MIMES, mState.acceptMimes);
            mState.derivedMode = visualMimes ? State.MODE_GRID : State.MODE_LIST;
        }
    } else {
        // Normal boring directory
        DirectoryFragment.showDirectory(fm, root, cwd, anim);
    }
    // Forget any replacement target
    if (mState.action == ACTION_CREATE) {
        final SaveFragment save = SaveFragment.get(fm);
        if (save != null) {
            save.setReplaceTarget(null);
        }
    }
    if (mState.action == ACTION_OPEN_TREE || mState.action == ACTION_PICK_COPY_DESTINATION) {
        final PickFragment pick = PickFragment.get(fm);
        if (pick != null) {
            pick.setPickTarget(mState.action, mState.copyOperationSubType, cwd);
        }
    }
}
Also used : FragmentManager(android.app.FragmentManager) RootInfo(com.android.documentsui.model.RootInfo) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 63 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by AOSPA.

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 64 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by AOSPA.

the class BaseActivity method canCreateDirectory.

/**
     * Returns true if a directory can be created in the current location.
     * @return
     */
boolean canCreateDirectory() {
    final RootInfo root = getCurrentRoot();
    final DocumentInfo cwd = getCurrentDirectory();
    return cwd != null && cwd.isCreateSupported() && !mSearchManager.isSearching() && !root.isRecents() && !root.isDownloads();
}
Also used : RootInfo(com.android.documentsui.model.RootInfo) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 65 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by AOSPA.

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)

Aggregations

RootInfo (com.android.documentsui.model.RootInfo)85 DocumentInfo (com.android.documentsui.model.DocumentInfo)20 FragmentManager (android.app.FragmentManager)15 Bundle (android.os.Bundle)15 ArrayList (java.util.ArrayList)15 Intent (android.content.Intent)10 Cursor (android.database.Cursor)10 ContentProviderClient (android.content.ContentProviderClient)5 Context (android.content.Context)5 Loader (android.content.Loader)5 MatrixCursor (android.database.MatrixCursor)5 MergeCursor (android.database.MergeCursor)5 Uri (android.net.Uri)5 VisibleForTesting (android.support.annotation.VisibleForTesting)5 MenuItem (android.view.MenuItem)5 DirectoryFragment (com.android.documentsui.dirlist.DirectoryFragment)5 IOException (java.io.IOException)5 Collection (java.util.Collection)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 ExecutionException (java.util.concurrent.ExecutionException)5