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: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);

}

From source file:org.alfresco.mobile.android.application.accounts.fragment.AccountDetailsFragment.java

public void getMenu(Menu menu) {
    MenuItem mi;/*  ww  w  .j av a2 s.c om*/

    if (acc.getActivation() == null) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_ACCOUNT_EDIT,
                Menu.FIRST + MenuActionItem.MENU_ACCOUNT_EDIT,
                String.format(getString(R.string.account_edit_hint), acc.getDescription()));
        mi.setIcon(R.drawable.ic_edit);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    mi = menu.add(Menu.NONE, MenuActionItem.MENU_ACCOUNT_DELETE,
            Menu.FIRST + MenuActionItem.MENU_ACCOUNT_DELETE,
            String.format(getString(R.string.account_delete_hint), acc.getDescription()));
    mi.setIcon(R.drawable.ic_delete);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}

From source file:org.alfresco.mobile.android.application.extension.samsung.pen.SNoteEditorActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    toolsSubMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TOOLS, Menu.FIRST,
            R.string.editor_tools);/*www  .  j  a  va2  s . co m*/
    toolsSubMenu.setIcon(R.drawable.ic_edit);
    toolsSubMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    // TOOLS MENU
    MenuItem mi = toolsSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PEN,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PEN, R.string.editor_pen);
    mi.setIcon(R.drawable.ic_edit);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    mi = toolsSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TEXT,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_TEXT, R.string.editor_text);
    mi.setIcon(R.drawable.ic_text);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    mi = toolsSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SELECTION,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SELECTION, R.string.editor_selection);
    mi.setIcon(R.drawable.ic_selection);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    mi = toolsSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_ERASER,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_ERASER, R.string.editor_eraser);
    mi.setIcon(R.drawable.ic_eraser);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    // TOOL SETTINGS MENU
    SubMenu toolsSettingSubMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS, R.string.editor_tools_settings);
    toolsSettingSubMenu.setIcon(R.drawable.ic_action_settings);
    toolsSettingSubMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    mi = toolsSettingSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS_PEN,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS_PEN, R.string.editor_pen);
    mi.setIcon(R.drawable.ic_edit);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    mi = toolsSettingSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS_TEXT,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS_TEXT, R.string.editor_text);
    mi.setIcon(R.drawable.ic_text);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    mi = toolsSettingSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS_SELECTION,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS_SELECTION, R.string.editor_selection);
    mi.setIcon(R.drawable.ic_selection);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    mi = toolsSettingSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS_ERASER,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS_ERASER, R.string.editor_eraser);
    mi.setIcon(R.drawable.ic_eraser);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    // ADD MENU
    SubMenu addSubMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_ADD,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_ADD, R.string.editor_add_menu);
    addSubMenu.setIcon(R.drawable.ic_add);
    addSubMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    // IMAGE
    mi = addSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_ADD_IMAGE,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_ADD_IMAGE, R.string.editor_add_image);
    mi.setIcon(R.drawable.ic_add_image);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    // PAGES
    SubMenu pagesMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PAGE,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PAGE, R.string.editor_pages);
    pagesMenu.setIcon(R.drawable.ic_pages);
    pagesMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    mi = pagesMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PAGE_MOVE,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PAGE_MOVE, R.string.editor_pages_move);
    mi.setIcon(R.drawable.ic_pages);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    mi = pagesMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PAGE_ADD,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PAGE_ADD, R.string.editor_pages_add);
    mi.setIcon(R.drawable.ic_add_page);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    mi = pagesMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PAGE_DELETE,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PAGE_DELETE, R.string.editor_pages_remove);
    mi.setIcon(R.drawable.ic_delete);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    // EXTRA SETTINGS
    // SAVE
    mi = menu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SAVE,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SAVE, R.string.editor_save);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

    super.onCreateOptionsMenu(menu);

    return true;
}

From source file:org.alfresco.mobile.android.application.fragments.menu.MainMenuFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();/*  w w  w  .ja  v a2 s  .  co  m*/

    if (showOperationsMenu) {
        MenuItem mi = menu.add(Menu.NONE, R.id.menu_notifications, Menu.FIRST, R.string.notifications);
        mi.setIcon(R.drawable.ic_events_dark);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }
}

From source file:org.alfresco.mobile.android.application.fragments.browser.ChildrenBrowserFragment.java

public void getMenu(Menu menu) {
    if (parentFolder == null) {
        return;/*w ww.  ja  v  a 2s  . c o m*/
    }

    if (getActivity() instanceof MainActivity) {
        getMenu(alfSession, menu, parentFolder);

        if (hasDocument()) {
            displayMenuItem = menu.add(Menu.NONE, MenuActionItem.MENU_DISPLAY_GALLERY,
                    Menu.FIRST + MenuActionItem.MENU_DISPLAY_GALLERY, R.string.display_gallery);
            displayMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }
    } else if (getActivity() instanceof PublicDispatcherActivity) {
        Permissions permission = alfSession.getServiceRegistry().getDocumentFolderService()
                .getPermissions(parentFolder);

        if (permission.canAddChildren()) {
            MenuItem mi = menu.add(Menu.NONE, MenuActionItem.MENU_CREATE_FOLDER,
                    Menu.FIRST + MenuActionItem.MENU_CREATE_FOLDER, R.string.folder_create);
            mi.setIcon(R.drawable.ic_add_folder);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }
    }

    // Uncomment for enabling view switcher
    /*
     * displayMenuItem = menu.add(Menu.NONE,
     * MenuActionItem.MENU_DISPLAY_ITEMS, Menu.FIRST +
     * MenuActionItem.MENU_DISPLAY_ITEMS, R.string.display_views); switch
     * (displayMode) { case DISPLAY_LIST:
     * displayMenuItem.setIcon(R.drawable.ic_action_list); break; case
     * DISPLAY_LIST_LARGE:
     * displayMenuItem.setIcon(R.drawable.ic_action_tiles_small); break;
     * case DISPLAY_GRID:
     * displayMenuItem.setIcon(R.drawable.ic_action_list_2); break; default:
     * break; }
     * displayMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
     */
}

From source file:org.alfresco.mobile.android.application.fragments.browser.ChildrenBrowserFragment.java

public static void getMenu(AlfrescoSession session, Menu menu, Folder parentFolder, boolean actionMode) {
    MenuItem mi;/*from  w  w w . j a  v a2  s  .  com*/

    if (parentFolder == null) {
        return;
    }
    Permissions permission = null;
    try {
        permission = session.getServiceRegistry().getDocumentFolderService().getPermissions(parentFolder);
    } catch (Exception e) {
        return;
    }

    if (!actionMode) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_SEARCH_FOLDER,
                Menu.FIRST + MenuActionItem.MENU_SEARCH_FOLDER, R.string.search);
        mi.setIcon(R.drawable.ic_search);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    if (!actionMode && permission.canAddChildren()) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_CREATE_FOLDER,
                Menu.FIRST + MenuActionItem.MENU_CREATE_FOLDER, R.string.folder_create);
        mi.setIcon(R.drawable.ic_add_folder);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        SubMenu createMenu = menu.addSubMenu(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE,
                Menu.FIRST + MenuActionItem.MENU_DEVICE_CAPTURE, R.string.add_menu);
        createMenu.setIcon(android.R.drawable.ic_menu_add);
        createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

        createMenu.add(Menu.NONE, MenuActionItem.MENU_UPLOAD, Menu.FIRST + MenuActionItem.MENU_UPLOAD,
                R.string.upload_title);

        createMenu.add(Menu.NONE, MenuActionItem.MENU_CREATE_DOCUMENT,
                Menu.FIRST + MenuActionItem.MENU_CREATE_DOCUMENT, R.string.create_document);

        createMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_PHOTO,
                Menu.FIRST + MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_PHOTO, R.string.take_photo);

        if (AndroidVersion.isICSOrAbove()) {
            createMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_VIDEO,
                    Menu.FIRST + MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_VIDEO, R.string.make_video);
        }

        createMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_MIC_AUDIO,
                Menu.FIRST + MenuActionItem.MENU_DEVICE_CAPTURE_MIC_AUDIO, R.string.record_audio);

    }

    if (actionMode) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_DETAILS, Menu.FIRST + MenuActionItem.MENU_DETAILS,
                R.string.action_view_properties);
        mi.setIcon(R.drawable.ic_details);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    if (actionMode && permission.canEdit()) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_EDIT, Menu.FIRST + MenuActionItem.MENU_EDIT,
                R.string.edit);
        mi.setIcon(R.drawable.ic_edit);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    if (actionMode && permission.canDelete()) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_DELETE, Menu.FIRST + MenuActionItem.MENU_DELETE,
                R.string.delete);
        mi.setIcon(R.drawable.ic_delete);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    if (!actionMode) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_REFRESH, Menu.FIRST + MenuActionItem.MENU_REFRESH,
                R.string.refresh);
        mi.setIcon(R.drawable.ic_refresh);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
}

From source file:com.googlecode.android_scripting.activity.ScriptManager.java

private void buildMenuIdMaps() {
    mAddMenuIds = new LinkedHashMap<Integer, Interpreter>();
    int i = MenuId.values().length + Menu.FIRST;
    List<Interpreter> installed = mConfiguration.getInstalledInterpreters();
    Collections.sort(installed, new Comparator<Interpreter>() {
        @Override//from ww w. j  av a2s .c o m
        public int compare(Interpreter interpreterA, Interpreter interpreterB) {
            return interpreterA.getNiceName().compareTo(interpreterB.getNiceName());
        }
    });
    for (Interpreter interpreter : installed) {
        mAddMenuIds.put(i, interpreter);
        ++i;
    }
}

From source file:org.alfresco.mobile.android.application.fragments.node.browser.DocumentFolderBrowserFragment.java

public void getMenu(Menu menu) {
    if (parentFolder == null) {
        return;/*w  ww.j  ava 2 s.  c  o  m*/
    }

    if (getActivity() instanceof MainActivity) {
        getMenu(getSession(), menu, parentFolder);

        if (hasDocument()) {
            displayMenuItem = menu.add(Menu.NONE, R.id.menu_gallery, Menu.FIRST, R.string.display_gallery);
            displayMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }
    } else if (getActivity() instanceof PublicDispatcherActivity
            || getActivity() instanceof BaseShortcutActivity) {
        // permission =
        // getSession().getServiceRegistry().getDocumentFolderService().getPermissions(parentFolder);
        if (ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), parentFolder,
                ConfigurableActionHelper.ACTION_CREATE_FOLDER)) {
            MenuItem mi = menu.add(Menu.NONE, R.id.menu_create_folder, Menu.FIRST, R.string.folder_create);
            mi.setIcon(R.drawable.ic_repository_light);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }
    }

    MenuFragmentHelper.getMenu(getActivity(), menu);
}

From source file:org.alfresco.mobile.android.application.fragments.node.browser.DocumentFolderBrowserFragment.java

public void getMenu(AlfrescoSession session, Menu menu, Folder parentFolder) {
    MenuItem mi;/*ww w  .j a  v  a2s .  c  om*/

    if (parentFolder == null) {
        return;
    }
    try {
        permission = session.getServiceRegistry().getDocumentFolderService().getPermissions(parentFolder);
    } catch (Exception e) {
        return;
    }

    mi = menu.add(Menu.NONE, R.id.menu_search_from_folder, Menu.FIRST + 10, R.string.search);
    mi.setIcon(R.drawable.ic_search_light);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    if (ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), parentFolder,
            ConfigurableActionHelper.ACTION_CREATE_DOC)
            || ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), parentFolder,
                    ConfigurableActionHelper.ACTION_CREATE_FOLDER)
            || ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), parentFolder,
                    ConfigurableActionHelper.ACTION_NODE_UPLOAD)) {
        displayFab();
    }
}

From source file:org.alfresco.mobile.android.application.fragments.properties.DetailsFragment.java

public static void getMenu(AlfrescoSession session, Activity activity, Menu menu, Node node,
        boolean actionMode) {
    MenuItem mi;/*  w w w  .  j  a  v  a  2  s.  co m*/

    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) {
            mi = menu.add(Menu.NONE, MenuActionItem.MENU_DOWNLOAD, Menu.FIRST + MenuActionItem.MENU_DOWNLOAD,
                    R.string.download);
            mi.setIcon(R.drawable.ic_download_dark);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (((Document) node).isLatestVersion()
                && ((DocumentImpl) node).hasAllowableAction(Action.CAN_SET_CONTENT_STREAM.value())) {
            mi = menu.add(Menu.NONE, MenuActionItem.MENU_UPDATE, Menu.FIRST + MenuActionItem.MENU_UPDATE,
                    R.string.update);
            mi.setIcon(R.drawable.ic_upload);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        if (!(session instanceof CloudSession)) {
            mi = menu.add(Menu.NONE, MenuActionItem.MENU_WORKFLOW_ADD,
                    Menu.FIRST + MenuActionItem.MENU_WORKFLOW_ADD, R.string.process_start_review);
            mi.setIcon(R.drawable.ic_start_review);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }
    }

    if (session.getServiceRegistry().getDocumentFolderService().getPermissions(node).canEdit()) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_EDIT, Menu.FIRST + MenuActionItem.MENU_EDIT,
                R.string.edit);
        mi.setIcon(R.drawable.ic_edit);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    if (session.getServiceRegistry().getDocumentFolderService().getPermissions(node).canDelete()) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_DELETE, 1000 + MenuActionItem.MENU_DELETE,
                R.string.delete);
        mi.setIcon(R.drawable.ic_delete);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    if (!DisplayUtils.hasCentralPane(activity)) {
        mi = menu.add(Menu.NONE, MenuActionItem.MENU_COMMENT, Menu.FIRST + MenuActionItem.MENU_COMMENT,
                R.string.comments);
        mi.setIcon(R.drawable.ic_comment);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        if (node.isDocument()) {
            mi = menu.add(Menu.NONE, MenuActionItem.MENU_VERSION_HISTORY,
                    Menu.FIRST + MenuActionItem.MENU_VERSION_HISTORY, R.string.version_history);
            mi.setIcon(R.drawable.ic_menu_recent_history);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        mi = menu.add(Menu.NONE, MenuActionItem.MENU_TAGS, Menu.FIRST + MenuActionItem.MENU_TAGS,
                R.string.tags);
        mi.setIcon(R.drawable.mime_tags);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
}