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.akop.bach.fragment.xboxlive.GamesFragment.java

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

    AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;

    ViewHolder vh = (ViewHolder) acmi.targetView.getTag();
    menu.setHeaderTitle(vh.title.getText());

    getActivity().getMenuInflater().inflate(R.menu.xbl_game_list_context, menu);
}

From source file:com.github.jobs.ui.fragment.JobListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    FragmentActivity activity = getActivity();
    if (activity == null || !isAdded()) {
        return;// ww w  . jav  a2 s .  c om
    }
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    Job job = mAdapter.getItem(info.position);
    menu.setHeaderTitle(job.getTitle());
    menu.add(0, JOB_DETAILS, 0, R.string.job_details);
    menu.add(0, HOW_TO_APPLY, 0, R.string.how_to_apply);
    menu.add(0, SHARE, 0, R.string.share);
    getTracker(activity).trackEvent(CATEGORY_JOBS, ACTION_OPEN_CONTEXT, mCurrentSearch.getSearch());
}

From source file:net.zionsoft.obadiah.ui.fragments.TranslationListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (v != mTranslationListView) {
        super.onCreateContextMenu(menu, v, menuInfo);
        return;//  ww w. j  ava 2 s.c o  m
    }

    final TranslationInfo translationInfo = getTranslationInfo((AdapterView.AdapterContextMenuInfo) menuInfo);
    if (translationInfo == null || mCurrentTranslation.equals(translationInfo.name)) {
        return;
    }

    menu.setHeaderTitle(translationInfo.name);
    menu.add(Menu.NONE, CONTEXT_MENU_ITEM_DELETE, Menu.NONE, R.string.action_delete_translation);
}

From source file:net.vivekiyer.GAL.CorporateContactRecordFragment.java

/**
 * @param menu/* w  ww. j  a  v a 2s  . c om*/
 * @param v
 * @param menuInfo
 * 
 *            Create a context menu for the list view Depending upon the
 *            item selected, shows the user different options
 */
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

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

    // Get the selected item from the listview adapter
    final KeyValuePair kvp = m_adapter.getItem(info.position);

    // Set the header to the selected text
    menu.setHeaderTitle(kvp.getValue());

    // Add the default options (copy to clipboard)
    menu.add(Menu.NONE, MENU_ID_COPY_TO_CLIPBOARD, Menu.NONE, R.string.copyToClipboard)
            .setIcon(android.R.drawable.ic_menu_view);

    // Handle the special cases
    switch (kvp.get_type()) {
    case EMAIL:
        menu.add(Menu.NONE, MENU_ID_EMAIL, Menu.NONE, R.string.send_email)
                .setIcon(android.R.drawable.sym_action_email);
        break;
    case MOBILE:
        menu.add(Menu.NONE, MENU_ID_SMS, Menu.NONE, getString(R.string.send_sms_to) + kvp.getValue())
                .setIcon(android.R.drawable.ic_menu_send);
    case PHONE:
        menu.add(Menu.NONE, MENU_ID_CALL, Menu.NONE, getString(R.string.call_) + kvp.getValue())
                .setIcon(android.R.drawable.ic_menu_call);
        menu.add(Menu.NONE, MENU_ID_EDIT_BEFORE_CALL, Menu.NONE, R.string.edit_number_before_call)
                .setIcon(android.R.drawable.ic_menu_edit);
    case OTHER:
    case UNDEFINED:
        break;
    }
}

From source file:org.tvheadend.tvhclient.SearchResultActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    getMenuInflater().inflate(R.menu.program_context_menu, menu);
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    program = adapter.getItem(info.position);

    // Set the title of the context menu
    if (program != null) {
        menu.setHeaderTitle(program.title);
    }/*w w w .  j  a  v a  2s.  c o m*/
    //  Show or hide the menu items depending on the program state
    Utils.setProgramMenu(menu, program);
}

From source file:joshuatee.wx.MiscFragment.java

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

    switch (v.getId()) {
    case R.id.iv_10: // STATE
        String state_cur = preferences.getString("STATE_CODE", "");
        menu.add(0, v.getId(), 0, "Edit State (" + state_cur + ")");
        break;//  ww  w  . jav  a  2s.co  m
    case R.id.iv_9: // conus mosaic
        menu.setHeaderTitle("Beta area");
        menu.add(0, v.getId(), 0, "Iowa Mesonet hires conus radar");
        menu.add(0, v.getId(), 0, "SPC Compmap");

        break;
    case R.id.iv_8: // conus mosaic
        menu.setHeaderTitle("Set default sector");
        menu.add(0, v.getId(), 0, "alaska");
        menu.add(0, v.getId(), 0, "hawaii");
        menu.add(0, v.getId(), 0, "pacsouthwest");
        menu.add(0, v.getId(), 0, "pacnorthwest");
        menu.add(0, v.getId(), 0, "southrockies");
        menu.add(0, v.getId(), 0, "northrockies");
        menu.add(0, v.getId(), 0, "uppermissvly");
        menu.add(0, v.getId(), 0, "southplains");
        menu.add(0, v.getId(), 0, "centgrtlakes");
        menu.add(0, v.getId(), 0, "southmissvly");
        menu.add(0, v.getId(), 0, "southeast");
        menu.add(0, v.getId(), 0, "northeast");
        menu.add(0, v.getId(), 0, "conus");
        break;
    case R.id.iv_7: // conus mosaic
        menu.setHeaderTitle("Set default sector");
        menu.add(0, v.getId(), 0, "alaska");
        menu.add(0, v.getId(), 0, "hawaii");
        menu.add(0, v.getId(), 0, "pacsouthwest");
        menu.add(0, v.getId(), 0, "pacnorthwest");
        menu.add(0, v.getId(), 0, "southrockies");
        menu.add(0, v.getId(), 0, "northrockies");
        menu.add(0, v.getId(), 0, "uppermissvly");
        menu.add(0, v.getId(), 0, "southplains");
        menu.add(0, v.getId(), 0, "centgrtlakes");
        menu.add(0, v.getId(), 0, "southmissvly");
        menu.add(0, v.getId(), 0, "southeast");
        menu.add(0, v.getId(), 0, "northeast");
        menu.add(0, v.getId(), 0, "conus");
        break;
    case R.id.iv_1:
        menu.add(0, v.getId(), 0, "COD Model Web");
        break;

    }

}

From source file:de.electricdynamite.pasty.ClipboardFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    if (v.getId() == R.id.listItems || v.getId() == R.id.listItemText) {
        menu.setHeaderTitle(getString(R.string.itemContextMenuTitle));
        String[] menuItems = getResources().getStringArray(R.array.itemContextMenu);
        ClipboardItem mItem = mAdapter.getItem(info.position);
        if (mItem.isLinkified()) {
            /* Item was Linkified.
             * Let's add a "open in browser" menuItem
             *//* www  .j  av  a  2  s.c  o m*/
            menu.add(Menu.NONE, PastySharedStatics.ITEM_CONTEXTMENU_OPEN_ID, 0, R.string.itemContextMenu_open);
        }
        for (int i = 0; i < menuItems.length; i++) {
            menu.add(Menu.NONE, i, i, menuItems[i]);
        }
    }
}

From source file:net.czlee.debatekeeper.PrepTimeBellsEditActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    String title = getString(R.string.prepTimeBellsEditor_contextMenu_header,
            mPtbm.getBellDescription(info.position));
    menu.setHeaderTitle(title);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.prep_time_bells_list_context, menu);
}

From source file:org.restcomm.android.olympus.MainFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (v.getId() == android.R.id.list) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

        //menu.setHeaderTitle("Edit " + contactList.get(info.position).get(CONTACT_KEY));
        // TODO: pretty bad logic, let's revisit this at some point so that we can use style resources instead
        menu.setHeaderTitle(Html.fromHtml("<font color='#DF3D00'>Settings</font>"));

        menu.add("Update Contact");
        menu.add("Remove Contact");
    }//ww w.j  a v a  2s . co m
}

From source file:de.eidottermihi.rpicheck.activity.CustomCommandActivity.java

@Override
public void onCreateContextMenu(final ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.commandListView) {
        final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        LOGGER.debug("Creating context menu for command id = {}.", info.id);
        CommandBean cmd = deviceDb.readCommand(info.id);
        menu.setHeaderTitle(cmd.getName());
        menu.add(Menu.NONE, 1, 1, R.string.command_context_edit);
        menu.add(Menu.NONE, 2, 2, R.string.command_context_delete);
        menu.add(Menu.NONE, 3, 3, R.string.command_context_run);

    }//ww w .  ja  v  a  2 s .c  o  m
    super.onCreateContextMenu(menu, v, menuInfo);
}