Example usage for android.view Menu NONE

List of usage examples for android.view Menu NONE

Introduction

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

Prototype

int NONE

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

Click Source Link

Document

Value to use for group and item identifier integers when you don't care about them.

Usage

From source file:de.uni.stuttgart.informatik.ToureNPlaner.UI.Fragments.NodeListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    adapter = new NodeListAdapter(getActivity(), session.getNodeModel().getNodeVector(),
            session.getSelectedAlgorithm().sourceIsTarget());
    setListAdapter(adapter);/*www .ja  v a 2  s  . co m*/
    ListView listView = getListView();
    registerForContextMenu(listView);

    if (listView instanceof DragNDropListView) {
        ((DragNDropListView) listView).setDropListener(mDropListener);
        ((DragNDropListView) listView).setDragListener(mDragListener);

        //---------ContextMenu-----------------
        listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
            @Override
            public void onCreateContextMenu(ContextMenu contextMenu, View view,
                    ContextMenu.ContextMenuInfo contextMenuInfo) {
                AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) contextMenuInfo;
                contextMenu.setHeaderTitle(adapter.getItem(info.position).getName());
                String[] menuItems = { getResources().getString(R.string.edit),
                        getResources().getString(R.string.delete) };
                for (int i = 0; i < menuItems.length; i++) {
                    contextMenu.add(Menu.NONE, i, i, menuItems[i]);
                }
            }
        });

        listView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapter, View view, final int pos, long arg3) {
                editNode((Node) adapter.getItemAtPosition(pos), pos);
            }
        });
    }
}

From source file:com.androidinspain.deskclock.ringtone.RingtoneViewHolder.java

@Override
public void onCreateContextMenu(ContextMenu contextMenu, View view,
        ContextMenu.ContextMenuInfo contextMenuInfo) {
    notifyItemClicked(RingtoneViewHolder.CLICK_LONG_PRESS);
    contextMenu.add(Menu.NONE, 0, Menu.NONE, R.string.remove_sound);
}

From source file:com.mifos.mifosxdroid.online.ClientChargeFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();/*from ww  w  .j a v  a  2  s . c om*/
    MenuItem menuItemAddNewDocument = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_CHARGES, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewDocument
            .setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_action_content_new, null));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        menuItemAddNewDocument.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    super.onPrepareOptionsMenu(menu);
}

From source file:com.nttec.everychan.ui.FavoritesFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.add(Menu.NONE, R.id.context_menu_open_browser, 1, R.string.context_menu_open_browser);
    menu.add(Menu.NONE, R.id.context_menu_remove_favorites, 2, R.string.context_menu_remove_favorites);
}

From source file:behsaman.storytellerandroid.TextviewerSlideActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.screen_slide, menu);

    menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0);

    // Add either a "next" or "finish" button to the action bar, depending on which page
    // is currently selected.
    MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE,
            (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? "Finish" : "Next");
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;/*from  w  ww.j ava 2  s  .com*/
}

From source file:com.android.packageinstaller.permission.ui.PermissionAppsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    mShowSystemMenu = menu.add(Menu.NONE, MENU_SHOW_SYSTEM, Menu.NONE, R.string.menu_show_system);
    mHideSystemMenu = menu.add(Menu.NONE, MENU_HIDE_SYSTEM, Menu.NONE, R.string.menu_hide_system);
    updateMenu();//  www .  j av a 2s  .  c  o m
}

From source file:net.lacolaco.smileessence.activity.EditExtractionActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem add = menu.add(Menu.NONE, R.id.menu_edit_list_add, Menu.NONE, "");
    add.setIcon(android.R.drawable.ic_menu_add);
    add.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    return true;//  ww w  . jav  a2 s  .  c om
}

From source file:net.lacolaco.smileessence.activity.EditCommandActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem allOn = menu.add(Menu.NONE, R.id.menu_edit_command_all_on, Menu.NONE, "");
    allOn.setTitle(R.string.actionbar_edit_command_all_on);
    allOn.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    return true;//from w w  w  . j a v  a 2s.com
}

From source file:com.mifos.mifosxdroid.online.LoanChargeFragment.java

@SuppressWarnings("deprecation")
@Override//from   w w w .j a v a2s.  com
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    MenuItem menuItemAddNewLoanCharge = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_LOAN_CHARGES, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewLoanCharge.setIcon(getResources().getDrawable(R.drawable.ic_action_content_new));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        menuItemAddNewLoanCharge.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    super.onPrepareOptionsMenu(menu);
}

From source file:org.gdg.frisbee.android.common.GdgNavDrawerActivity.java

private void setupDrawerContent(NavigationView navigationView) {

    Menu menu = navigationView.getMenu();
    menu.add(GROUP_ID, Const.DRAWER_HOME, Menu.NONE, R.string.home_gdg).setIcon(R.drawable.ic_drawer_home_gdg);
    menu.add(GROUP_ID, Const.DRAWER_GDE, Menu.NONE, R.string.gde).setIcon(R.drawable.ic_drawer_gde);
    menu.add(GROUP_ID, Const.DRAWER_PULSE, Menu.NONE, R.string.pulse).setIcon(R.drawable.ic_drawer_pulse);

    //adding special events in navigation drawer
    final ArrayList<TaggedEventSeries> currentEventSeries = App.getInstance().currentTaggedEventSeries();
    for (TaggedEventSeries taggedEventSeries : currentEventSeries) {
        menu.add(GROUP_ID, taggedEventSeries.getDrawerId(), Menu.NONE, taggedEventSeries.getTitleResId())
                .setIcon(taggedEventSeries.getDrawerIconResId());
    }/*from  w  w  w  . j  a v a2  s .c  o  m*/

    SubMenu subMenu = menu.addSubMenu(GAMES_GROUP_ID, Const.DRAWER_SUBMENU_GAMES, Menu.NONE,
            R.string.drawer_subheader_games);
    subMenu.add(GAMES_GROUP_ID, Const.DRAWER_ACHIEVEMENTS, Menu.NONE, R.string.achievements)
            .setIcon(R.drawable.ic_drawer_achievements);
    subMenu.add(GAMES_GROUP_ID, Const.DRAWER_ARROW, Menu.NONE, R.string.arrow)
            .setIcon(R.drawable.ic_drawer_arrow).setCheckable(true);

    menu.add(SETTINGS_GROUP_ID, Const.DRAWER_SETTINGS, Menu.NONE, R.string.settings)
            .setIcon(R.drawable.ic_drawer_settings);
    menu.add(SETTINGS_GROUP_ID, Const.DRAWER_HELP, Menu.NONE, R.string.help).setIcon(R.drawable.ic_drawer_help);
    menu.add(SETTINGS_GROUP_ID, Const.DRAWER_FEEDBACK, Menu.NONE, R.string.feedback)
            .setIcon(R.drawable.ic_drawer_feedback);
    menu.add(SETTINGS_GROUP_ID, Const.DRAWER_ABOUT, Menu.NONE, R.string.about)
            .setIcon(R.drawable.ic_drawer_about);

    menu.setGroupCheckable(GROUP_ID, true, true);

    final int selectedDrawerItemId = getIntent().getIntExtra(EXTRA_SELECTED_DRAWER_ITEM_ID, Const.DRAWER_HOME);
    final MenuItem selectedItem = menu.findItem(selectedDrawerItemId);
    if (selectedItem != null) {
        selectedItem.setChecked(true);
    }

    navigationView.setNavigationItemSelectedListener(

            new NavigationView.OnNavigationItemSelectedListener() {
                @Override
                public boolean onNavigationItemSelected(MenuItem menuItem) {
                    onDrawerItemClick(menuItem);
                    mDrawerLayout.closeDrawers();
                    return true;
                }
            });
    View headerView = navigationView.getHeaderView(0);
    mDrawerImage = ButterKnife.findById(headerView, R.id.navdrawer_image);
    mDrawerUserPicture = ButterKnife.findById(headerView, R.id.navdrawer_user_picture);
}