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:org.telegram.ui.LocationActivity.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    SupportMenuItem item = (SupportMenuItem) menu
            .add(Menu.NONE, map_to_my_location, Menu.NONE,
                    LocaleController.getString("MyLocation", R.string.MyLocation))
            .setIcon(R.drawable.ic_ab_location);
    item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);

    menu.add(Menu.NONE, map_list_menu_map, Menu.NONE, LocaleController.getString("Map", R.string.Map));
    menu.add(Menu.NONE, map_list_menu_satellite, Menu.NONE,
            LocaleController.getString("Satellite", R.string.Satellite));
    menu.add(Menu.NONE, map_list_menu_hybrid, Menu.NONE, LocaleController.getString("Hybrid", R.string.Hybrid));
}

From source file:com.audiokernel.euphonyrmt.fragments.NowPlayingFragment.java

/**
 * Run during fragment initialization, this sets up the cover art popup menu and the coverArt
 * ImageView.//from   ww  w .  java 2 s  . co m
 *
 * @param view The view to setup the coverArt ImageView in.
 * @return The resulting ImageView.
 */
private ImageView getCoverArt(final View view) {
    final ImageView coverArt = (ImageView) view.findViewById(R.id.albumCover);
    final PopupMenu coverMenu = new PopupMenu(mActivity, coverArt);
    final Menu menu = coverMenu.getMenu();

    coverArt.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            scrollToNowPlaying();
        }
    });

    menu.add(Menu.NONE, POPUP_COVER_BLACKLIST, Menu.NONE, R.string.otherCover);
    menu.add(Menu.NONE, POPUP_COVER_SELECTIVE_CLEAN, Menu.NONE, R.string.resetCover);
    coverMenu.setOnMenuItemClickListener(this);
    coverArt.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(final View v) {
            final boolean isConsumed;

            if (mCurrentSong != null) {
                menu.setGroupVisible(Menu.NONE, new AlbumInfo(mCurrentSong).isValid());
                coverMenu.show();
                isConsumed = true;
            } else {
                isConsumed = false;
            }

            return isConsumed;
        }
    });

    return coverArt;
}

From source file:org.camlistore.CamliActivity.java

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

    MenuItem uploadAll = menu.add(Menu.NONE, MENU_UPLOAD_ALL, 0, R.string.upload_all);
    uploadAll.setIcon(android.R.drawable.ic_menu_upload);

    MenuItem stop = menu.add(Menu.NONE, MENU_STOP, 0, R.string.stop);
    stop.setIcon(android.R.drawable.ic_menu_close_clear_cancel);

    MenuItem stopDie = menu.add(Menu.NONE, MENU_STOP_DIE, 0, R.string.stop_die);
    stopDie.setIcon(android.R.drawable.ic_menu_close_clear_cancel);

    MenuItem profiles = menu.add(Menu.NONE, MENU_PROFILES, 0, R.string.profile);
    // TODO(mpl): do we care about this icon? I don't even know where it actually appears.
    profiles.setIcon(android.R.drawable.ic_menu_preferences);

    MenuItem settings = menu.add(Menu.NONE, MENU_SETTINGS, 0, R.string.settings);
    settings.setIcon(android.R.drawable.ic_menu_preferences);

    menu.add(Menu.NONE, MENU_VERSION, 0, R.string.version);
    return true;/*from w ww .  jav a2s .  c  o m*/
}

From source file:com.battlelancer.seriesguide.extensions.ExtensionsConfigurationFragment.java

private void showAddExtensionPopupMenu(View anchorView) {
    if (mAddExtensionPopupMenu != null) {
        mAddExtensionPopupMenu.dismiss();
    }// w w w  . j  a  v  a  2s.  c  o  m

    mAddExtensionPopupMenu = new PopupMenu(getActivity(), anchorView);
    for (int i = 0; i < mAvailableExtensions.size(); i++) {
        ExtensionManager.Extension extension = mAvailableExtensions.get(i);
        mAddExtensionPopupMenu.getMenu().add(Menu.NONE, i, Menu.NONE, extension.label);
    }
    mAddExtensionPopupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(android.view.MenuItem item) {
            // add to enabled extensions
            ExtensionManager.Extension extension = mAvailableExtensions.get(item.getItemId());
            mEnabledExtensions.add(extension.componentName);
            // re-populate extension list
            getLoaderManager().restartLoader(ExtensionsConfigurationActivity.LOADER_ACTIONS_ID, null,
                    mExtensionsLoaderCallbacks);
            // scroll to end of list
            mListView.smoothScrollToPosition(mAdapter.getCount() - 1);
            return true;
        }
    });

    mAddExtensionPopupMenu.show();
}

From source file:org.puder.trs80.EmulatorActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItemCompat.setShowAsAction(/*  ww  w.  j  av a  2 s . c o m*/
            menu.add(Menu.NONE, MENU_OPTION_PAUSE, Menu.NONE, this.getString(R.string.menu_pause))
                    .setIcon(R.drawable.pause_icon),
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    MenuItemCompat.setShowAsAction(
            menu.add(Menu.NONE, MENU_OPTION_RESET, Menu.NONE, this.getString(R.string.menu_reset))
                    .setIcon(R.drawable.reset_icon),
            MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    MenuItemCompat.setShowAsAction(
            menu.add(Menu.NONE, MENU_OPTION_REWIND, Menu.NONE, this.getString(R.string.menu_rewind))
                    .setIcon(R.drawable.rewind_icon),
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    pasteMenuItem = menu.add(Menu.NONE, MENU_OPTION_PASTE, Menu.NONE, this.getString(R.string.menu_paste));
    MenuItemCompat.setShowAsAction(pasteMenuItem.setIcon(R.drawable.paste_icon),
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    if (currentConfiguration.isSoundMuted()) {
        // Mute sound permanently and don't show mute/unmute icons
        setSoundMuted(true);
    } else {
        muteMenuItem = menu.add(Menu.NONE, MENU_OPTION_SOUND_OFF, Menu.NONE,
                this.getString(R.string.menu_sound_off));
        MenuItemCompat.setShowAsAction(muteMenuItem.setIcon(R.drawable.sound_off_icon),
                MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
        unmuteMenuItem = menu.add(Menu.NONE, MENU_OPTION_SOUND_ON, Menu.NONE,
                this.getString(R.string.menu_sound_on));
        MenuItemCompat.setShowAsAction(unmuteMenuItem.setIcon(R.drawable.sound_on_icon),
                MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    }
    MenuItemCompat.setShowAsAction(
            menu.add(Menu.NONE, MENU_OPTION_TUTORIAL, Menu.NONE, this.getString(R.string.menu_tutorial)),
            MenuItemCompat.SHOW_AS_ACTION_NEVER);
    MenuItemCompat.setShowAsAction(
            menu.add(Menu.NONE, MENU_OPTION_HELP, Menu.NONE, this.getString(R.string.menu_help))
                    .setIcon(R.drawable.help_icon_white),
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    updateMenuIcons();
    return true;
}

From source file:com.mifos.mifosxdroid.online.documentlist.DocumentListFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();/*from   ww w  .  j  a  v a 2  s  .  com*/
    MenuItem menuItemAddNewDocument = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_DOCUMENT, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewDocument.setIcon(ContextCompat.getDrawable(getActivity(), R.drawable.ic_add_white_24dp));

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

From source file:ro.expectations.expenses.ui.backup.BackupFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (mIsFinancistoInstalled && mReadStorageAllowed) {
        menu.add(Menu.NONE, R.id.action_financisto_import, Menu.NONE, R.string.action_financisto_import);
    }//from  w  w  w.  j ava 2  s.  c o m
}

From source file:com.github.kanata3249.ffxieq.android.EquipmentSelectorActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem item;/*  w  w w.  j  a va  2  s  .co  m*/

    item = menu.findItem(R.id.OrderByName);
    if (item != null) {
        if (mOrderByName)
            item.setTitle(getString(R.string.OrderByLevel));
        else
            item.setTitle(getString(R.string.OrderByName));
    }

    EquipmentListView elv;

    item = menu.findItem(R.id.FilterByType);
    SubMenu submenu = item.getSubMenu();
    submenu.removeGroup(R.id.FilterByType);

    elv = (EquipmentListView) findViewById(R.id.ListView);
    if (elv != null) {
        String types[] = elv.getAvailableWeaponTypes();

        if (types == null || types.length == 1) {
            item.setEnabled(false);
        } else {
            item.setEnabled(true);
            submenu.add(R.id.FilterByType, -1, Menu.NONE, getString(R.string.ResetFilterByType));
            for (int i = 0; i < types.length; i++) {
                submenu.add(R.id.FilterByType, i, Menu.NONE, types[i]);
            }
        }

    }

    return super.onPrepareOptionsMenu(menu);
}

From source file:com.pdftron.pdf.controls.UserBookmarkDialogFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.controls_bookmark_recycler_view) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        UserBookmarkItem item = mBookmarkViewAdapter.getItem(info.position);
        menu.setHeaderTitle(item.title);
        String[] menuItems = getResources().getStringArray(R.array.user_bookmark_dialog_context_menu);
        menu.add(Menu.NONE, CONTEXT_MENU_EDIT_ITEM, CONTEXT_MENU_EDIT_ITEM, menuItems[CONTEXT_MENU_EDIT_ITEM]);
        menu.add(Menu.NONE, CONTEXT_MENU_DELETE_ITEM, CONTEXT_MENU_DELETE_ITEM,
                menuItems[CONTEXT_MENU_DELETE_ITEM]);
        menu.add(Menu.NONE, CONTEXT_MENU_DELETE_ALL, CONTEXT_MENU_DELETE_ALL,
                menuItems[CONTEXT_MENU_DELETE_ALL]);

        MenuItem.OnMenuItemClickListener listener = new MenuItem.OnMenuItemClickListener() {
            @Override/*from w  w w. j  ava 2s  . co m*/
            public boolean onMenuItemClick(MenuItem item) {
                onContextItemSelected(item);
                return true;
            }
        };
        menu.getItem(CONTEXT_MENU_EDIT_ITEM).setOnMenuItemClickListener(listener);
        menu.getItem(CONTEXT_MENU_DELETE_ITEM).setOnMenuItemClickListener(listener);
        menu.getItem(CONTEXT_MENU_DELETE_ALL).setOnMenuItemClickListener(listener);
    }
}

From source file:com.github.kanata3249.ffxieq.android.AugmentSelectorActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem item;/*from  w w  w  . j ava 2s. c o m*/

    item = menu.findItem(R.id.OrderByName);
    if (item != null) {
        if (mOrderByName)
            item.setTitle(getString(R.string.OrderByLevel));
        else
            item.setTitle(getString(R.string.OrderByName));
    }

    AugmentListView lv;

    item = menu.findItem(R.id.FilterByType);
    SubMenu submenu = item.getSubMenu();
    submenu.removeGroup(R.id.FilterByType);

    lv = (AugmentListView) findViewById(R.id.ListView);
    if (lv != null) {
        String types[] = lv.getAvailableWeaponTypes();

        if (types == null || types.length == 1) {
            item.setEnabled(false);
        } else {
            item.setEnabled(true);
            submenu.add(R.id.FilterByType, -1, Menu.NONE, getString(R.string.ResetFilterByType));
            for (int i = 0; i < types.length; i++) {
                submenu.add(R.id.FilterByType, i, Menu.NONE, types[i]);
            }
        }

    }

    return super.onPrepareOptionsMenu(menu);
}