Example usage for android.view ContextMenu setHeaderTitle

List of usage examples for android.view ContextMenu setHeaderTitle

Introduction

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

Prototype

public ContextMenu setHeaderTitle(CharSequence title);

Source Link

Document

Sets the context menu header's title to the title given in title.

Usage

From source file:com.cl.slack.gesture.GestureBuilderActivity.java

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

    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    menu.setHeaderTitle(((TextView) info.targetView).getText());

    menu.add(0, MENU_ID_RENAME, 0, R.string.gestures_rename);
    menu.add(0, MENU_ID_REMOVE, 0, R.string.gestures_delete);
}

From source file:ics4u.ics4u_final_project.RecipeCreateActivity.java

/**
 * Creates context menu to allow user to choose icon
 * Context menus are the pop up menus//w w w.  j  a  v  a2s  . c o  m
 *
 * @param menu
 * @param v
 * @param menuInfo
 */
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    //Inflate menu with values in corresponding menu xml file
    MenuInflater inflater = getMenuInflater();
    //Set header
    menu.setHeaderTitle("Change recipe icon");
    inflater.inflate(R.menu.menu_icon, menu);
}

From source file:org.hedgewars.hedgeroid.RoomPlayerlistFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    String playerName = adapter.getItem(info.position).player.name;

    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.room_playerlist_context, menu);
    if (netplay.isChief() && !playerName.equals(netplay.getPlayerName())) {
        inflater.inflate(R.menu.room_playerlist_chief_context, menu);
    }// w  ww  . j  a  va2s  .c o m
    menu.setHeaderIcon(R.drawable.human);
    menu.setHeaderTitle(playerName);
}

From source file:com.money.manager.ex.account.AccountListFragment.java

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

    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

    // get selected item name
    SimpleCursorAdapter adapter = (SimpleCursorAdapter) getListAdapter();
    Cursor cursor = (Cursor) adapter.getItem(info.position);
    menu.setHeaderTitle(cursor.getString(cursor.getColumnIndex(Account.ACCOUNTNAME)));

    MenuHelper menuHelper = new MenuHelper(getActivity(), menu);
    menuHelper.addEditToContextMenu();/*from  ww w .j  a v  a2  s  .com*/
    menuHelper.addDeleteToContextMenu();
}

From source file:org.tunesremote.AllAlbumsListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    try {/*w w  w .  j a va2  s  . c  om*/
        host.getMenuInflater().inflate(R.menu.context_albums, menu);
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        Response resp = (Response) adapter.getItem(info.position);
        menu.setHeaderTitle(resp.getString("minm"));

    } catch (Exception e) {
        Log.w(TAG, "onCreateContextMenu:" + e.getMessage());
    }
}

From source file:de.jan.ledgerjournal.JournalActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    if (v.getId() == R.id.journalListView) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        Transaction t = journal.get(info.position);
        menu.setHeaderTitle(t.date + "\t" + t.payee);

        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.context_journal, menu);
        if (topfId == JournalDbHelper.TEMPLATE_TOPFID)
            menu.removeItem(R.id.context_journal_template);
    }/*from w  w w  .ja v a 2 s. com*/
}

From source file:bander.notepad.NoteListAppCompat.java

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    AdapterView.AdapterContextMenuInfo info;
    try {// w w w .j a  v a  2  s . c  om
        info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    } catch (ClassCastException e) {
        return;
    }

    Cursor cursor = (Cursor) getListAdapter().getItem(info.position);
    if (cursor == null) {
        return;
    }

    menu.setHeaderTitle(cursor.getString(COLUMN_INDEX_TITLE));

    Uri uri = ContentUris.withAppendedId(getIntent().getData(), cursor.getInt(COLUMN_INDEX_ID));

    Intent[] specifics = new Intent[1];
    specifics[0] = new Intent(Intent.ACTION_EDIT, uri);
    MenuItem[] items = new MenuItem[1];

    Intent intent = new Intent(null, uri);
    intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
    menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, null, specifics, intent, 0, items);

    menu.add(0, DELETE_ID, 0, R.string.menu_delete);
    // TODO: When you click on this, it crashes. I commented it out for now.
    // menu.add(0, SEND_ID, 0, R.string.menu_send);
}

From source file:com.remdo.app.MainActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.deviceList) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        menu.setHeaderTitle(devices[info.position]);
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.context_device_config, menu);
    }/*  w w w.ja va 2s .  c  om*/
    if (v.getId() == R.id.tv_geo_footer) {
        DialogFragment newdialog = new ServiceConfigFragment();
        Bundle args = new Bundle();
        args.putInt("service", R.id.tv_geo_footer);
        args.putInt("minutes", dm.getServcieMinutes("Geo"));
        newdialog.setArguments(args);
        newdialog.show(getSupportFragmentManager(), null);

    }
    if (v.getId() == R.id.tv_alerts_footer) {
        DialogFragment newdialog = new ServiceConfigFragment();
        Bundle args = new Bundle();
        args.putInt("service", R.id.tv_alerts_footer);
        args.putInt("minutes", dm.getServcieMinutes("Alerts"));
        newdialog.setArguments(args);
        newdialog.show(getSupportFragmentManager(), null);

    }
}

From source file:prince.app.sphotos.Fragment_Albums.java

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

    // set the contextual menu header
    menu.setHeaderTitle(FBINIT.sAlbumsArray.get(info.position).mAlbumName);

    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.album_menu, menu);

    // hide add photos if we cannot upload to this album
    if (!FBINIT.sAlbumsArray.get(info.position).mAlbumUpload) {
        menu.removeItem(R.id.album_add);
    }//from w  ww.  j av  a2  s  . c  o m
}

From source file:com.money.manager.ex.fragment.PayeeListFragment.java

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

    Cursor cursor = ((SimpleCursorAdapter) getListAdapter()).getCursor();
    cursor.moveToPosition(info.position);
    menu.setHeaderTitle(cursor.getString(cursor.getColumnIndex(Payee.PAYEENAME)));

    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));
}