本文整理汇总了Java中android.view.MenuItem.collapseActionView方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.collapseActionView方法的具体用法?Java MenuItem.collapseActionView怎么用?Java MenuItem.collapseActionView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.MenuItem
的用法示例。
在下文中一共展示了MenuItem.collapseActionView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateMenuItems
import android.view.MenuItem; //导入方法依赖的package包/类
public void updateMenuItems(Menu menu){
final FragmentManager fm = getFragmentManager();
final RootInfo root = getCurrentRoot();
final DocumentInfo cwd = getCurrentDirectory();
if(isTelevision()) {
menu.findItem(R.id.menu_create_dir).setVisible(showActionMenu());
menu.findItem(R.id.menu_create_file).setVisible(showActionMenu());
}
final MenuItem search = menu.findItem(R.id.menu_search);
final MenuItem sort = menu.findItem(R.id.menu_sort);
final MenuItem sortSize = menu.findItem(R.id.menu_sort_size);
final MenuItem grid = menu.findItem(R.id.menu_grid);
final MenuItem list = menu.findItem(R.id.menu_list);
final MenuItem settings = menu.findItem(R.id.menu_settings);
// Open drawer means we hide most actions
if (isRootsDrawerOpen()) {
search.setVisible(false);
sort.setVisible(false);
grid.setVisible(false);
list.setVisible(false);
mIgnoreNextCollapse = true;
search.collapseActionView();
return;
}
sort.setVisible(cwd != null);
grid.setVisible(!RootInfo.isOtherRoot(getCurrentRoot()) && mState.derivedMode != MODE_GRID);
list.setVisible(mState.derivedMode != MODE_LIST);
if (mState.currentSearch != null) {
// Search uses backend ranking; no sorting
//sort.setVisible(false);
search.expandActionView();
mSearchView.setIconified(false);
mSearchView.clearFocus();
mSearchView.setQuery(mState.currentSearch, false);
} else {
mIgnoreNextClose = true;
mSearchView.setIconified(true);
mSearchView.clearFocus();
mIgnoreNextCollapse = true;
search.collapseActionView();
}
// Only sort by size when visible
sortSize.setVisible(mState.showSize);
final boolean searchVisible;
if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
searchVisible = false;
// No display options in recent directories
if (cwd == null) {
grid.setVisible(false);
list.setVisible(false);
}
if (mState.action == State.ACTION_CREATE) {
if (null != SaveFragment.get(fm))
SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
}
} else {
searchVisible = root != null
&& ((root.flags & Root.FLAG_SUPPORTS_SEARCH) != 0);
// TODO: Is this useful?
if(null != SaveFragment.get(fm))
SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
if(null != MoveFragment.get(fm))
MoveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isMoveSupported());
}
// TODO: close any search in-progress when hiding
search.setVisible(searchVisible);
settings.setVisible(mState.action != ACTION_MANAGE);
}
示例2: onPrepareOptionsMenu
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
final FragmentManager fm = getFragmentManager();
final RootInfo root = getCurrentRoot();
final DocumentInfo cwd = getCurrentDirectory();
final MenuItem createDir = menu.findItem(R.id.menu_create_dir);
final MenuItem search = menu.findItem(R.id.menu_search);
final MenuItem sort = menu.findItem(R.id.menu_sort);
final MenuItem sortSize = menu.findItem(R.id.menu_sort_size);
final MenuItem grid = menu.findItem(R.id.menu_grid);
final MenuItem list = menu.findItem(R.id.menu_list);
sort.setVisible(cwd != null);
grid.setVisible(mState.derivedMode != State.MODE_GRID);
list.setVisible(mState.derivedMode != State.MODE_LIST);
if (mState.currentSearch != null) {
// Search uses backend ranking; no sorting
sort.setVisible(false);
search.expandActionView();
mSearchView.setIconified(false);
mSearchView.clearFocus();
mSearchView.setQuery(mState.currentSearch, false);
} else {
mIgnoreNextClose = true;
mSearchView.setIconified(true);
mSearchView.clearFocus();
mIgnoreNextCollapse = true;
search.collapseActionView();
}
// Only sort by size when visible
sortSize.setVisible(mState.showSize);
search.setVisible(true);
createDir.setVisible(true);
return true;
}
示例3: updateMenuItems
import android.view.MenuItem; //导入方法依赖的package包/类
public void updateMenuItems(Menu menu){
final FragmentManager fm = getFragmentManager();
final RootInfo root = getCurrentRoot();
final DocumentInfo cwd = getCurrentDirectory();
if(isTelevision()) {
menu.findItem(R.id.menu_create_dir).setVisible(showActionMenu());
menu.findItem(R.id.menu_create_file).setVisible(showActionMenu());
}
final MenuItem search = menu.findItem(R.id.menu_search);
final MenuItem sort = menu.findItem(R.id.menu_sort);
final MenuItem sortSize = menu.findItem(R.id.menu_sort_size);
final MenuItem grid = menu.findItem(R.id.menu_grid);
final MenuItem list = menu.findItem(R.id.menu_list);
final MenuItem settings = menu.findItem(R.id.menu_settings);
// Open drawer means we hide most actions
if (isRootsDrawerOpen()) {
search.setVisible(false);
sort.setVisible(false);
grid.setVisible(false);
list.setVisible(false);
mIgnoreNextCollapse = true;
search.collapseActionView();
return;
}
sort.setVisible(cwd != null);
grid.setVisible(!RootInfo.isOtherRoot(getCurrentRoot()) && mState.derivedMode != MODE_GRID);
list.setVisible(mState.derivedMode != MODE_LIST);
if (mState.currentSearch != null) {
// Search uses backend ranking; no sorting
//sort.setVisible(false);
search.expandActionView();
mSearchView.setIconified(false);
mSearchView.clearFocus();
mSearchView.setQuery(mState.currentSearch, false);
} else {
mIgnoreNextClose = true;
mSearchView.setIconified(true);
mSearchView.clearFocus();
mIgnoreNextCollapse = true;
search.collapseActionView();
}
// Only sort by size when visible
sortSize.setVisible(mState.showSize);
final boolean searchVisible;
if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
searchVisible = false;
// No display options in recent directories
if (cwd == null) {
grid.setVisible(false);
list.setVisible(false);
}
if (mState.action == State.ACTION_CREATE) {
if (null != SaveFragment.get(fm))
SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
}
} else {
searchVisible = root != null
&& ((root.flags & Root.FLAG_SUPPORTS_SEARCH) != 0);
// TODO: Is this useful?
if(null != SaveFragment.get(fm))
SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
if(null != MoveFragment.get(fm))
MoveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isMoveSupported());
}
// TODO: close any search in-progress when hiding
search.setVisible(searchVisible);
//settings.setVisible(mState.action != ACTION_MANAGE);
}
示例4: collapseActionView
import android.view.MenuItem; //导入方法依赖的package包/类
public static boolean collapseActionView(MenuItem item) {
return item.collapseActionView();
}