List of usage examples for android.view Menu NONE
int NONE
To view the source code for android.view Menu NONE.
Click Source Link
From source file:com.andrewshu.android.reddit.comments.CommentsListActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; int rowId = (int) info.id; ThingInfo item = mCommentsAdapter.getItem(rowId); if (rowId == 0) { menu.add(0, Constants.SHARE_CONTEXT_ITEM, Menu.NONE, "Share"); if (getOpThingInfo().isSaved()) { menu.add(0, Constants.UNSAVE_CONTEXT_ITEM, Menu.NONE, "Unsave"); } else {/*from w w w . j a v a 2s.c om*/ menu.add(0, Constants.SAVE_CONTEXT_ITEM, Menu.NONE, "Save"); } if (getOpThingInfo().isHidden()) { menu.add(0, Constants.UNHIDE_CONTEXT_ITEM, Menu.NONE, "Unhide"); } else { menu.add(0, Constants.HIDE_CONTEXT_ITEM, Menu.NONE, "Hide"); } menu.add(0, Constants.DIALOG_VIEW_PROFILE, Menu.NONE, String.format(getResources().getString(R.string.user_profile), item.getAuthor())); } else if (isLoadMoreCommentsPosition(rowId)) { menu.add(0, Constants.DIALOG_GOTO_PARENT, Menu.NONE, "Go to parent"); } else if (isHiddenCommentHeadPosition(rowId)) { menu.add(0, Constants.DIALOG_SHOW_COMMENT, Menu.NONE, "Show comment"); menu.add(0, Constants.DIALOG_GOTO_PARENT, Menu.NONE, "Go to parent"); } else { if (mSettings.getUsername() != null && mSettings.getUsername().equalsIgnoreCase(item.getAuthor())) { menu.add(0, Constants.DIALOG_EDIT, Menu.NONE, "Edit"); menu.add(0, Constants.DIALOG_DELETE, Menu.NONE, "Delete"); } menu.add(0, Constants.DIALOG_HIDE_COMMENT, Menu.NONE, "Hide comment"); // if (mSettings.isLoggedIn()) // menu.add(0, Constants.DIALOG_REPORT, Menu.NONE, "Report comment"); menu.add(0, Constants.DIALOG_GOTO_PARENT, Menu.NONE, "Go to parent"); menu.add(0, Constants.DIALOG_VIEW_PROFILE, Menu.NONE, String.format(getResources().getString(R.string.user_profile), item.getAuthor())); } }
From source file:org.openintents.shopping.ui.ShoppingActivity.java
protected void showTagsFilter(final View v) { QuickSelectMenu popup = new QuickSelectMenu(this, v); Menu menu = popup.getMenu();//from www . j a va2s .c o m if (menu == null) { return; } String[] tags = getTaglist(mListUri.getLastPathSegment()); int i_tag, count = tags.length; if (count == 0) { Toast.makeText(this, R.string.no_tags_available, Toast.LENGTH_SHORT).show(); return; } // prepend the "no filter" option menu.add(0, -1, Menu.NONE, R.string.unfiltered); for (i_tag = 0; i_tag < count; i_tag++) { menu.add(tags[i_tag]); } popup.setOnItemSelectedListener(new QuickSelectMenu.OnItemSelectedListener() { public void onItemSelected(CharSequence name, int id) { // set the selected tags filter ContentValues values = new ContentValues(); values.put(Lists.TAGS_FILTER, id == -1 ? "" : (String) name); getContentResolver().update(mListUri, values, null, null); if (id == -1) { ((Button) v).setText(R.string.tags); } else { ((Button) v).setText(name); } fillItems(false); } }); popup.show(); }
From source file:org.openintents.shopping.ui.ShoppingActivity.java
protected void showListFilter(final View v) { QuickSelectMenu popup = new QuickSelectMenu(this, v); int i_list;/*from ww w. j ava 2 s . co m*/ Menu menu = popup.getMenu(); if (menu == null) { return; } // get the list of lists mCursorShoppingLists.requery(); int count = mCursorShoppingLists.getCount(); mCursorShoppingLists.moveToFirst(); for (i_list = 0; i_list < count; i_list++) { String name = mCursorShoppingLists.getString(mStringListFilterNAME); menu.add(0, i_list, Menu.NONE, name); mCursorShoppingLists.moveToNext(); } popup.setOnItemSelectedListener(new QuickSelectMenu.OnItemSelectedListener() { public void onItemSelected(CharSequence name, int pos) { setSelectedListPos(pos); } }); popup.show(); }
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; }// www .ja v a 2 s .c o m }); stopApplicationItem.setIcon(android.R.drawable.ic_notification_clear_all); }
From source file:com.google.appinventor.components.runtime.Form.java
public void addAboutInfoToMenu(Menu menu) { MenuItem aboutAppItem = menu.add(Menu.NONE, Menu.NONE, 2, "About this application") .setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { showAboutApplicationNotification(); return true; }/* ww w . j a va 2 s . c o m*/ }); aboutAppItem.setIcon(android.R.drawable.sym_def_app_icon); }
From source file:de.ub0r.android.websms.WebSMS.java
/** * {@inheritDoc}/*from w w w.j a v a 2 s. com*/ */ @Override public final boolean onPrepareOptionsMenu(final Menu menu) { final ConnectorSpec[] connectors = getConnectors(ConnectorSpec.CAPABILITIES_SEND, ConnectorSpec.STATUS_READY | ConnectorSpec.STATUS_ENABLED, true /*isIncludePseudoConnectors*/); boolean isPrefsConnectorOk = prefsConnectorSpec != null && prefsSubConnectorSpec != null && prefsConnectorSpec.hasStatus(ConnectorSpec.STATUS_ENABLED); menu.findItem(R.id.item_connector) .setVisible(connectors.length > 1 || (connectors.length == 1 && connectors[0].getSubConnectorCount() > 1) || (connectors.length == 1 && !isPrefsConnectorOk)); boolean hasText = this.etText != null && !TextUtils.isEmpty(this.etText.getText()); menu.findItem(R.id.item_savechars).setVisible(hasText); // only allow to save drafts on API18- menu.findItem(R.id.item_draft).setVisible(Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT && hasText); final boolean showRestore = !TextUtils .isEmpty(PreferenceManager.getDefaultSharedPreferences(this).getString(PREFS_BACKUPLASTTEXT, null)); try { menu.removeItem(ITEM_RESTORE); } catch (Exception e) { Log.w(TAG, "error removing item: " + ITEM_RESTORE, e); } if (showRestore) { menu.add(0, ITEM_RESTORE, android.view.Menu.NONE, R.string.restore_); menu.findItem(ITEM_RESTORE).setIcon(android.R.drawable.ic_menu_revert); } return true; }
From source file:com.simadanesh.isatis.ScreenSlideActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); try {// w w w . j av a 2 s .c o m 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); item.setIcon(R.drawable.ic_menu_forward); MenuItem stepItem = menu.add(Menu.NONE, R.id.action_step_ten, Menu.NONE, step10 ? R.string.action_step_ten : R.string.action_step_one); stepItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); MenuItem turn_on_flash_Item = menu.add(Menu.NONE, R.id.action_turn_on_flash, Menu.NONE, R.string.action_turn_on_light); turn_on_flash_Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); turn_on_flash_Item.setIcon(R.drawable.ic_menu_flashlight); MenuItem filter_Item = menu.add(Menu.NONE, R.id.action_filter, Menu.NONE, R.string.filter); filter_Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); filter_Item.setIcon(R.drawable.filter); MenuItem search_Item = menu.add(Menu.NONE, R.id.action_search, Menu.NONE, R.string.search); search_Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); MenuItem addCustomer_Item = menu.add(Menu.NONE, R.id.action_new_customer, Menu.NONE, R.string.new_customer); addCustomer_Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); setTitle(); progressbar.setProgress(mPager.getCurrentItem() + 1); progressbar.setMax(mPagerAdapter.getCount()); final Handler handler = new Handler(); progressbar.setVisibility(View.VISIBLE); handler.postDelayed(new Runnable() { @Override public void run() { callCount--; if (callCount <= 0) { progressbar.setVisibility(View.GONE); } } }, 3000); callCount++; } catch (Exception ex) { ex.toString(); } return true; }
From source file:pt.aptoide.backupapps.Aptoide.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { menu.clear();/*from w ww . java2 s . co m*/ currentAppsList = EnumAppsLists.reverseOrdinal(appsListPager.getCurrentItem()); switch (currentAppsList) { case RESTORE: // menu.add(Menu.NONE, EnumOptionsMenu.DELETE.ordinal(), EnumOptionsMenu.DELETE.ordinal(), R.string.delete) // .setIcon(R.drawable.ic_menu_close_clear_cancel); break; case BACKUP: menu.add(Menu.NONE, EnumOptionsMenu.UNINSTALL.ordinal(), EnumOptionsMenu.UNINSTALL.ordinal(), R.string.uninstall).setIcon(android.R.drawable.ic_menu_delete); break; // case Updates: // menu.add(Menu.NONE, EnumOptionsMenu.UPDATE_ALL.ordinal(), EnumOptionsMenu.UPDATE_ALL.ordinal(), R.string.update_all) // .setIcon(R.drawable.ic_menu_refresh); // menu.add(Menu.NONE, EnumOptionsMenu.DISPLAY_OPTIONS.ordinal(), EnumOptionsMenu.DISPLAY_OPTIONS.ordinal(), R.string.display_options) // .setIcon(R.drawable.ic_menu_filter); // break; default: break; } // menu.add(Menu.NONE, EnumOptionsMenu.MANAGE_REPO.ordinal(), EnumOptionsMenu.MANAGE_REPO.ordinal(), R.string.manage_repos) // .setIcon(R.drawable.ic_menu_archive); // menu.add(Menu.NONE,EnumOptionsMenu.SCHEDULED_DOWNLOADS.ordinal(),EnumOptionsMenu.SCHEDULED_DOWNLOADS.ordinal(),R.string.scheduled_downloads) // .setIcon(R.drawable.ic_menu_clock); // menu.add(Menu.NONE, EnumOptionsMenu.SEARCH_MENU.ordinal(),EnumOptionsMenu.SEARCH_MENU.ordinal(),R.string.menu_search) // .setIcon(android.R.drawable.ic_menu_search); menu.add(Menu.NONE, EnumOptionsMenu.DISPLAY_OPTIONS.ordinal(), EnumOptionsMenu.DISPLAY_OPTIONS.ordinal(), R.string.display_options).setIcon(android.R.drawable.ic_menu_sort_by_size); menu.add(Menu.NONE, EnumOptionsMenu.UN_SELECT_ALL.ordinal(), EnumOptionsMenu.UN_SELECT_ALL.ordinal(), R.string.un_select_all).setIcon(android.R.drawable.ic_menu_add); 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.SETTINGS.ordinal(), EnumOptionsMenu.SETTINGS.ordinal(), R.string.settings).setIcon(android.R.drawable.ic_menu_preferences); menu.add(Menu.NONE, EnumOptionsMenu.LOGIN.ordinal(), EnumOptionsMenu.LOGIN.ordinal(), R.string.login) .setIcon(android.R.drawable.ic_menu_edit); menu.add(Menu.NONE, EnumOptionsMenu.FOLLOW.ordinal(), EnumOptionsMenu.FOLLOW.ordinal(), R.string.social_networks).setIcon(android.R.drawable.ic_menu_share); return super.onCreateOptionsMenu(menu); }
From source file:com.ichi2.anki2.DeckPicker.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem item;/* w ww . ja v a2 s . c o m*/ if (mFragmented) { UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_SYNC, Menu.NONE, R.string.sync_title, R.drawable.ic_menu_refresh); UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_ADD_NOTE, Menu.NONE, R.string.add, R.drawable.ic_menu_add); int icon; SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(this); if (preferences.getBoolean("invertedColors", false)) { icon = R.drawable.ic_menu_night_checked; } else { icon = R.drawable.ic_menu_night; } UIUtils.addMenuItemInActionBar(menu, Menu.NONE, StudyOptionsActivity.MENU_NIGHT, Menu.NONE, R.string.night_mode, icon); UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_STATISTICS, Menu.NONE, R.string.statistics_menu, R.drawable.ic_menu_statistics); UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_CARDBROWSER, Menu.NONE, R.string.menu_cardbrowser, R.drawable.ic_menu_cardbrowser); } UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_HELP, Menu.NONE, R.string.help_title, R.drawable.ic_menu_help); item = menu.add(Menu.NONE, MENU_PREFERENCES, Menu.NONE, R.string.menu_preferences); item.setIcon(R.drawable.ic_menu_preferences); item = menu.add(Menu.NONE, MENU_ADD_SHARED_DECK, Menu.NONE, R.string.menu_get_shared_decks); item.setIcon(R.drawable.ic_menu_download); item = menu.add(Menu.NONE, MENU_CREATE_DECK, Menu.NONE, R.string.new_deck); item.setIcon(R.drawable.ic_menu_add); item = menu.add(Menu.NONE, MENU_CREATE_DYNAMIC_DECK, Menu.NONE, R.string.new_dynamic_deck); item.setIcon(R.drawable.ic_menu_add); item = menu.add(Menu.NONE, MENU_IMPORT, Menu.NONE, R.string.menu_import); item.setIcon(R.drawable.ic_menu_download); UIUtils.addMenuItem(menu, Menu.NONE, CHECK_DATABASE, Menu.NONE, R.string.check_db, R.drawable.ic_menu_search); item = menu.add(Menu.NONE, StudyOptionsActivity.MENU_ROTATE, Menu.NONE, R.string.menu_rotate); item.setIcon(R.drawable.ic_menu_always_landscape_portrait); item = menu.add(Menu.NONE, MENU_FEEDBACK, Menu.NONE, R.string.studyoptions_feedback); item.setIcon(R.drawable.ic_menu_send); item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, R.string.menu_about); item.setIcon(R.drawable.ic_menu_info_details); item = menu.add(Menu.NONE, MENU_REUPGRADE, Menu.NONE, R.string.restart_upgrade_process); item.setIcon(R.drawable.ic_menu_preferences); return true; }