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:org.h4des.alertrmobilemanager.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    // generating exit button in the menu
    menu.add(Menu.NONE, 0, Menu.NONE, "Exit Application");
    menu.add(Menu.NONE, 1, Menu.NONE, "Settings");
    return true;/*from  w w  w  . j  a v  a2 s  .  co  m*/
}

From source file:com.android.talkback.menurules.RuleViewPager.java

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

    AccessibilityNodeInfoCompat pagerNode = null;

    try {/*  ww  w .j av a2  s. c o m*/
        pagerNode = AccessibilityNodeInfoUtils.getSelfOrMatchingAncestor(node, FILTER_PAGED);
        if (pagerNode == null) {
            return items;
        }

        if (AccessibilityNodeInfoUtils.supportsAnyAction(pagerNode,
                AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD)) {
            final ContextMenuItem prevPage = menuItemBuilder.createMenuItem(service, Menu.NONE,
                    R.id.viewpager_breakout_prev_page, Menu.NONE,
                    service.getString(R.string.title_viewpager_breakout_prev_page));
            items.add(prevPage);
        }

        if (AccessibilityNodeInfoUtils.supportsAnyAction(pagerNode,
                AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD)) {
            final ContextMenuItem nextPage = menuItemBuilder.createMenuItem(service, Menu.NONE,
                    R.id.viewpager_breakout_next_page, Menu.NONE,
                    service.getString(R.string.title_viewpager_breakout_next_page));
            items.add(nextPage);
        }

        if (items.isEmpty()) {
            return items;
        }

        final AccessibilityNodeInfoCompat pagerNodeClone = AccessibilityNodeInfoCompat.obtain(pagerNode);
        final ViewPagerItemClickListener itemClickListener = new ViewPagerItemClickListener(pagerNodeClone);
        for (ContextMenuItem item : items) {
            item.setOnMenuItemClickListener(itemClickListener);
        }

        return items;
    } finally {
        AccessibilityNodeInfoUtils.recycleNodes(pagerNode);
    }
}

From source file:android.example.com.animationdemos.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  www  .j  a v  a 2  s .  co m
}

From source file:com.android.talkback.menurules.RuleSeekBar.java

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

    if (node != null) {
        final ContextMenuItem setLevel = menuItemBuilder.createMenuItem(service, Menu.NONE,
                R.id.seekbar_breakout_set_level, Menu.NONE, service.getString(R.string.title_seek_bar_edit));
        setLevel.setOnMenuItemClickListener(new SeekBarDialogManager(service, node));
        setLevel.setSkipRefocusEvents(true);
        items.add(setLevel);//  w  ww.  j a v  a2 s .  c o  m
    }

    return items;
}

From source file:com.zyq.uitoucheventtest.animator.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.mipmap.ic_action_photo : R.mipmap.ic_action_info);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    return true;// w  w  w .  j a  v  a 2  s  .  c o m
}

From source file:cz.msebera.unbound.dns.fragments.UnboundConfiguration.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(Menu.NONE, MENU_SAVE, Menu.NONE, R.string.menu_save_changes)
            .setIcon(android.R.drawable.ic_menu_save).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:cn.androidy.materialdesignsample.animations.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  ww w . j av  a 2 s  .c  o m*/
}

From source file:org.randoomz.learnit.ui.MainActivity.java

@Override
protected void onResume() {
    super.onResume();
    subscribe = db.createQuery(Language.TABLE, Language.ALL_QUERY).map(Language.MAP)
            .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Action1<List<Language>>() {
                @Override/*  w w w.  jav  a2  s.  c o m*/
                public void call(List<Language> languages) {
                    MainActivity.this.languages = languages;
                    final MenuItem item = navigationView.getMenu().findItem(R.id.languages);
                    final SubMenu subMenuLanguages = item.getSubMenu();
                    subMenuLanguages.clear();
                    for (int i = 0; i < languages.size(); i++) {
                        subMenuLanguages.add(Menu.NONE, i, i, languages.get(i).language()).setCheckable(true);
                    }
                    onNavigationItemSelected(subMenuLanguages.getItem(currentPosition));
                }
            });
}

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, INCREASE_ID, Menu.NONE, "Increase Font");
    menu.add(Menu.NONE, DECREASE_ID, Menu.NONE, "Decrease Font");
    if (!favorite)
        menu.add(Menu.NONE, FAVORITE_ID, Menu.NONE, "Add to Favorites");
    return true;/*  w  ww . j a v a  2 s.  com*/
}

From source file:org.alfresco.mobile.android.application.fragments.activitystream.ActivityFeedAdapter.java

public void getMenu(Menu menu, ActivityEntry entry) {
    if (entry.getCreatedBy() != null) {
        menu.add(Menu.NONE, R.id.menu_activity_profile, Menu.FIRST,
                String.format(getContext().getString(R.string.activity_profile), entry.getCreatedBy()));
    }/* www  .  j  av a2  s  .co  m*/
}