Example usage for android.view Menu CATEGORY_SECONDARY

List of usage examples for android.view Menu CATEGORY_SECONDARY

Introduction

In this page you can find the example usage for android.view Menu CATEGORY_SECONDARY.

Prototype

int CATEGORY_SECONDARY

To view the source code for android.view Menu CATEGORY_SECONDARY.

Click Source Link

Document

Category code for the order integer for items/groups that are user-supplied secondary (infrequently used) options -- or/add this with your base value.

Usage

From source file:com.ovrhere.android.currencyconverter.ui.fragments.MainFragment.java

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

        CurrencyData currency = outputListAdapter.getItem(info.position);
        if (currency != null) {
            String title = getString(R.string.currConv_context_currencyAction, currency.getCurrencyCode());

            menu.setHeaderTitle(title);//from  w  ww. java  2 s . c om
            menu.add(Menu.CATEGORY_SECONDARY, 0, 0, android.R.string.copy);
            menu.add(Menu.CATEGORY_SECONDARY, 1, 1, R.string.currConv_context_detailedCopy);
        }
    }
}

From source file:org.chromium.chrome.browser.preferences.Preferences.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    // By default, every screen in Settings shows a "Help & feedback" menu item.
    MenuItem help = menu.add(Menu.NONE, R.id.menu_id_help_general, Menu.CATEGORY_SECONDARY, R.string.menu_help);
    help.setIcon(R.drawable.ic_help_and_feedback);
    return true;/*from   w w  w.j  a  v a2s .c o  m*/
}

From source file:com.ovrhere.android.currencyconverter.ui.fragments.MainFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    if (item.getGroupId() == Menu.CATEGORY_SECONDARY) {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
        switch (item.getItemId()) {
        case 0:/*from  ww  w  .j  av  a  2 s .  co m*/
            int pos1 = info.position;
            copyConvertedValue(pos1, false);
            break;
        case 1:
            int pos2 = info.position;
            copyConvertedValue(pos2, true);
            break;
        }
    }
    return super.onContextItemSelected(item);
}

From source file:info.staticfree.android.units.Units.java

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

    menu.add(Menu.NONE, MENU_REEDIT, Menu.FIRST, R.string.ctx_menu_reedit);
    menu.add(Menu.NONE, MENU_COPY, Menu.CATEGORY_SYSTEM, android.R.string.copy);
    menu.add(Menu.NONE, MENU_SEND, Menu.CATEGORY_SYSTEM, R.string.ctx_menu_send);
    menu.add(Menu.NONE, MENU_USE_RESULT, Menu.CATEGORY_SECONDARY, R.string.ctx_menu_use_result);

}