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:cz.msebera.unbound.dns.fragments.UnboundControlConsole.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.add(Menu.NONE, MENU_RUN, Menu.NONE, R.string.menu_run_command) .setIcon(android.R.drawable.ic_media_play).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); super.onCreateOptionsMenu(menu, inflater); }
From source file:th.in.ffc.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem whatnew = menu.add(Menu.NONE, R.layout.whatnew_dialog, Menu.NONE, "what new"); whatnew.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); SharedPreferences sp = getSharedPreferences(FamilyFolderCollector.TAG, MODE_PRIVATE); int prev = sp.getInt(FamilyFolderCollector.PREF_VERSION, 0); int now = getResources().getInteger(R.integer.version_code); whatnew.setIcon((now > prev) ? R.drawable.ic_action_star : R.drawable.ic_action_start_dark); return super.onCreateOptionsMenu(menu); }
From source file:com.nttec.everychan.ui.FavoritesFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); menu.add(Menu.NONE, R.id.menu_clear_favorites, 101, R.string.menu_clear_favorites) .setIcon(android.R.drawable.ic_menu_close_clear_cancel); }
From source file:com.flashcard.iedu.flashcard.samples.cardFlip.MyCardFlipActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Add either a "photo" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE, mShowingBack ? R.string.action_photo : R.string.action_info); // item.setIcon(mShowingBack // ? R.drawable.ic_action_photo // : R.drawable.ic_action_info); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true;/*from w ww .j a v a 2 s .c o m*/ }
From source file:com.google.android.demos.jamendo.app.PlaylistActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); int groupId = MENU_GROUP_INTENT_OPTIONS; int itemId = Menu.NONE; int order = Menu.NONE; ComponentName caller = getComponentName(); Intent[] specifics = null;/*from w w w . j a v a 2s . c o m*/ Intent intent = new Intent(); long id = ContentUris.parseId(getIntent().getData()); intent.setDataAndType(JamendoContract.createPlaylistUri(JamendoContract.FORMAT_M3U, Playlists.ID, id), JamendoContract.CONTENT_TYPE_M3U); intent.addCategory(Intent.CATEGORY_ALTERNATIVE); int flags = 0; MenuItem[] outSpecificItems = null; menu.addIntentOptions(groupId, itemId, order, caller, specifics, intent, flags, outSpecificItems); return menu.hasVisibleItems(); }
From source file:com.itude.mobile.mobbl.core.view.components.tabbar.MBDefaultActionBarBuilder.java
@Override public void fillActionBar(ActionBar actionBar, Menu menu) { _actionBar = actionBar;/*from w w w . ja v a 2 s . c o m*/ _menu = menu; List<MBToolDefinition> tools = MBMetadataService.getInstance().getTools(); for (MBToolDefinition def : tools) { if (def.isPreConditionValid()) { String localizedTitle = MBLocalizationService.getInstance().getTextForKey(def.getTitle()); MenuItem menuItem = menu.add(Menu.NONE, def.getName().hashCode(), tools.indexOf(def), localizedTitle); Drawable image = null; if (def.getIcon() != null) { image = MBResourceService.getInstance().getImageByID(def.getIcon()); menuItem.setIcon(image); } MenuItemCompat.setShowAsAction(menuItem, getMenuItemActionFlags(def)); if ("REFRESH".equals(def.getType())) { _refreshToolDef = def; } else if ("SEARCH".equals(def.getType())) { final SearchView searchView = new SearchView(_context); searchView.setTag(def); searchView.setOnQueryTextFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { Object tag = v.getTag(); if (tag instanceof MBToolDefinition) { MBToolDefinition toolDef = (MBToolDefinition) tag; if (toolDef.getOutcomeName() != null) { handleOutcome(toolDef); } } } else { searchView.setIconified(true); } } }); changeSearchImage(image, searchView); SearchManager searchManager = (SearchManager) _context.getSystemService(Context.SEARCH_SERVICE); searchView.setSearchableInfo( searchManager.getSearchableInfo(MBViewManager.getInstance().getComponentName())); MenuItemCompat.setActionView(menuItem, searchView); } } } if (actionBar != null) { populateActionBar(actionBar); } }
From source file:com.android.talkback.menurules.RuleSpannables.java
@Override public List<ContextMenuItem> getMenuItemsForNode(TalkBackService service, ContextMenuItemBuilder menuItemBuilder, AccessibilityNodeInfoCompat node) { final LinkedList<ContextMenuItem> result = new LinkedList<>(); final SpannableString spannable = getStringWithUrlSpan(node); if (spannable == null) { return result; }// ww w.j av a 2 s. c o m final URLSpan[] urlSpans = spannable.getSpans(0, spannable.length(), URLSpan.class); if ((urlSpans == null) || (urlSpans.length == 0)) { return result; } for (int i = 0; i < urlSpans.length; i++) { final URLSpan urlSpan = urlSpans[i]; final String url = urlSpan.getURL(); final int start = spannable.getSpanStart(urlSpan); final int end = spannable.getSpanEnd(urlSpan); final CharSequence label = spannable.subSequence(start, end); if (TextUtils.isEmpty(url) || TextUtils.isEmpty(label)) { continue; } final Uri uri = Uri.parse(url); if (uri.isRelative()) { // Generally, only absolute URIs are resolvable to an activity continue; } final ContextMenuItem item = menuItemBuilder.createMenuItem(service, Menu.NONE, i, Menu.NONE, label); item.setOnMenuItemClickListener(new SpannableMenuClickListener(service, uri)); result.add(item); } return result; }
From source file:in.sundar.unitconverter.FormulaeListActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.add(0, EDIT_ID, Menu.NONE, R.string.action_edit_formula); menu.add(0, DELETE_ID, Menu.NONE, R.string.action_delete_formula); }
From source file:finalproject.ece558.edu.pdx.ece.brailleblackjack.LearnBrailleActivity.java
/** * Create the action menu to provide buttons to navigate the Pager * @param menu Menu object/*from w w w. j a v a 2s . c o m*/ * @return Boolean true */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu_main, menu); // Add/enable previous button depending on which page is active // is currently selected. MenuItem prev_item = menu.add(Menu.NONE, R.id.action_previous, Menu.NONE, R.string.action_previous); prev_item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0); // Add either a "next" or "finished" button to the action bar, depending on which page // is currently active. MenuItem next_item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish : R.string.action_next); next_item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.findItem(R.id.action_next).setEnabled(!(mPager.getCurrentItem() == 3)); menu.findItem(R.id.action_next).setEnabled(mPager.getCurrentItem() < 3); return true; }
From source file:nz.ac.auckland.lablet.ExperimentAnalysisFragment.java
private void showDataMenu(ExperimentAnalysis experimentAnalysis) { final View menuView = getActivity().findViewById(R.id.action_data); PopupMenu popup = new PopupMenu(getActivity(), menuView); final ViewPager pager = ((ExperimentAnalysisActivity) getActivity()).getViewPager(); final List<ExperimentAnalysis.AnalysisEntry> analysisList = experimentAnalysis .getAnalysisRunAt(analysisRef.runId).analysisList; int i = 0;/*from ww w . ja v a 2 s. c om*/ for (ExperimentAnalysis.AnalysisEntry analysisEntry : analysisList) { MenuItem item = popup.getMenu().add(1, i, Menu.NONE, analysisEntry.analysis.getDisplayName()); item.setCheckable(true); if (pager.getCurrentItem() == i) item.setChecked(true); i++; } popup.getMenu().setGroupCheckable(1, true, true); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { int item = menuItem.getItemId(); pager.requestLayout(); pager.setCurrentItem(item, true); return false; } }); popup.show(); }