本文整理匯總了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();
}