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);
}
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);
}
}
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();
}
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);
}
}
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();
}
}
Aggregations