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:pl.zajecia.cw3.PhotosActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    menu.setHeaderTitle(R.string.image_options);
    menu.add(Menu.NONE, 0, Menu.NONE, R.string.remove_image);
}

From source file:edu.cmu.cylab.starslinger.demo.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    MenuItem iUse = menu.add(0, MENU_MSG, 0, "Usage").setIcon(android.R.drawable.ic_menu_info_details);
    MenuCompat.setShowAsAction(iUse, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);

    if (getNfcState(this) != null) {
        menu.add(Menu.NONE, MENU_NFC, Menu.NONE, R.string.dev_menu_nfc_settings);
    }// w ww.ja v a 2  s  .  com

    return true;
}

From source file:org.epstudios.epcoding.ScreenSlideActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.activity_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) ? R.string.action_finish
                    : R.string.action_next);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;/*from  w w  w  . j a  v a  2 s. co  m*/
}

From source file:io.github.hidroh.materialistic.ReadabilityFragment.java

@Override
protected void createOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_font_options, menu);
    mTextSizeOptionValues = getResources().getStringArray(R.array.pref_text_size_values);
    mFontOptionValues = getResources().getStringArray(R.array.font_values);
    SubMenu subMenu = menu.findItem(R.id.menu_font_size).getSubMenu();
    String[] options = getResources().getStringArray(R.array.text_size_options);
    String initialTextSize = Preferences.Theme.getPreferredReadabilityTextSize(getActivity());
    for (int i = 0; i < options.length; i++) {
        MenuItem item = subMenu.add(R.id.menu_font_size_group, Menu.NONE, i, options[i]);
        item.setChecked(TextUtils.equals(initialTextSize, mTextSizeOptionValues[i]));
    }/*from   w  w w.  j  ava2  s. c  o m*/
    subMenu.setGroupCheckable(R.id.menu_font_size_group, true, true);
    subMenu = menu.findItem(R.id.menu_font).getSubMenu();
    options = getResources().getStringArray(R.array.font_options);
    String initialTypeface = Preferences.Theme.getReadabilityTypeface(getActivity());
    for (int i = 0; i < options.length; i++) {
        MenuItem item = subMenu.add(R.id.menu_font_group, Menu.NONE, i, options[i]);
        item.setChecked(TextUtils.equals(initialTypeface, mFontOptionValues[i]));
    }
    subMenu.setGroupCheckable(R.id.menu_font_group, true, true);
}

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

@Override
public void onPrepareOptionsMenu(Menu menu) {

    menu.clear();//from www .  ja v  a  2s  .  c o m

    MenuItem mItemSearch = menu.add(Menu.NONE, MENU_ITEM_SEARCH, Menu.NONE, getString(R.string.search));
    //        mItemSearch.setIcon(new IconDrawable(getActivity(), MaterialIcons.md_search)
    //                .colorRes(Color.WHITE)
    //                .actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }

    MenuItem mItemRefresh = menu.add(Menu.NONE, MENU_ITEM_REFRESH, Menu.NONE, getString(R.string.refresh));
    mItemRefresh.setIcon(
            new IconDrawable(getActivity(), MaterialIcons.md_refresh).colorRes(Color.WHITE).actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemRefresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    MenuItem mItemSave = menu.add(Menu.NONE, MENU_ITEM_SAVE, Menu.NONE, getString(R.string.save));
    mItemSave.setIcon(
            new IconDrawable(getActivity(), MaterialIcons.md_save).colorRes(Color.WHITE).actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemSave.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    super.onPrepareOptionsMenu(menu);

}

From source file:cz.msebera.unbound.dns.fragments.MainLogFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(Menu.NONE, MENU_CLEAR, Menu.NONE, R.string.menu_clear)
            .setIcon(android.R.drawable.ic_menu_close_clear_cancel)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    menu.add(Menu.NONE, MENU_EMPTY, Menu.NONE, R.string.mainlog_menu_truncate_log)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    super.onCreateOptionsMenu(menu, inflater);
}

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');
    ;/*ww w .j  av  a 2s .c om*/
    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:de.stadtrallye.rallyesoft.fragments.ChatroomFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem refreshMenuItem = menu.add(Menu.NONE, R.id.refresh_menu, 30, R.string.refresh);

    refreshMenuItem.setIcon(R.drawable.ic_refresh_light);
    refreshMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);

    MenuItem pictureMenuItem = menu.add(Menu.NONE, R.id.picture_menu, 10, R.string.take_picture);

    pictureMenuItem.setIcon(R.drawable.ic_camera_light);
    pictureMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}

From source file:com.google.android.demos.jamendo.app.AlbumActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    int groupId = MENU_GROUP_INTENT_OPTIONS;
    int itemId = Menu.NONE;
    int order = Menu.NONE;
    ComponentName caller = getComponentName();
    Intent[] specifics = null;/*from w w  w .j av  a  2s.  c o m*/
    Intent intent = new Intent();
    long id = ContentUris.parseId(getIntent().getData());
    intent.setDataAndType(JamendoContract.createPlaylistUri(JamendoContract.FORMAT_M3U, Albums.ID, id),
            JamendoContract.CONTENT_TYPE_M3U);
    intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
    int flags = 0;
    MenuItem[] outSpecificItems = null;
    menu.addIntentOptions(groupId, itemId, order, caller, specifics, intent, flags, outSpecificItems);
    return menu.hasVisibleItems();
}

From source file:com.mifos.mifosxdroid.online.collectionsheet.CollectionSheetFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {

    menu.clear();//from  w w  w  . jav  a2  s .  c  om

    MenuItem mItemSearch = menu.add(Menu.NONE, MENU_ITEM_SEARCH, Menu.NONE, getString(R.string.search));
    //        mItemSearch.setIcon(new IconDrawable(getActivity(), MaterialIcons.md_search)
    //                .colorRes(Color.WHITE)
    //                .actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }

    MenuItem mItemRefresh = menu.add(Menu.NONE, MENU_ITEM_REFRESH, Menu.NONE, getString(R.string.refresh));
    mItemRefresh.setIcon(
            new IconDrawable(getActivity(), MaterialIcons.md_refresh).colorRes(R.color.white).actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemRefresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    MenuItem mItemSave = menu.add(Menu.NONE, MENU_ITEM_SAVE, Menu.NONE, getString(R.string.save));
    mItemSave.setIcon(
            new IconDrawable(getActivity(), MaterialIcons.md_save).colorRes(R.color.white).actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemSave.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    super.onPrepareOptionsMenu(menu);

}