Example usage for android.view ContextMenu setHeaderIcon

List of usage examples for android.view ContextMenu setHeaderIcon

Introduction

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

Prototype

public ContextMenu setHeaderIcon(Drawable icon);

Source Link

Document

Sets the context menu header's icon to the icon given in icon Drawable .

Usage

From source file:org.sigimera.app.android.CrisesListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    menu.setHeaderTitle("Options");
    menu.setHeaderIcon(R.drawable.sigimera_logo);
    MenuInflater inflater = new MenuInflater(getActivity());
    inflater.inflate(R.menu.list_menu, menu);
}

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

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.lobby_playerlist_context, menu);
    menu.setHeaderIcon(R.drawable.human);
    menu.setHeaderTitle(adapter.getItem(info.position).name);
}

From source file:com.raja.knowme.FragmentContact.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    //if(isCallMenu) {
    //   menu.setHeaderIcon(R.drawable.ic_call);
    //   menu.setHeaderTitle(R.string.call_me);
    //   for(int count = 0; count < mConatctsData.getPhoneNumbers().length; count++)
    //   menu.add(0, v.getId(), 0, mConatctsData.getPhoneNumbers()[count]);
    //   } else// w  w w. j  av a2s .com
    {
        menu.setHeaderIcon(R.drawable.mb);
        menu.setHeaderTitle(R.string.mail_me);
        for (int count = 0; count < mConatctsData.getEmailAddress().length; count++)
            menu.add(0, v.getId(), 0, mConatctsData.getEmailAddress()[count]);
    }
}

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);
    }/*from  w ww  . ja v  a  2 s.c  om*/
    menu.setHeaderIcon(R.drawable.human);
    menu.setHeaderTitle(playerName);
}

From source file:com.abcvoipsip.ui.account.AccountsEditListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    final SipProfile account = profileFromContextMenuInfo(menuInfo);
    if (account == null) {
        return;/* w ww  .  ja  va 2  s .c om*/
    }
    WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard);

    // Setup the menu header
    menu.setHeaderTitle(account.display_name);
    menu.setHeaderIcon(wizardInfos.icon);

    // Add a menu item to delete the note
    menu.add(0, MENU_ITEM_ACTIVATE, 0,
            account.active ? R.string.deactivate_account : R.string.activate_account);
    menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account);
    menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account);
    menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard);

}

From source file:moe.johnny.tombstone.ui.PreventFragment.java

private void setHeaderIcon(ContextMenu menu, Drawable icon) {
    int width = getHeaderIconWidth();
    if (icon.getMinimumWidth() <= width) {
        menu.setHeaderIcon(icon);
    } else if (icon instanceof BitmapDrawable) {
        Bitmap bitmap = Bitmap.createScaledBitmap(((BitmapDrawable) icon).getBitmap(), width, width, false);
        menu.setHeaderIcon(new BitmapDrawable(getResources(), bitmap));
    }/*from ww w .ja  va2s.  co m*/
}

From source file:de.syss.MifareClassicTool.Activities.MainMenu.java

/**
 * Add the menu with the tools.//from   ww w .  ja  va 2  s  .  c  om
 * It will be shown if the user clicks on "Tools".
 */
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = getMenuInflater();
    menu.setHeaderTitle(R.string.dialog_tools_menu_title);
    menu.setHeaderIcon(android.R.drawable.ic_menu_preferences);
    inflater.inflate(R.menu.tools, menu);
    // Enable/Disable tag info tool depending on NFC availability.
    menu.findItem(R.id.menuMainTagInfo)
            .setEnabled(Common.hasMifareClassicSupport() && !Common.useAsEditorOnly());
    // Enable/Disable diff tool depending on write permissions.
    menu.findItem(R.id.menuMainDiffTool).setEnabled(Common.hasWritePermissionToExternalStorage(this));
}

From source file:com.csipsimple.ui.account.AccountsEditListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    final SipProfile account = profileFromContextMenuInfo(menuInfo);
    if (account == null) {
        return;//from  ww w . ja  v  a2  s .co  m
    }
    WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard);

    // Setup the menu header
    menu.setHeaderTitle(account.display_name);
    if (wizardInfos != null) {
        menu.setHeaderIcon(wizardInfos.icon);
    }

    menu.add(0, MENU_ITEM_ACTIVATE, 0,
            account.active ? R.string.deactivate_account : R.string.activate_account);
    menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account);
    menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account);
    menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard);

}

From source file:com.sip.pwc.sipphone.ui.account.AccountsEditListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    final SipProfile account = profileFromContextMenuInfo(menuInfo);
    if (account == null) {
        return;/*from w ww.  j  a va2s .  c  o m*/
    }
    WizardUtils.WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard);

    // Setup the menu header
    menu.setHeaderTitle(account.display_name);
    if (wizardInfos != null) {
        menu.setHeaderIcon(wizardInfos.icon);
    }

    menu.add(0, MENU_ITEM_ACTIVATE, 0,
            account.active ? R.string.deactivate_account : R.string.activate_account);
    menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account);
    menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account);
    menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard);

}

From source file:net.voxcorp.voxmobile.ui.account.AccountsEditListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    final SipProfile account = profileFromContextMenuInfo(menuInfo);
    if (account == null) {
        return;/*w  w  w  .  j  a  v a  2  s.co  m*/
    }
    WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard);

    // Setup the menu header
    menu.setHeaderTitle(account.display_name);
    if (wizardInfos != null) {
        menu.setHeaderIcon(wizardInfos.icon);
    }

    menu.add(0, MENU_ITEM_ACTIVATE, 0,
            account.active ? R.string.deactivate_account : R.string.activate_account);
    menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account);
    menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account);
    if (!VoXMobile.isVoXMobile(account.proxies)) {
        menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard);
    }

}