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.uguess.android.sysinfo.ApplicationManager.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    menu.setHeaderTitle(R.string.actions);
    menu.add(Menu.NONE, MI_MANAGE, Menu.NONE, R.string.manage);
    menu.add(Menu.NONE, MI_LAUNCH, Menu.NONE, R.string.run);
    menu.add(Menu.NONE, MI_SEARCH, Menu.NONE, R.string.search_market);
    menu.add(Menu.NONE, MI_DETAILS, Menu.NONE, R.string.details);
}

From source file:cm.aptoide.pt.ManageRepos.java

public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    menu.add(Menu.NONE, EnumOptionsMenu.ADD_REPO.ordinal(), 1, R.string.add_repo)
            .setIcon(R.drawable.ic_menu_add);
    menu.add(Menu.NONE, EnumOptionsMenu.EDIT_REPO.ordinal(), 2, R.string.edit_repo)
            .setIcon(R.drawable.ic_menu_edit);
    menu.add(Menu.NONE, EnumOptionsMenu.REMOVE_REPO.ordinal(), 3, R.string.remove_repo)
            .setIcon(R.drawable.ic_menu_close_clear_cancel);
    return true;/*ww w. j  a v  a2 s  . com*/
}

From source file:com.andrewshu.android.reddit.threads.ThreadsListActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    AdapterView.AdapterContextMenuInfo info;
    info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    ThingInfo _item = mThreadsAdapter.getItem(info.position);

    mVoteTargetThing = _item;/*from  w ww  . j  a v  a 2 s. c o  m*/

    menu.add(0, Constants.VIEW_SUBREDDIT_CONTEXT_ITEM, 0, R.string.view_subreddit);
    menu.add(0, Constants.SHARE_CONTEXT_ITEM, 0, R.string.share);
    menu.add(0, Constants.OPEN_IN_BROWSER_CONTEXT_ITEM, 0, R.string.open_browser);

    if (mSettings.isLoggedIn()) {
        if (!_item.isSaved()) {
            menu.add(0, Constants.SAVE_CONTEXT_ITEM, 0, "Save");
        } else {
            menu.add(0, Constants.UNSAVE_CONTEXT_ITEM, 0, "Unsave");
        }
        menu.add(0, Constants.HIDE_CONTEXT_ITEM, 0, "Hide");
    }

    menu.add(0, Constants.DIALOG_VIEW_PROFILE, Menu.NONE,
            String.format(getResources().getString(R.string.user_profile), _item.getAuthor()));
}

From source file:org.opendatakit.survey.android.activities.MainMenuActivity.java

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

    int showOption = MenuItem.SHOW_AS_ACTION_IF_ROOM;
    MenuItem item;//from   www  .ja v a 2  s.  c o m
    if (currentFragment != ScreenList.WEBKIT) {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.show();

        item = menu.add(Menu.NONE, MENU_FILL_FORM, Menu.NONE, getString(R.string.enter_data_button));
        item.setIcon(R.drawable.ic_action_collections_collection).setShowAsAction(showOption);

        // Using a file for this work now
        String get = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_GET_BLANK);
        if (get.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PULL_FORMS, Menu.NONE, getString(R.string.get_forms));
            item.setIcon(R.drawable.ic_action_av_download).setShowAsAction(showOption);

            item = menu.add(Menu.NONE, MENU_CLOUD_FORMS, Menu.NONE, getString(R.string.get_forms));
            item.setIcon(R.drawable.ic_action_cloud).setShowAsAction(showOption);
        }

        String send = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_SEND_FINALIZED);
        if (send.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PUSH_FORMS, Menu.NONE, getString(R.string.send_data));
            item.setIcon(R.drawable.ic_action_av_upload).setShowAsAction(showOption);
        }

        String manage = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_MANAGE_FORMS);
        if (manage.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_MANAGE_FORMS, Menu.NONE, getString(R.string.manage_files));
            item.setIcon(R.drawable.trash).setShowAsAction(showOption);
        }

        String settings = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_ACCESS_SETTINGS);
        if (settings.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PREFERENCES, Menu.NONE, getString(R.string.general_preferences));
            item.setIcon(R.drawable.ic_menu_preferences).setShowAsAction(showOption);
        }
        item = menu.add(Menu.NONE, MENU_ADMIN_PREFERENCES, Menu.NONE, getString(R.string.admin_preferences));
        item.setIcon(R.drawable.ic_action_device_access_accounts).setShowAsAction(showOption);

        item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, getString(R.string.about));
        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    } else {
        ActionBar actionBar = getActionBar();
        actionBar.hide();
    }

    return true;
}

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;//from   w  w w  .  j a  v a 2s.  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);
    }
}

From source file:org.totschnig.myexpenses.activity.ExpenseEdit.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    if (!(mTransaction instanceof SplitPartCategory || mTransaction instanceof SplitPartTransfer
            || mTransaction instanceof Template || (mTransaction instanceof SplitTransaction
                    && !MyApplication.getInstance().getLicenceHandler().isContribEnabled()))) {
        MenuItemCompat//w w w.  ja v a2 s .  c  o  m
                .setShowAsAction(menu.add(Menu.NONE, R.id.SAVE_AND_NEW_COMMAND, 0, R.string.menu_save_and_new)
                        .setIcon(R.drawable.ic_action_save_new), MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    }
    if (mOperationType == MyExpenses.TYPE_TRANSFER) {
        MenuItemCompat.setShowAsAction(
                menu.add(Menu.NONE, R.id.INVERT_TRANSFER_COMMAND, 0, R.string.menu_invert_transfer)
                        .setIcon(R.drawable.ic_menu_move),
                MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    }
    return true;
}

From source file:com.andrew.apollo.utils.MusicUtils.java

/**
 * Creates a sub menu used to add items to a new playlist or an existing
 * one.//from  ww w.  j a va  2 s .c o m
 *
 * @param context The {@link Context} to use.
 * @param groupId The group Id of the menu.
 * @param subMenu The {@link SubMenu} to add to.
 * @param showFavorites True if we should show the option to add to the
 *            Favorites cache.
 */
public static void makePlaylistMenu(final Context context, final int groupId, final SubMenu subMenu,
        final boolean showFavorites) {
    //        subMenu.clear();
    subMenu.clearHeader();
    if (showFavorites) {
        subMenu.add(groupId, FragmentMenuItems.ADD_TO_FAVORITES, Menu.NONE, R.string.add_to_favorites);
    }
    subMenu.add(groupId, FragmentMenuItems.NEW_PLAYLIST, Menu.NONE, R.string.new_empty_playlist);
    Cursor cursor = PlaylistLoader.makePlaylistCursor(context);
    if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) {
        while (!cursor.isAfterLast()) {
            final Intent intent = new Intent();
            String name = cursor.getString(1);
            //LOG.info("makePlaylistMenu - add ["+name+"]");
            if (name != null) {
                intent.putExtra("playlist", getIdForPlaylist(context, name));
                subMenu.add(groupId, FragmentMenuItems.PLAYLIST_SELECTED, Menu.NONE, name).setIntent(intent);
            }
            cursor.moveToNext();
        }
    }
    if (cursor != null) {
        cursor.close();
    }
}

From source file:org.path.episample.android.activities.MainMenuActivity.java

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

    int showOption = MenuItem.SHOW_AS_ACTION_IF_ROOM;
    MenuItem item;//from www  .j a va  2s  .c  o m
    if (currentFragment != ScreenList.WEBKIT) {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.show();

        item = menu.add(Menu.NONE, MENU_MAIN_MENU, Menu.NONE, getString(R.string.main_menu));
        item.setIcon(R.drawable.ic_action_home).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

        //item = menu.add(Menu.NONE, MENU_FILL_FORM, Menu.NONE, getString(R.string.enter_data_button));
        //item.setIcon(R.drawable.ic_action_collections_collection).setShowAsAction(showOption);

        // Using a file for this work now
        String get = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_GET_BLANK);
        if (get.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PULL_FORMS, Menu.NONE, getString(R.string.get_forms));
            item.setIcon(R.drawable.ic_action_av_download).setShowAsAction(showOption);

            //item = menu.add(Menu.NONE, MENU_CLOUD_FORMS, Menu.NONE, getString(R.string.get_forms));
            //item.setIcon(R.drawable.ic_action_cloud).setShowAsAction(showOption);
        }

        String send = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_SEND_FINALIZED);
        if (send.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PUSH_FORMS, Menu.NONE, getString(R.string.send_data));
            item.setIcon(R.drawable.ic_action_av_upload).setShowAsAction(showOption);
        }

        String manage = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_MANAGE_FORMS);
        if (manage.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_MANAGE_FORMS, Menu.NONE, getString(R.string.manage_files));
            item.setIcon(R.drawable.trash).setShowAsAction(showOption);
        }

        String settings = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_ACCESS_SETTINGS);
        if (settings.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PREFERENCES, Menu.NONE, getString(R.string.general_preferences));
            item.setIcon(R.drawable.ic_menu_preferences).setShowAsAction(showOption);
        }
        item = menu.add(Menu.NONE, MENU_ADMIN_PREFERENCES, Menu.NONE, getString(R.string.admin_preferences));
        item.setIcon(R.drawable.ic_action_device_access_accounts).setShowAsAction(showOption);

        String backup = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_BACKUP_CENSUS);
        if (backup != null && backup.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_BACKUP_CENSUS, Menu.NONE, getString(R.string.backup_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String restore = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_RESTORE_CENSUS);
        if (restore != null && restore.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_RESTORE_CENSUS, Menu.NONE, getString(R.string.restore_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String invalidateCensus = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_INVALIDATE_CENSUS);
        if (invalidateCensus != null && invalidateCensus.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_MARK_CENSUS_AS_INVALID, Menu.NONE,
                    getString(R.string.invalidate_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String edit = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_EDIT_CENSUS);
        if (edit != null && edit.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_EDIT_CENSUS, Menu.NONE, getString(R.string.edit_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String removeCensus = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_REMOVE_CENSUS);
        if (removeCensus != null && removeCensus.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_REMOVE_CENSUS, Menu.NONE, getString(R.string.remove_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        /*String send_receive_bt = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_SEND_RECEIVE_BLUETOOTH);
        if (send_receive_bt != null && send_receive_bt.equalsIgnoreCase("true")) {
           item = menu.add(Menu.NONE, MENU_SEND_REVEIVE_BLUETOOTH, Menu.NONE, getString(R.string.send_receive_bluetooth));
           item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }*/

        item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, getString(R.string.about));
        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    } else {
        ActionBar actionBar = getActionBar();
        actionBar.hide();
    }

    return true;
}

From source file:cm.aptoide.pt.MainActivity.java

@Override
public boolean onPrepareOptionsMenu(cm.aptoide.com.actionbarsherlock.view.Menu menu) {
    menu.clear();//  ww  w .  jav a  2 s. c o m
    // menu.add(Menu.NONE, EnumOptionsMenu.SEARCH.ordinal(),
    // EnumOptionsMenu.SEARCH.ordinal(), "Search")
    // .setIcon(R.drawable.ic_search)
    // .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS |
    // MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
    menu.add(Menu.NONE, EnumOptionsMenu.LOGIN.ordinal(), EnumOptionsMenu.LOGIN.ordinal(), R.string.my_account)
            .setIcon(android.R.drawable.ic_menu_edit);
    menu.add(Menu.NONE, EnumOptionsMenu.DISPLAY_OPTIONS.ordinal(), EnumOptionsMenu.DISPLAY_OPTIONS.ordinal(),
            R.string.menu_display_options).setIcon(android.R.drawable.ic_menu_sort_by_size);
    menu.add(Menu.NONE, EnumOptionsMenu.SCHEDULED_DOWNLOADS.ordinal(),
            EnumOptionsMenu.SCHEDULED_DOWNLOADS.ordinal(), R.string.setting_schdwntitle)
            .setIcon(android.R.drawable.ic_menu_agenda);
    menu.add(Menu.NONE, EnumOptionsMenu.SETTINGS.ordinal(), EnumOptionsMenu.SETTINGS.ordinal(),
            R.string.settings_title_bar).setIcon(android.R.drawable.ic_menu_manage);

    if (ApplicationAptoide.PARTNERID == null) {
        // menu.add(Menu.NONE, EnumOptionsMenu.ABOUT.ordinal(),
        // EnumOptionsMenu.ABOUT.ordinal(), R.string.about).setIcon(
        // android.R.drawable.ic_menu_help);
        menu.add(Menu.NONE, EnumOptionsMenu.FOLLOW.ordinal(), EnumOptionsMenu.FOLLOW.ordinal(),
                R.string.social_networks).setIcon(android.R.drawable.ic_menu_share);
    }

    menu.add(Menu.NONE, EnumOptionsMenu.DOWNLOADMANAGER.ordinal(), EnumOptionsMenu.DOWNLOADMANAGER.ordinal(),
            R.string.download_manager).setIcon(android.R.drawable.ic_menu_save);

    return super.onPrepareOptionsMenu(menu);
}

From source file:in.shick.diode.threads.ThreadsListActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    AdapterView.AdapterContextMenuInfo info;
    info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    ThingInfo _item = mThreadsAdapter.getItem(info.position);

    mVoteTargetThing = _item;/*  w w w  .j a va 2s.c  om*/

    menu.add(0, Constants.VIEW_SUBREDDIT_CONTEXT_ITEM, 0, R.string.view_subreddit);
    menu.add(0, Constants.SHARE_CONTEXT_ITEM, 0, R.string.share);
    menu.add(0, Constants.OPEN_IN_BROWSER_CONTEXT_ITEM, 0, R.string.open_browser);

    if (mSettings.isLoggedIn()) {
        if (!_item.isSaved()) {
            menu.add(0, Constants.SAVE_CONTEXT_ITEM, 0, "Save");
        } else {
            menu.add(0, Constants.UNSAVE_CONTEXT_ITEM, 0, "Unsave");
        }
        menu.add(0, Constants.HIDE_CONTEXT_ITEM, 0, "Hide");
    }

    // Make sure the user isn't '[deleted]'
    if (!_item.isDeletedUser()) {
        menu.add(0, Constants.DIALOG_VIEW_PROFILE, Menu.NONE,
                String.format(getResources().getString(R.string.user_profile), _item.getAuthor()));
    }
}