Search in sources :

Example 36 with RootInfo

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

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

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

the class BaseActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case android.R.id.home:
            onBackPressed();
            return true;
        case R.id.menu_create_dir:
            showCreateDirectoryDialog();
            return true;
        case R.id.menu_search:
            // SearchViewManager listens for this directly.
            return false;
        case R.id.menu_sort_name:
            setUserSortOrder(State.SORT_ORDER_DISPLAY_NAME);
            return true;
        case R.id.menu_sort_date:
            setUserSortOrder(State.SORT_ORDER_LAST_MODIFIED);
            return true;
        case R.id.menu_sort_size:
            setUserSortOrder(State.SORT_ORDER_SIZE);
            return true;
        case R.id.menu_grid:
            setViewMode(State.MODE_GRID);
            return true;
        case R.id.menu_list:
            setViewMode(State.MODE_LIST);
            return true;
        case R.id.menu_paste_from_clipboard:
            DirectoryFragment dir = getDirectoryFragment();
            if (dir != null) {
                dir.pasteFromClipboard();
            }
            return true;
        case R.id.menu_advanced:
            setDisplayAdvancedDevices(!mState.showAdvanced);
            return true;
        case R.id.menu_file_size:
            setDisplayFileSize(!LocalPreferences.getDisplayFileSize(this));
            return true;
        case R.id.menu_settings:
            Metrics.logUserAction(this, Metrics.USER_ACTION_SETTINGS);
            final RootInfo root = getCurrentRoot();
            final Intent intent = new Intent(DocumentsContract.ACTION_DOCUMENT_ROOT_SETTINGS);
            intent.setDataAndType(root.getUri(), DocumentsContract.Root.MIME_TYPE_ITEM);
            startActivity(intent);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : RootInfo(com.android.documentsui.model.RootInfo) Intent(android.content.Intent) DirectoryFragment(com.android.documentsui.dirlist.DirectoryFragment)

Example 38 with RootInfo

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

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

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

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

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

the class FilesActivity method onResume.

@Override
public void onResume() {
    super.onResume();
    final RootInfo root = getCurrentRoot();
    // the user what has happened, let them close us. Less surprising.
    if (mRoots.getRootBlocking(root.authority, root.rootId) == null) {
        finish();
    }
}
Also used : RootInfo(com.android.documentsui.model.RootInfo)

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