Example usage for android.view Menu FIRST

List of usage examples for android.view Menu FIRST

Introduction

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

Prototype

int FIRST

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

Click Source Link

Document

First value for group and item identifier integers.

Usage

From source file:org.csp.everyaware.offline.Map.java

/*************************** OPTION MENU ***************************************************/

public boolean onCreateOptionsMenu(Menu menu) {
    String[] menuItems = getResources().getStringArray(R.array.map_optionmenu);

    SubMenu mapSubMenu = menu.addSubMenu("Map Modes").setIcon(android.R.drawable.ic_menu_mapmode);

    mapSubMenu.add(1, Menu.FIRST, Menu.FIRST, "Hybrid").setCheckable(false);
    mapSubMenu.add(1, Menu.FIRST + 1, Menu.FIRST, "Normal").setCheckable(false);
    mapSubMenu.add(1, Menu.FIRST + 2, Menu.FIRST + 2, "Satellite").setCheckable(false);
    mapSubMenu.add(1, Menu.FIRST + 3, Menu.FIRST + 3, "Terrain").setCheckable(false);

    return super.onCreateOptionsMenu(menu);
}

From source file:org.csp.everyaware.offline.Map.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();

    switch (itemId) {
    case Menu.FIRST:
        mGoogleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
        break;/*  w ww .  j  a  va  2  s.  c  o m*/
    case Menu.FIRST + 1:
        mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
        break;
    case Menu.FIRST + 2:
        mGoogleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
        break;
    case Menu.FIRST + 3:
        mGoogleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
        break;
    }
    return true;
}

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

public void getMenu(Context context, AlfrescoSession session, Menu menu, Node node) {
    MenuItem mi;/* w w w  . ja v a2 s .  com*/

    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(), getSession(), node,
                        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 (!(session instanceof CloudSession) && ConfigurableActionHelper.isVisible(getActivity(),
                getAccount(), getSession(), node, 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 (session == null) {
        return;
    }

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

    if (node.hasAspect(ContentModel.ASPECT_GEOGRAPHIC)) {
        mi = menu.add(Menu.NONE, R.id.menu_action_location, Menu.FIRST + 50, R.string.geolocation);
        mi.setIcon(R.drawable.ic_location);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }

    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_NEVER);
    }
}

From source file:com.google.appinventor.components.runtime.Form.java

public void addExitButtonToMenu(Menu menu) {
    MenuItem stopApplicationItem = menu.add(Menu.NONE, Menu.NONE, Menu.FIRST, "Stop this application")
            .setOnMenuItemClickListener(new OnMenuItemClickListener() {
                public boolean onMenuItemClick(MenuItem item) {
                    showExitApplicationNotification();
                    return true;
                }//  w  w  w  .j  a  v  a2  s .  c  om
            });
    stopApplicationItem.setIcon(android.R.drawable.ic_notification_clear_all);
}