use of com.android.documentsui.dirlist.DirectoryFragment in project android_frameworks_base by ResurrectionRemix.
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 DirtyUnicorns.
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 android_frameworks_base by DirtyUnicorns.
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();
}
use of com.android.documentsui.dirlist.DirectoryFragment in project android_frameworks_base by crdroidandroid.
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;
}
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();
}
}
Aggregations