Example usage for android.view Menu NONE

List of usage examples for android.view Menu NONE

Introduction

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

Prototype

int NONE

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

Click Source Link

Document

Value to use for group and item identifier integers when you don't care about them.

Usage

From source file:com.keithandthegirl.ui.activity.EpisodesActivity.java

@TargetApi(11)
@Override//from  w  w w.j a  v a 2s.co m
public boolean onCreateOptionsMenu(Menu menu) {
    Log.d(TAG, "onCreateOptionsMenu : enter");

    MenuItem settings = menu.add(Menu.NONE, SETTINGS_ID, Menu.NONE,
            getResources().getString(R.string.pref_settings_title));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        settings.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }

    MenuItem about = menu.add(Menu.NONE, ABOUT_ID, Menu.NONE, getResources().getString(R.string.about_header));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        about.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }

    Log.d(TAG, "onCreateOptionsMenu : exit");
    return super.onCreateOptionsMenu(menu);
}

From source file:com.mifos.mifosxdroid.online.DataTableDataFragment.java

@SuppressWarnings("deprecation")
@Override/*from  w  w w . j  av a 2s.c o  m*/
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    MenuItem menuItemAddNewEntryToDataTable = menu.add(Menu.NONE, MEUN_ITEM_ADD_NEW_ENTRY, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewEntryToDataTable.setIcon(getResources().getDrawable(R.drawable.ic_action_content_new));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        menuItemAddNewEntryToDataTable.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
    super.onPrepareOptionsMenu(menu);
}

From source file:tw.com.geminihsu.app01.fragment.Fragment_OrderFilter.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem item = menu.add(Menu.NONE, ACTIONBAR_MENU_ITEM_FINISH, Menu.NONE, getString(R.string.btn_finish));
    SpannableString spanString = new SpannableString(item.getTitle().toString());
    spanString.setSpan(new ForegroundColorSpan(Color.WHITE), 0, spanString.length(), 0); //fix the color to white
    item.setTitle(spanString);//from ww w  .j av a  2 s.c o m
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.commonsware.android.arXiv.DownloadsActivity.java

private void populateMenu(Menu menu) {
    menu.add(Menu.NONE, CLEAR_ID, Menu.NONE, R.string.clear_history);
}

From source file:com.android.screenspeak.menurules.RuleCustomAction.java

@Override
public List<ContextMenuItem> getMenuItemsForNode(ScreenSpeakService service,
        ContextMenuItemBuilder menuItemBuilder, AccessibilityNodeInfoCompat node) {
    List<ContextMenuItem> menu = new LinkedList<>();

    for (AccessibilityActionCompat action : AccessibilityNodeInfoUtils.getCustomActions(node)) {
        CharSequence label = action.getLabel();
        int id = action.getId();
        if (TextUtils.isEmpty(label)) {
            continue;
        }//from  www.java  2 s  . c  om

        ContextMenuItem item = menuItemBuilder.createMenuItem(service, Menu.NONE, id, Menu.NONE, label);
        item.setOnMenuItemClickListener(new CustomMenuItem(id, AccessibilityNodeInfoCompat.obtain(node)));
        item.setCheckable(false);
        menu.add(item);
    }

    return menu;
}

From source file:org.alfresco.mobile.android.application.fragments.search.HistorySearchActions.java

protected void getMenu(FragmentActivity activity, Menu menu) {
    SubMenu createMenu;//from ww w.j a va 2 s. co m

    createMenu = menu.addSubMenu(Menu.NONE, R.id.menu_historysearch_delete, Menu.FIRST, R.string.delete);
    createMenu.setIcon(R.drawable.ic_delete);
    createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}

From source file:org.getlantern.firetweet.menu.SupportAccountActionProvider.java

@Override
public void onPrepareSubMenu(final SubMenu subMenu) {
    subMenu.removeGroup(MENU_GROUP);//from w  w  w. j  ava 2  s  .  c om
    if (mAccounts == null)
        return;
    for (int i = 0, j = mAccounts.length; i < j; i++) {
        final ParcelableAccount account = mAccounts[i];
        final MenuItem item = subMenu.add(MENU_GROUP, Menu.NONE, i, account.name);
        final Intent intent = new Intent();
        intent.putExtra(EXTRA_ACCOUNT, account);
        item.setIntent(intent);
    }
    subMenu.setGroupCheckable(MENU_GROUP, true, mExclusive);
    if (mAccountIds == null)
        return;
    for (int i = 0, j = subMenu.size(); i < j; i++) {
        final MenuItem item = subMenu.getItem(i);
        if (ArrayUtils.contains(mAccountIds, mAccounts[i].account_id)) {
            item.setChecked(true);
        }
    }
}

From source file:com.mifos.mifosxdroid.online.DocumentListFragment.java

@SuppressWarnings("deprecation")
@Override//from  w  w  w .  java2  s.c o m
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    MenuItem menuItemAddNewDocument = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_DOCUMENT, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewDocument.setIcon(getResources().getDrawable(R.drawable.ic_action_content_new));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        menuItemAddNewDocument.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    super.onPrepareOptionsMenu(menu);
}

From source file:com.example.cardflipanimation.CardFlipActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    // Add either a "photo" or "finish" button to the action bar, depending
    // on which page
    // is currently selected.
    MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE,
            mShowingBack ? R.string.action_photo : R.string.action_info);
    item.setIcon(mShowingBack ? R.drawable.ic_action_photo : R.drawable.ic_action_info);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    return true;//from   w  w  w.j a  v a  2  s .  c o  m
}

From source file:gxu.software_engineering.market.android.ui.UsersFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem populateItem = menu.add(Menu.NONE, 1, 0, "Populate");
    MenuItemCompat.setShowAsAction(populateItem, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    MenuItem clearItem = menu.add(Menu.NONE, 2, 0, "Clear");
    MenuItemCompat.setShowAsAction(clearItem, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
}