Search in sources :

Example 26 with DirectoryFragment

use of com.android.documentsui.dirlist.DirectoryFragment in project android_frameworks_base by ResurrectionRemix.

the class BaseActivity method setDisplayFileSize.

/**
     * Set file size visible based on explicit user action.
     */
void setDisplayFileSize(boolean display) {
    Metrics.logUserAction(this, display ? Metrics.USER_ACTION_SHOW_SIZE : Metrics.USER_ACTION_HIDE_SIZE);
    LocalPreferences.setDisplayFileSize(this, display);
    mState.showSize = display;
    DirectoryFragment dir = getDirectoryFragment();
    if (dir != null) {
        dir.onDisplayStateChanged();
    }
    invalidateOptionsMenu();
}
Also used : DirectoryFragment(com.android.documentsui.dirlist.DirectoryFragment)

Example 27 with DirectoryFragment

use of com.android.documentsui.dirlist.DirectoryFragment in project android_frameworks_base by ResurrectionRemix.

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 28 with DirectoryFragment

use of com.android.documentsui.dirlist.DirectoryFragment in project android_frameworks_base by crdroidandroid.

the class BaseActivity method setViewMode.

/**
     * Set mode based on explicit user action.
     */
void setViewMode(@ViewMode int mode) {
    if (mode == State.MODE_GRID) {
        Metrics.logUserAction(this, Metrics.USER_ACTION_GRID);
    } else if (mode == State.MODE_LIST) {
        Metrics.logUserAction(this, Metrics.USER_ACTION_LIST);
    }
    LocalPreferences.setViewMode(this, getCurrentRoot(), mode);
    mState.derivedMode = mode;
    // view icon needs to be updated, but we *could* do it
    // in onOptionsItemSelected, and not do the full invalidation
    // But! That's a larger refactoring we'll save for another day.
    invalidateOptionsMenu();
    DirectoryFragment dir = getDirectoryFragment();
    if (dir != null) {
        dir.onViewModeChanged();
    }
}
Also used : DirectoryFragment(com.android.documentsui.dirlist.DirectoryFragment)

Example 29 with DirectoryFragment

use of com.android.documentsui.dirlist.DirectoryFragment in project android_frameworks_base by crdroidandroid.

the class BaseActivity method setDisplayFileSize.

/**
     * Set file size visible based on explicit user action.
     */
void setDisplayFileSize(boolean display) {
    Metrics.logUserAction(this, display ? Metrics.USER_ACTION_SHOW_SIZE : Metrics.USER_ACTION_HIDE_SIZE);
    LocalPreferences.setDisplayFileSize(this, display);
    mState.showSize = display;
    DirectoryFragment dir = getDirectoryFragment();
    if (dir != null) {
        dir.onDisplayStateChanged();
    }
    invalidateOptionsMenu();
}
Also used : DirectoryFragment(com.android.documentsui.dirlist.DirectoryFragment)

Example 30 with DirectoryFragment

use of com.android.documentsui.dirlist.DirectoryFragment in project android_frameworks_base by crdroidandroid.

the class BaseActivity method onBackPressed.

@Override
public void onBackPressed() {
    // While action bar is expanded, the state stack UI is hidden.
    if (mSearchManager.cancelSearch()) {
        return;
    }
    DirectoryFragment dir = getDirectoryFragment();
    if (dir != null && dir.onBackPressed()) {
        return;
    }
    if (!mState.hasLocationChanged()) {
        super.onBackPressed();
        return;
    }
    if (onBeforePopDir() || popDir()) {
        return;
    }
    super.onBackPressed();
}
Also used : DirectoryFragment(com.android.documentsui.dirlist.DirectoryFragment)

Aggregations

DirectoryFragment (com.android.documentsui.dirlist.DirectoryFragment)30 Intent (android.content.Intent)5 RootInfo (com.android.documentsui.model.RootInfo)5