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:com.nttec.everychan.ui.HistoryFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.add(Menu.NONE, R.id.menu_clear_history, 101, R.string.menu_clear_history)
            .setIcon(android.R.drawable.ic_menu_close_clear_cancel);
}

From source file:com.example.shyam.popi.LearnEmotions.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    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_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;//  w  ww. ja  v  a2s.c o  m
}

From source file:com.code.android.vibevault.FeaturedShowsScreen.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.featured_shows_screen);

    getMoreShowsButton = new Button(this);
    getMoreShowsButton.setText("More Featured Shows");
    getMoreShowsButton.setTextColor(Color.rgb(18, 125, 212));
    getMoreShowsButton.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
    getMoreShowsButton.setPadding(0, 6, 0, 6);

    getMoreShowsButton.setOnClickListener(new OnClickListener() {
        @Override//from   w  ww  . j  a  v a 2s. co  m
        public void onClick(View v) {
            if (VibeVault.moreFeaturedShows.size() != 0) {
                fetchSelectedShows(VibeVault.moreFeaturedShows.get(0));
            } else {
                Toast.makeText(getBaseContext(), "More featured shows weekly...", Toast.LENGTH_SHORT).show();
            }
        }
    });

    this.featuredShowsList = (ListView) this.findViewById(R.id.SelectedShowsListView);
    featuredShowsList.addFooterView(getMoreShowsButton);
    if (VibeVault.featuredShows.size() == 0) {
        getMoreShowsButton.setVisibility(View.GONE);
    } else {
        getMoreShowsButton.setVisibility(View.VISIBLE);
    }
    featuredShowsList.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> a, View v, int position, long id) {
            ArchiveShowObj show = (ArchiveShowObj) featuredShowsList.getItemAtPosition(position);
            Intent i = new Intent(FeaturedShowsScreen.this, ShowDetailsScreen.class);
            i.putExtra("Show", show);
            startActivity(i);
        }
    });
    featuredShowsList.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
        @Override
        public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
            menu.add(Menu.NONE, VibeVault.EMAIL_LINK, Menu.NONE, "Email Link to Show");
            menu.add(Menu.NONE, VibeVault.ADD_TO_FAVORITE_LIST, Menu.NONE, "Bookmark Show");
        }
    });

    Object retained = getLastNonConfigurationInstance();
    if (retained instanceof GetSelectedShowsListTask) {

        workerTask = (GetSelectedShowsListTask) retained;
        workerTask.setActivity(this);
    } else {
        workerTask = new GetSelectedShowsListTask(this);
        if (VibeVault.featuredShows.size() == 0) {
            this.fetchSelectedShows("http://andrewpearson.org/vibevault/shows/vvshows1");
        }
        this.refreshSelectedShowsList();
    }
}

From source file:com.example.android.pantry.scanner.BarcodeScannerActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem menuItem;//from   ww w  . ja v a 2 s .c  o  m

    if (mFlash) {
        menuItem = menu.add(Menu.NONE, R.id.menu_flash, 0, R.string.flash_on);
    } else {
        menuItem = menu.add(Menu.NONE, R.id.menu_flash, 0, R.string.flash_off);
    }
    MenuItemCompat.setShowAsAction(menuItem, MenuItem.SHOW_AS_ACTION_NEVER);

    if (mAutoFocus) {
        menuItem = menu.add(Menu.NONE, R.id.menu_auto_focus, 0, R.string.auto_focus_on);
    } else {
        menuItem = menu.add(Menu.NONE, R.id.menu_auto_focus, 0, R.string.auto_focus_off);
    }
    MenuItemCompat.setShowAsAction(menuItem, MenuItem.SHOW_AS_ACTION_NEVER);

    menuItem = menu.add(Menu.NONE, R.id.menu_formats, 0, R.string.formats);
    MenuItemCompat.setShowAsAction(menuItem, MenuItem.SHOW_AS_ACTION_NEVER);

    menuItem = menu.add(Menu.NONE, R.id.menu_camera_selector, 0, R.string.select_camera);
    MenuItemCompat.setShowAsAction(menuItem, MenuItem.SHOW_AS_ACTION_NEVER);

    return super.onCreateOptionsMenu(menu);
}

From source file:com.guayaba.tapir.ui.fragments.GenreFragment.java

/**
 * {@inheritDoc}/*from   w w w.  ja  v  a 2s.c om*/
 */
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    // Get the position of the selected item
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    // Create a new genre
    mGenre = mAdapter.getItem(info.position);
    // Create a list of the genre's songs
    mGenreList = MusicUtils.getSongListForGenre(getActivity(), mGenre.mGenreId);

    // Play the genre
    menu.add(GROUP_ID, FragmentMenuItems.PLAY_SELECTION, Menu.NONE, R.string.context_menu_play_selection);
    // Add the genre to the queue
    menu.add(GROUP_ID, FragmentMenuItems.ADD_TO_QUEUE, Menu.NONE, R.string.add_to_queue);
}

From source file:com.robertcm.romcontrol.project.MainActivity.java

private void setUpPrefsMenu(Menu navigationMenu) {
    String[] titles = getResources().getStringArray(R.array.nav_menu_prefs_titles);
    TypedArray iconIds = getResources().obtainTypedArray(R.array.nav_menu_prefs_drawables);
    mNavMenuItemsIds = new ArrayList<>();
    for (int i = 0; i < titles.length; i++) {
        Integer id = View.generateViewId();
        mNavMenuItemsIds.add(id);/*from ww w.j a va 2s .  com*/
        MenuItem item = navigationMenu.add(Menu.NONE, id, 0, titles[i]).setIcon(iconIds.getResourceId(i, -1));
        if (titles[i] != null && titles[i].equals(getTitle().toString())) {
            item.setChecked(true);
        }
    }
    iconIds.recycle();
    navigationMenu.setGroupCheckable(Menu.NONE, true, true);
}

From source file:com.boko.vimusic.ui.fragments.GenreFragment.java

/**
 * {@inheritDoc}/*  ww  w  .  j a  va  2  s .c o  m*/
 */
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    // Get the position of the selected item
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    // Create a new genre
    mGenre = mAdapter.getItem(info.position);
    // Create a list of the genre's songs
    mGenreList = MusicUtils.getSongListForGenre(getActivity(), mGenre.getId());

    // Play the genre
    menu.add(GROUP_ID, FragmentMenuItems.PLAY_SELECTION, Menu.NONE, R.string.context_menu_play_selection);
    // Add the genre to the queue
    menu.add(GROUP_ID, FragmentMenuItems.ADD_TO_QUEUE, Menu.NONE, R.string.add_to_queue);
}

From source file:com.ichi2.anki2.StudyOptionsActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    int icon;//from w  w  w  . ja v  a2s.c  o  m
    SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(this);
    if (preferences.getBoolean("invertedColors", false)) {
        icon = R.drawable.ic_menu_night_checked;
    } else {
        icon = R.drawable.ic_menu_night;
    }

    mInvalidateMenu = false;
    UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_NIGHT, Menu.NONE, R.string.night_mode, icon);
    UIUtils.addMenuItem(menu, Menu.NONE, MENU_PREFERENCES, Menu.NONE, R.string.menu_preferences,
            R.drawable.ic_menu_preferences);
    UIUtils.addMenuItem(menu, Menu.NONE, MENU_ROTATE, Menu.NONE, R.string.menu_rotate,
            android.R.drawable.ic_menu_always_landscape_portrait);
    if (AnkiDroidApp.colIsOpen()
            && !AnkiDroidApp.getCol().getDecks().isDyn(AnkiDroidApp.getCol().getDecks().selected())) {
        UIUtils.addMenuItem(menu, Menu.NONE, DeckPicker.MENU_CREATE_DYNAMIC_DECK, Menu.NONE,
                R.string.studyoptions_new_filtercram, R.drawable.ic_menu_add);
    }
    return true;
}

From source file:com.plnyyanks.frcnotebook.activities.ViewEvent.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.view_event, menu);

    if (event != null && !event.isOfficial()) {
        //allow updating of scores via URL for unofficial events, but not for official ones
        menu.add(0, ID_ADD_MATCHES, Menu.NONE, R.string.action_add_matches);
    }//from   w w w . j  a  v  a2s  .co m
    return true;
}