Example usage for android.view Menu CATEGORY_CONTAINER

List of usage examples for android.view Menu CATEGORY_CONTAINER

Introduction

In this page you can find the example usage for android.view Menu CATEGORY_CONTAINER.

Prototype

int CATEGORY_CONTAINER

To view the source code for android.view Menu CATEGORY_CONTAINER.

Click Source Link

Document

Category code for the order integer for items/groups that are part of a container -- or/add this with your base value.

Usage

From source file:com.pansapiens.occyd.MapResults.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    // group, id (for click handling), order, title
    int order = Menu.CATEGORY_CONTAINER + Menu.FLAG_ALWAYS_PERFORM_CLOSE;
    menu.add(Menu.NONE, 0, order, "Search").setAlphabeticShortcut('s');
    ;/*from w w w.j  a  v  a  2s.c o  m*/
    menu.add(Menu.NONE, 1, order, "Post").setAlphabeticShortcut('p');
    ;
    menu.add(Menu.NONE, 2, order, "Map").setAlphabeticShortcut('m');
    menu.add(Menu.NONE, 3, order, "Settings");
    menu.add(Menu.NONE, 4, order, "Help").setAlphabeticShortcut('h');
    return true;
}

From source file:com.pansapiens.occyd.NewPost.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    // group, id (for click handling), order, title
    int order = Menu.CATEGORY_CONTAINER + Menu.FLAG_ALWAYS_PERFORM_CLOSE;
    //menu.add(Menu.NONE, 0, order, "Search").setAlphabeticShortcut('s'); ;
    //menu.add(Menu.NONE, 1, order, "Post").setAlphabeticShortcut('p'); ;
    menu.add(Menu.NONE, 2, order, "Map").setAlphabeticShortcut('m');
    menu.add(Menu.NONE, 3, order, "Settings");
    menu.add(Menu.NONE, 4, order, "Help").setAlphabeticShortcut('h');
    return true;/*ww w . j a v  a 2  s .c  o  m*/
}

From source file:org.brandroid.openmanager.activities.OpenExplorer.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    //Logger.LogVerbose("OpenExplorer.onPrepareOptionsMenu");

    if (getClipboard() != null) {
        MenuUtils.setMenuChecked(menu, getClipboard().isMultiselect(), R.id.menu_multi);
        MenuUtils.setMenuVisible(menu, getClipboard().size() > 0, R.id.content_paste);
    } else/*  w w w  .  ja va  2 s  . c o m*/
        MenuUtils.setMenuVisible(menu, false, R.id.content_paste);

    MenuUtils.setMenuVisible(menu, IS_DEBUG_BUILD && !isBlackBerry(), R.id.menu_debug);

    if (!BEFORE_HONEYCOMB && USE_ACTION_BAR) {
        //MenuUtils.setMenuVisible(menu, false, R.id.title_menu);
        if (menu.findItem(R.id.menu_search) != null) {
            if (mSearchView == null)
                mSearchView = SearchViewCompat.newSearchView(this);
            MenuItem item = menu.findItem(R.id.menu_search);
            MenuItemCompat.setShowAsAction(item,
                    MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
            MenuItemCompat.setActionView(item, mSearchView);
            if (mSearchView != null)
                SearchViewCompat.setOnQueryTextListener(mSearchView,
                        new SearchViewCompat.OnQueryTextListenerCompat() {
                            public boolean onQueryTextSubmit(String query) {
                                mSearchView.clearFocus();
                                Intent intent = new Intent();
                                intent.setAction(Intent.ACTION_SEARCH);
                                Bundle appData = new Bundle();
                                appData.putString("path", getDirContentFragment(false).getPath().getPath());
                                intent.putExtra(SearchManager.APP_DATA, appData);
                                intent.putExtra(SearchManager.QUERY, query);
                                handleIntent(intent);
                                return true;
                            }

                            public boolean onQueryTextChange(String newText) {
                                return false;
                            }
                        });
        }
    }

    MenuUtils.setMenuChecked(menu, USE_SPLIT_ACTION_BAR, R.id.menu_view_split);
    //MenuUtils.setMenuChecked(menu, mLogFragment != null && mLogFragment.isVisible(), R.id.menu_view_logview);
    MenuUtils.setMenuChecked(menu, getPreferences().getBoolean("global", "pref_fullscreen", false),
            R.id.menu_view_fullscreen);
    if (!getResources().getBoolean(R.bool.allow_fullscreen))
        MenuUtils.setMenuVisible(menu, false, R.id.menu_view_fullscreen);
    else
        MenuUtils.setMenuChecked(menu, IS_FULL_SCREEN, R.id.menu_view_fullscreen);
    if (getWindowWidth() < 500 && Build.VERSION.SDK_INT < 14) // ICS can split the actionbar
    {
        MenuUtils.setMenuShowAsAction(menu, 0 // Never
                , R.id.menu_sort, R.id.menu_view, R.id.menu_new_folder);
        MenuUtils.setMenuVisible(menu, true, R.id.menu_more);
    }

    //if(BEFORE_HONEYCOMB)
    {
        OpenFragment f = getSelectedFragment();
        if (f != null && f.hasOptionsMenu() && !f.isDetached() && f.isVisible())
            f.onPrepareOptionsMenu(menu);
    }

    if (menu != null && menu.findItem(R.id.content_paste) != null && getClipboard() != null
            && getClipboard().size() > 0) {
        SubMenu sub = menu.findItem(R.id.content_paste).getSubMenu();
        if (sub != null) {
            int i = 0;
            for (final OpenPath item : getClipboard().getAll()) {
                sub.add(Menu.CATEGORY_CONTAINER, i++, i, item.getName()).setCheckable(true).setChecked(true)
                        .setOnMenuItemClickListener(new OnMenuItemClickListener() {
                            @Override
                            public boolean onMenuItemClick(MenuItem menuitem) {
                                getClipboard().remove(item);
                                return true;
                            }
                        }).setIcon(ThumbnailCreator.getDefaultResourceId(item, 32, 32));
            }
        }
    }

    if (!CAN_DO_CAROUSEL)
        MenuUtils.setMenuVisible(menu, false, R.id.menu_view_carousel);

    //if(BEFORE_HONEYCOMB)
    //   setupBaseBarButtons(menu, false);

    return true;
}