use of com.android.documentsui.dirlist.DirectoryFragment in project android_frameworks_base by crdroidandroid.
the class BaseActivity method setUserSortOrder.
/**
* Set state sort order based on explicit user action.
*/
void setUserSortOrder(int sortOrder) {
switch(sortOrder) {
case State.SORT_ORDER_DISPLAY_NAME:
Metrics.logUserAction(this, Metrics.USER_ACTION_SORT_NAME);
break;
case State.SORT_ORDER_LAST_MODIFIED:
Metrics.logUserAction(this, Metrics.USER_ACTION_SORT_DATE);
break;
case State.SORT_ORDER_SIZE:
Metrics.logUserAction(this, Metrics.USER_ACTION_SORT_SIZE);
break;
}
mState.userSortOrder = sortOrder;
DirectoryFragment dir = getDirectoryFragment();
if (dir != null) {
dir.onSortOrderChanged();
}
}
use of com.android.documentsui.dirlist.DirectoryFragment 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);
}
}
use of com.android.documentsui.dirlist.DirectoryFragment in project platform_frameworks_base by android.
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();
}
use of com.android.documentsui.dirlist.DirectoryFragment in project platform_frameworks_base by android.
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();
}
}
use of com.android.documentsui.dirlist.DirectoryFragment in project android_frameworks_base by AOSPA.
the class BaseActivity method toggleNavDrawerFocus.
/**
* Toggles focus between the navigation drawer and the directory listing. If the drawer isn't
* locked, open/close it as appropriate.
*/
void toggleNavDrawerFocus() {
if (mNavDrawerHasFocus) {
mDrawer.setOpen(false);
DirectoryFragment df = DirectoryFragment.get(getFragmentManager());
if (df != null) {
df.requestFocus();
}
} else {
mDrawer.setOpen(true);
RootsFragment rf = RootsFragment.get(getFragmentManager());
if (rf != null) {
rf.requestFocus();
}
}
mNavDrawerHasFocus = !mNavDrawerHasFocus;
}
Aggregations