Example usage for android.view ContextMenu add

List of usage examples for android.view ContextMenu add

Introduction

In this page you can find the example usage for android.view ContextMenu add.

Prototype

public MenuItem add(int groupId, int itemId, int order, CharSequence title);

Source Link

Document

Add a new item to the menu.

Usage

From source file:org.lyricue.android.AvailableSongsFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.available_songlist) {
        menu.setHeaderTitle("Item Actions");
        menu.add(2, 0, 0, "Add to playlist");
    }// w w  w.  j a v  a 2s.c  o m
}

From source file:id.nci.stm_9.KeyListPublicFragment.java

/**
 * Context Menu on Long Click/*from   w  ww  . j a  v  a  2  s .c  o  m*/
 */
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    //        menu.add(0, Id.menu.update, 1, R.string.menu_update_key);
    menu.add(0, 0x21070004, 1, R.string.menu_update_key);
    //        menu.add(0, Id.menu.signKey, 2, R.string.menu_sign_key);
    menu.add(0, 0x21070009, 2, R.string.menu_sign_key);
    //        menu.add(0, Id.menu.exportToServer, 3, R.string.menu_export_key_to_server);
    menu.add(0, 0x21070005, 3, R.string.menu_export_key_to_server);
    //        menu.add(0, Id.menu.share, 6, R.string.menu_share);
    menu.add(0, 0x21070006, 6, R.string.menu_share);
    //        menu.add(0, Id.menu.share_qr_code, 7, R.string.menu_share_qr_code);
    menu.add(0, 0x21070007, 7, R.string.menu_share_qr_code);
    //        menu.add(0, Id.menu.share_nfc, 8, R.string.menu_share_nfc);
    menu.add(0, 0x21070008, 8, R.string.menu_share_nfc);

}

From source file:eu.thecoder4.gpl.pleftdroid.PleftDroidActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    //TODO icon?// w  w  w.j av  a 2s. c o m
    menu.add(0, DELETE_ID, 0, R.string.menu_delete).setIcon(android.R.drawable.ic_menu_delete);
    super.onCreateContextMenu(menu, v, menuInfo);
}

From source file:org.akvo.flow.activity.SurveyGroupListActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, view, menuInfo);
    menu.add(0, ITEM_DELETE, 0, R.string.delete);
}

From source file:fileops.FileChooser.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.add(0, 1, 0, "Share");
    menu.add(0, 2, 0, "Delete");
    menu.add(0, 3, 0, "Rename");
    menu.add(0, 4, 0, "Move");
}

From source file:com.markupartist.sthlmtraveling.FavoritesFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    menu.setHeaderTitle("Actions");
    menu.add(ContextMenu.NONE, CONTEXT_MENU_DELETE, ContextMenu.NONE, R.string.delete);
    menu.add(ContextMenu.NONE, CONTEXT_MENU_REVERSE_SEARCH, ContextMenu.NONE, R.string.reverse_search);
    // Disabled the possibility to prioritize journeys in the list for now.
    // Not sure if this was the best way to do it. Figure we could test with
    // labels like HIGH, LOW and have a colored marker indicate the priority
    // to the left first.
    /*/*from   w  w  w . j av a 2s.c o  m*/
    menu.add(ContextMenu.NONE, CONTEXT_MENU_INCREASE_PRIO,
        ContextMenu.NONE, "Increase priority");
    menu.add(ContextMenu.NONE, CONTEXT_MENU_DECREASE_PRIO,
        ContextMenu.NONE, "Decrease priority");
    */
}

From source file:org.catnut.plugin.zhihu.ZhihuItemFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    menu.add(Menu.NONE, ACTION_VIEW_ALL_ON_WEB, Menu.NONE, getString(R.string.view_all_answer));
    menu.add(Menu.NONE, ACTION_VIEW_ON_WEB, Menu.NONE, getString(R.string.zhihu_view_on_web));
    super.onCreateContextMenu(menu, v, menuInfo);
}

From source file:com.mrpoid.mrplist.ui.MrpListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (mLongPressIndex < 0 || mLongPressIndex >= mData.size())
        return;//w ww.j  a  v a 2 s .  co m

    MrpFile file = mData.get(mLongPressIndex);

    menu.add(0, R.id.mi_remove, 0, R.string.remove);
    if (file.isFile())
        menu.add(0, R.id.mi_create_shortcut, 0, R.string.create_shortcut);
    // else if(file.isDir())
    // menu.add(0, R.id.mi_remove, 0, R.string.remove);
}

From source file:it.sasabz.android.sasabus.classes.dialogs.SelectFavoritenDialog.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (v.getId() == android.R.id.list) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        menu.setHeaderTitle(list.get(info.position).toString());
        menu.add(Menu.NONE, 0, 0, R.string.delete);
    }/*from ww w. ja va 2 s . com*/
}

From source file:org.totschnig.myexpenses.activity.ManageMethods.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    //predefined methods can not be deleted
    PaymentMethod method;//  w ww  . j  a  va  2  s.  co  m
    method = PaymentMethod.getInstanceFromDb(info.id);
    if (method.predef == null) {
        menu.add(0, R.id.DELETE_COMMAND, 0, R.string.menu_delete);
    }
}