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.code.android.vibevault.SearchScreen.java

/** Called when the activity is first created. */
@Override/*from w  w  w .j  av a  2  s . c  o m*/
public void onCreate(Bundle savedInstanceState) {

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

    this.searchList = (ListView) this.findViewById(R.id.ResultsListView);
    this.artistSearchInput = (AutoCompleteTextView) this.findViewById(R.id.ArtistSearchBox);
    this.yearSearchInput = (EditText) this.findViewById(R.id.YearSearchBox);
    this.dateModifierSpinner = (Spinner) this.findViewById(R.id.DateSearchSpinner);
    this.searchButton = (Button) this.findViewById(R.id.SearchButton);
    this.settingsButton = (Button) this.findViewById(R.id.SettingsButton);
    //this.searchMoreButton = (Button) this.findViewById(R.id.SearchMoreButton);
    this.clearButton = (Button) this.findViewById(R.id.ClearButton);
    this.searchDrawer = (SlidingDrawer) this.findViewById(R.id.SlidingDrawerSearchScreen);
    this.handleText = (TextView) this.findViewById(R.id.HandleTextView);

    vibrator = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);

    searchList.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.SHOW_INFO, Menu.NONE, "Show Info");
            menu.add(Menu.NONE, VibeVault.ADD_TO_FAVORITE_LIST, Menu.NONE, "Bookmark Show");
        }
    });

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

        workerTask = (JSONQueryTask) retained;
        workerTask.setActivity(this);
    } else {
        workerTask = new JSONQueryTask(this);
    }
    if (VibeVault.searchResults.size() != 0) {
        searchButton.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.morebutton),
                null, null, null);
        searchButton.setText("More");
        //this.clearButton.setEnabled(true);
    } else {
        searchButton.setCompoundDrawablesWithIntrinsicBounds(
                getResources().getDrawable(R.drawable.searchbutton_plain), null, null, null);
        searchButton.setText("Search");
    }
    this.init();

    Intent intent = getIntent();
    if (intent.hasExtra("Artist")) {
        browseArtist(intent.getStringExtra("Artist"));
    }

    if (!VibeVault.db.getPref("artistUpdate").equals("2010-01-01")) {
        artistSearchInput.setAdapter(
                new ArrayAdapter<String>(this, R.layout.artist_search_row, VibeVault.db.getArtistsStrings()));
    }

    if (VibeVault.searchPref.equals("Show/Artist Description") && artistSearchInput.getText().equals("")) {
        artistSearchInput.setHint("Search Descriptions...");
    }
}

From source file:com.ksharkapps.musicnow.ui.fragments.profile.PlaylistSongFragment.java

/**
 * {@inheritDoc}/* ww w  .  j av a2 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;
    if (info.position > 0) {

        mSelectedPosition = info.position - 1;
        // Creat a new song
        mSong = mAdapter.getItem(mSelectedPosition);
        mSelectedId = mSong.mSongId;
        mSongName = mSong.mSongName;
        mAlbumName = mSong.mAlbumName;
        mArtistName = mSong.mArtistName;

        // Play the song
        menu.add(GROUP_ID, FragmentMenuItems.PLAY_SELECTION, Menu.NONE,
                getString(R.string.context_menu_play_selection));

        // Play next
        menu.add(GROUP_ID, FragmentMenuItems.PLAY_NEXT, Menu.NONE, getString(R.string.context_menu_play_next));

        // Add the song to the queue
        menu.add(GROUP_ID, FragmentMenuItems.ADD_TO_QUEUE, Menu.NONE, getString(R.string.add_to_queue));

        // Add the song to a playlist
        final SubMenu subMenu = menu.addSubMenu(GROUP_ID, FragmentMenuItems.ADD_TO_PLAYLIST, Menu.NONE,
                R.string.add_to_playlist);
        MusicUtils.makePlaylistMenu(getActivity(), GROUP_ID, subMenu, true);

        // View more content by the song artist
        menu.add(GROUP_ID, FragmentMenuItems.MORE_BY_ARTIST, Menu.NONE,
                getString(R.string.context_menu_more_by_artist));

        // Make the song a ringtone
        menu.add(GROUP_ID, FragmentMenuItems.USE_AS_RINGTONE, Menu.NONE,
                getString(R.string.context_menu_use_as_ringtone));

        // Remove the song from playlist
        menu.add(GROUP_ID, FragmentMenuItems.REMOVE_FROM_PLAYLIST, Menu.NONE,
                getString(R.string.context_menu_remove_from_playlist));

        // Delete the song
        menu.add(GROUP_ID, FragmentMenuItems.DELETE, Menu.NONE, getString(R.string.context_menu_delete));
    }
}

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

@SuppressWarnings("deprecation")
@Override/*w w w  .  j  a v a  2  s .c  om*/
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_add_white_24dp));

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

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

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

    if (v.getId() == R.id.control_annotation_listview) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        AnnotationInfo item = mAnnotationListAdapter.getItem(info.position);
        String title = String.format(getResources().getString(R.string.controls_annotation_dialog_page),
                item.getPageNum());/* ww  w . j  a va 2  s .c  o  m*/
        if (item.getAuthor() != null && !item.getAuthor().isEmpty()) {
            title = title + " " + getResources().getString(R.string.controls_annotation_dialog_author) + " "
                    + item.getAuthor();
        }
        menu.setHeaderTitle(title);
        String[] menuItems = getResources().getStringArray(R.array.annotation_dialog_context_menu);
        menu.add(Menu.NONE, CONTEXT_MENU_DELETE_ITEM, CONTEXT_MENU_DELETE_ITEM,
                menuItems[CONTEXT_MENU_DELETE_ITEM + 1]);
        if (mDebug) {
            // Convenient for debugging
            menu.add(Menu.NONE, CONTEXT_MENU_DELETE_ITEM_ONPAGE, CONTEXT_MENU_DELETE_ITEM_ONPAGE,
                    menuItems[CONTEXT_MENU_DELETE_ITEM_ONPAGE + 1]);
            menu.add(Menu.NONE, CONTEXT_MENU_DELETE_ALL, CONTEXT_MENU_DELETE_ALL,
                    menuItems[CONTEXT_MENU_DELETE_ALL + 1]);
        }
        MenuItem.OnMenuItemClickListener listener = new MenuItem.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                onContextItemSelected(item);
                return true;
            }
        };
        menu.getItem(CONTEXT_MENU_DELETE_ITEM).setOnMenuItemClickListener(listener);
        if (mDebug) {
            menu.getItem(CONTEXT_MENU_DELETE_ITEM_ONPAGE).setOnMenuItemClickListener(listener);
            menu.getItem(CONTEXT_MENU_DELETE_ALL).setOnMenuItemClickListener(listener);
        }
    }
}

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;//from   ww w  .j  av  a2s. c  o m
}

From source file:com.money.manager.ex.common.CategoryListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);
    int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    int child = ExpandableListView.getPackedPositionChild(info.packedPosition);

    if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        menu.setHeaderTitle(mCategories.get(group).getName());
    } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        QueryCategorySubCategory subCategory = mSubCategories.get(mCategories.get(group)).get(child);
        menu.setHeaderTitle(//w w w.  j  a v  a 2s  . c o  m
                subCategory.getCategName().toString() + ": " + subCategory.getSubcategoryName().toString());
    }

    // context menu from resource
    menu.add(Menu.NONE, ContextMenuIds.EDIT.getId(), Menu.NONE, getString(R.string.edit));
    menu.add(Menu.NONE, ContextMenuIds.DELETE.getId(), Menu.NONE, getString(R.string.delete));
    menu.add(Menu.NONE, ContextMenuIds.VIEW_TRANSACTIONS.getId(), Menu.NONE,
            getString(R.string.view_transactions));
}

From source file:com.example.android.animationsdemo.GirdPagerSearchBarActivity.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(mInnerPager.getCurrentItem() > 0);
    mPrev.setEnabled(mInnerPager.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,
            (mInnerPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish
                    : R.string.action_next);
    mNext.setEnabled(!(mInnerPager.getCurrentItem() == mPagerAdapter.getCount() - 1));
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;/*  ww  w .ja  v a 2 s . co  m*/
}

From source file:cm.aptoide.pt.ManageRepo.java

public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    menu.add(Menu.NONE, ADD_REPO, 1, R.string.menu_add_repo).setIcon(android.R.drawable.ic_menu_add);
    menu.add(Menu.NONE, EDIT_REPO, 2, R.string.menu_edit_repo).setIcon(android.R.drawable.ic_menu_edit);
    menu.add(Menu.NONE, REM_REPO, 3, R.string.menu_rem_repo)
            .setIcon(android.R.drawable.ic_menu_close_clear_cancel);
    return true;//from w  ww  .j  a  v  a2 s. c  om
}

From source file:org.thbz.hanguldrill.MainActivity.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.main_activity_actions, menu);

    try {/*w w  w  . j  av a2s . c  om*/
        MenuItem configListItem = menu.findItem(R.id.action_configlist);
        String[] configIds = Settings.ConfigManager.getAllConfigIds(this);

        if (configListItem.hasSubMenu() && configIds.length > 0) {
            SubMenu configMenu = configListItem.getSubMenu();
            if (configMenu == null) {
                if (BuildConfig.DEBUG)
                    Log.d(TAG, "configMenu = null");
            } else {
                // On ajoute une entre pour chacune des configurations existantes
                for (int i = 0; i < configIds.length; i++) {
                    String configId = configIds[i];
                    Settings.Configuration config = Settings.ConfigManager.getConfigFromId(this, configId);
                    String name = config.getName(this);
                    configMenu.add(Menu.NONE, START_MENUITEM_ID + i, i, name);
                }
            }

            // Set configMenu title
            try {
                Settings.Configuration lastSelectedConfig = Settings.ConfigManager.getLastSelectedConfig(this);
                if (lastSelectedConfig != null) {
                    String configName = lastSelectedConfig.getName(this);
                    if (configName != null) {
                        if (configName.length() > 15)
                            configName = configName.substring(0, 13) + "\u2026";
                        configListItem.setTitle(configName);
                    }
                }
            } catch (ClassCastException exc) {
                toastError("Exception : " + exc.getMessage());
            }
        }
    } catch (InternalException exc) {
        if (BuildConfig.DEBUG)
            if (BuildConfig.DEBUG)
                Log.e(TAG, "Erreur interne", exc);
    }

    return super.onCreateOptionsMenu(menu);
}

From source file:de.aw.monma.wertpapier.FragmentWertpapierBuchungenListe.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.awlib_defaultFAB:
        PopupMenu popUpMenu = new PopupMenu(getActivity(), v);
        Menu menu = popUpMenu.getMenu();
        // Aufbau des zugehoerigen Submenues
        for (WPUmsatzArt umsatzArt : WPUmsatzArt.values()) {
            switch (umsatzArt) {
            case Kauf:
            case OthrInc:
            case WP_Einlage:
            case Ausgabe:
                Intent intent = new Intent(getActivity(), ActivityWPUmsatz.class);
                intent.putExtra(ACTION, (Parcelable) Action.DoWertpapierUmsatz);
                intent.putExtra(ACCOUNTID, mAccountID);
                intent.putExtra(WPUMSATZART, umsatzArt);
                MenuItem item = menu.add(Menu.NONE, umsatzArt.getTextResID(), Menu.NONE,
                        umsatzArt.getBeschreibungID());
                item.setIntent(intent);/*  w w w  . j  a v  a 2  s.  com*/
            }
        }
        popUpMenu.show();
        break;
    default:
    }
}