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.team.agita.langeo.ActivitySlideShow.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.activity_screen_slide, menu);

    menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() >= 0);

    // Add either a "next" or "finish" button to the action bar, depending on which page
    // is currently selected.
    MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE,
            (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish
                    : R.string.action_next);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;/*from   w  w w  .java2 s  .com*/
}

From source file:android.example.com.animationdemos.ScreenSlideActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.activity_screen_slide, menu);
    menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0);
    // Add either a "next" or "finish" button to the action bar, depending on which page
    // is currently selected.
    MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE,
            (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish
                    : R.string.action_next);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;/*w ww.  j  av a 2s .c  o  m*/
}

From source file:net.sourceforge.servestream.activity.OrganizeUrlsActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    TypedArray drawables = obtainStyledAttributes(new int[] { R.attr.navigation_accept });
    MenuItem item = menu.add(Menu.NONE, MENU_ID_ACCEPT, Menu.NONE, R.string.confirm_label);
    item.setIcon(drawables.getDrawable(0));
    MenuItemCompat.setShowAsAction(item,
            MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
    return true;//w w  w  .j a  va 2  s  . c  o  m
}

From source file:com.gh4a.activities.IssueListMineActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    int resIdState = Constants.Issue.STATE_OPEN.equals(mState) ? R.string.issues_menu_show_closed
            : R.string.issues_menu_show_open;
    MenuItem item = menu.add(Menu.NONE, Menu.FIRST + 1, Menu.NONE, resIdState);
    MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    return super.onCreateOptionsMenu(menu);
}

From source file:com.tastycactus.timesheet.TimeEntriesActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.add(Menu.NONE, DELETE_TIME_ENTRY_MENU_ITEM, Menu.NONE, "Delete Time Entry");
    menu.add(Menu.NONE, EDIT_TIME_ENTRY_MENU_ITEM, Menu.NONE, "Edit Time Entry");
}

From source file:com.gh4a.activities.Github4AndroidActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem item = menu.add(Menu.NONE, Menu.FIRST, Menu.NONE, R.string.login);
    MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    return super.onCreateOptionsMenu(menu);
}

From source file:com.gsc.testing.espresso.espressotesting.ScreenSlideActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    //        getMenuInflater().inflate(R.menu.activity_screen_slide, menu);

    menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0);

    // Add either a "next" or "finish" button to the action bar, depending on which page
    // is currently selected.
    MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE,
            (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish
                    : R.string.action_next);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;//w  w w.j  av  a  2s  .c  o  m
}

From source file:org.chromium.chrome.browser.preferences.website.UsbChooserPreferences.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();/* w ww .  java2s .c  o  m*/
    inflater.inflate(R.menu.website_preferences_menu, menu);

    MenuItem searchItem = menu.findItem(R.id.search);
    mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    mSearchView.setImeOptions(EditorInfo.IME_FLAG_NO_FULLSCREEN);
    SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return true;
        }

        @Override
        public boolean onQueryTextChange(String query) {
            // Make search case-insensitive.
            query = query.toLowerCase();

            if (query.equals(mSearch))
                return true;

            mSearch = query;
            getInfo();
            return true;
        }
    };
    mSearchView.setOnQueryTextListener(queryTextListener);

    MenuItem help = menu.add(Menu.NONE, R.id.menu_id_targeted_help, Menu.NONE, R.string.menu_help);
    help.setIcon(R.drawable.ic_help_and_feedback);
}

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

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

    if (Role.getRole(node) == Role.ROLE_EDIT_TEXT) {
        WindowManager windowManager = new WindowManager(service.isScreenLayoutRTL());
        windowManager.setWindows(service.getWindows());
        AccessibilityWindowInfo anchoredWindow = windowManager.getAnchoredWindow(node);
        if (anchoredWindow != null) {
            final ContextMenuItem viewSuggestions = menuItemBuilder.createMenuItem(service, Menu.NONE,
                    R.id.suggestions_breakout_suggestions, Menu.NONE,
                    service.getString(R.string.title_suggestions_breakout_suggestions));
            viewSuggestions.setOnMenuItemClickListener(
                    new ViewSuggestionsItemClickListener(AccessibilityNodeInfoCompat.obtain(node), service));
            viewSuggestions.setSkipRefocusEvents(true);
            items.add(viewSuggestions);// w ww  .  jav a  2 s  .co  m
        }
    }

    AccessibilityNodeInfoCompat anchor = AccessibilityNodeInfoUtils.getAnchor(node);
    if (anchor != null) {
        if (Role.getRole(anchor) == Role.ROLE_EDIT_TEXT) {
            final ContextMenuItem returnToAnchor = menuItemBuilder.createMenuItem(service, Menu.NONE,
                    R.id.suggestions_breakout_anchor, Menu.NONE,
                    service.getString(R.string.title_suggestions_breakout_anchor));
            returnToAnchor.setOnMenuItemClickListener(new ReturnToAnchorItemClickListener(anchor, service));
            returnToAnchor.setSkipRefocusEvents(true);
            items.add(returnToAnchor);
            // Don't recycle anchor here because we gave it to the listener.
        } else {
            anchor.recycle();
        }
    }

    return items;
}

From source file:org.alfresco.mobile.android.application.fragments.node.details.NodeDetailsActionMode.java

protected void getMenu(FragmentActivity activity, Menu menu) {
    if (selectedItems.isEmpty() || selectedItems.size() > 1) {
        return;/*w  w  w .  j  a  v a  2  s. c o m*/
    }

    MenuItem mi;
    Node node = getCurrentItem();
    if (node == null) {
        return;
    }
    if (node instanceof NodeSyncPlaceHolder) {
        return;
    }

    boolean isRestrict = node.hasAspect(ContentModel.ASPECT_RESTRICTABLE);

    if (node.isDocument()) {
        if (((Document) node).getContentStreamLength() > 0 && !isRestrict && ConfigurableActionHelper
                .isVisible(getActivity(), getAccount(), ConfigurableActionHelper.ACTION_NODE_DOWNLOAD)) {
            mi = menu.add(Menu.NONE, R.id.menu_action_download, Menu.FIRST, R.string.download);
            mi.setIcon(R.drawable.ic_download_light);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (((Document) node).isLatestVersion() && ConfigurableActionHelper.isVisible(getActivity(),
                getAccount(), getSession(), node, ConfigurableActionHelper.ACTION_NODE_UPDATE)) {
            mi = menu.add(Menu.NONE, R.id.menu_action_update, Menu.FIRST + 130, R.string.update);
            mi.setIcon(R.drawable.ic_upload);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (!(SessionUtils.getSession(activity) instanceof CloudSession) && ConfigurableActionHelper
                .isVisible(getActivity(), getAccount(), ConfigurableActionHelper.ACTION_NODE_REVIEW)) {
            mi = menu.add(Menu.NONE, R.id.menu_workflow_add, Menu.FIRST + 500, R.string.process_start_review);
            mi.setIcon(R.drawable.ic_start_review);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }
    }

    if (ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node,
            ConfigurableActionHelper.ACTION_NODE_EDIT)) {
        mi = menu.add(Menu.NONE, R.id.menu_action_edit, Menu.FIRST + 50, R.string.edit);
        mi.setIcon(R.drawable.ic_properties);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    if (ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node,
            ConfigurableActionHelper.ACTION_NODE_DELETE)) {
        mi = menu.add(Menu.NONE, R.id.menu_action_delete, Menu.FIRST + 1000, R.string.delete);
        mi.setIcon(R.drawable.ic_delete);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
}