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.balakrish.gpstracker.WaypointsListActivity.java
/** * Create context menu for selected item *///from ww w . ja v a2 s . com @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); // AdapterView.AdapterContextMenuInfo info = // (AdapterView.AdapterContextMenuInfo) menuInfo; menu.setHeaderTitle(getString(R.string.waypoint)); menu.add(Menu.NONE, 0, 0, R.string.edit); menu.add(Menu.NONE, 1, 1, R.string.delete); menu.add(Menu.NONE, 2, 2, R.string.email_to); menu.add(Menu.NONE, 3, 3, R.string.show_on_map); }
From source file:org.alfresco.mobile.android.application.fragments.favorites.FavoritesSyncFragment.java
public void getMenu(Menu menu) { info = SyncScanInfo.getLastSyncScanData(getActivity(), acc); if (info != null && (info.hasWarning() && !info.hasResponse())) { mi = menu.add(Menu.NONE, MenuActionItem.MENU_SYNC_WARNING, Menu.FIRST + MenuActionItem.MENU_SYNC_WARNING, R.string.sync_warning); mi.setIcon(R.drawable.ic_warning); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }//from ww w . j a v a 2s . c o m mi = menu.add(Menu.NONE, MenuActionItem.MENU_REFRESH, MenuActionItem.MENU_SYNC_WARNING + MenuActionItem.MENU_REFRESH, R.string.refresh); mi.setIcon(R.drawable.ic_refresh); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }
From source file:org.chromium.chrome.browser.preferences.website.SingleCategoryPreferences.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear();//from w w w.j a va 2s . co m inflater.inflate(R.menu.website_preferences_menu, menu); MenuItem searchItem = menu.findItem(R.id.search); mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem); mSearchView.setImeOptions(EditorInfo.IME_FLAG_NO_FULLSCREEN); SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return true; } @Override public boolean onQueryTextChange(String query) { if (query.equals(mSearch)) return true; mSearch = query; getInfoForOrigins(); return true; } }; mSearchView.setOnQueryTextListener(queryTextListener); if (mCategory.showProtectedMediaSites()) { // Add a menu item to reset protected media identifier device credentials. MenuItem resetMenu = menu.add(Menu.NONE, Menu.NONE, Menu.NONE, R.string.reset_device_credentials); resetMenu.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { ProtectedContentResetCredentialConfirmDialogFragment.newInstance(SingleCategoryPreferences.this) .show(getFragmentManager(), null); return true; } }); } MenuItem help = menu.add(Menu.NONE, R.id.menu_id_targeted_help, Menu.NONE, R.string.menu_help); help.setIcon(R.drawable.ic_help_and_feedback); }
From source file:com.hichinaschool.flashcards.anki.CardBrowser.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem item;/*from w w w .j a v a 2 s . c o m*/ // TODO(flerda@gmail.com): Fix card browser's undo. // https://code.google.com/p/ankidroid/issues/detail?id=1561 /* item = menu.add(Menu.NONE, MENU_UNDO, Menu.NONE, R.string.undo); item.setIcon(R.drawable.ic_menu_revert); */ item = menu.add(Menu.NONE, MENU_ADD_NOTE, Menu.NONE, R.string.card_editor_add_card); item.setIcon(R.drawable.ic_menu_add); // TODO(flerda@gmail.com): Fix card browser fields. // https://code.google.com/p/ankidroid/issues/detail?id=1310 // Currently this is disabled because it is obvious what to do when cards with different models are present in // the deck. /* if (mWholeCollection == false) { item = menu.add(Menu.NONE, MENU_FIELD, Menu.NONE, R.string.card_browser_field); item.setIcon(R.drawable.ic_menu_add); } */ item = menu.add(Menu.NONE, MENU_CHANGE_ORDER, Menu.NONE, R.string.card_browser_change_display_order); item.setIcon(R.drawable.ic_menu_sort_by_size); item = menu.add(Menu.NONE, MENU_SHOW_MARKED, Menu.NONE, R.string.card_browser_show_marked); item.setIcon(R.drawable.ic_menu_star_on); item = menu.add(Menu.NONE, MENU_SELECT_SUSPENDED, Menu.NONE, R.string.card_browser_show_suspended); item.setIcon(R.drawable.ic_menu_close_clear_cancel); item = menu.add(Menu.NONE, MENU_SELECT_TAG, Menu.NONE, R.string.card_browser_search_by_tag); item.setIcon(R.drawable.ic_menu_search); return true; }
From source file:com.money.manager.ex.home.HomeFragment.java
/** * Context menu for account entries./*w w w. jav a 2 s . c o m*/ */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (!(v instanceof ExpandableListView)) return; ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; int type = ExpandableListView.getPackedPositionType(info.packedPosition); int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition); int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition); // ignore long-press on group items. if (type != ExpandableListView.PACKED_POSITION_TYPE_CHILD) return; // get adapter. HomeAccountsExpandableAdapter accountsAdapter = (HomeAccountsExpandableAdapter) mExpandableListView .getExpandableListAdapter(); Object childItem = accountsAdapter.getChild(groupPosition, childPosition); QueryAccountBills account = (QueryAccountBills) childItem; // menu.setHeaderIcon(android.R.drawable.ic_menu_manage); menu.setHeaderTitle(account.getAccountName()); String[] menuItems = getResources().getStringArray(R.array.context_menu_account_dashboard); for (String menuItem : menuItems) { menu.add(menuItem); } // balance account should work only for transaction accounts. AccountService service = new AccountService(getActivity()); List<String> accountTypes = service.getTransactionAccountTypeNames(); String accountType = account.getAccountType(); if (accountTypes.contains(accountType)) { menu.add(R.string.balance_account); } // Investment menu items. if (accountType.equals(AccountTypes.INVESTMENT.toString())) { menu.add(Menu.NONE, ContextMenuIds.Portfolio.getId(), 0, getString(R.string.portfolio)); } }
From source file:org.mozilla.gecko.GeckoApp.java
@Override public boolean onPrepareOptionsMenu(Menu aMenu) { Iterator<ExtraMenuItem> i = sExtraMenuItems.iterator(); while (i.hasNext()) { final ExtraMenuItem item = i.next(); if (aMenu.findItem(item.id) == null) { final MenuItem mi = aMenu.add(Menu.NONE, item.id, Menu.NONE, item.label); if (item.icon != null) { if (item.icon.startsWith("data")) { byte[] raw = GeckoAppShell.decodeBase64(item.icon.substring(22), GeckoAppShell.BASE64_DEFAULT); Bitmap bitmap = BitmapFactory.decodeByteArray(raw, 0, raw.length); BitmapDrawable drawable = new BitmapDrawable(bitmap); mi.setIcon(drawable); } else if (item.icon.startsWith("jar:") || item.icon.startsWith("file://")) { GeckoAppShell.getHandler().post(new Runnable() { public void run() { try { URL url = new URL(item.icon); InputStream is = (InputStream) url.getContent(); Drawable drawable = Drawable.createFromStream(is, "src"); mi.setIcon(drawable); } catch (Exception e) { Log.w(LOGTAG, "onPrepareOptionsMenu: Unable to set icon", e); }/*w ww . j av a 2s . com*/ } }); } } mi.setOnMenuItemClickListener(item); } } if (!sIsGeckoReady) aMenu.findItem(R.id.settings).setEnabled(false); Tab tab = Tabs.getInstance().getSelectedTab(); MenuItem bookmark = aMenu.findItem(R.id.bookmark); MenuItem forward = aMenu.findItem(R.id.forward); MenuItem share = aMenu.findItem(R.id.share); MenuItem saveAsPDF = aMenu.findItem(R.id.save_as_pdf); MenuItem charEncoding = aMenu.findItem(R.id.char_encoding); if (tab == null) { bookmark.setEnabled(false); forward.setEnabled(false); share.setEnabled(false); saveAsPDF.setEnabled(false); return true; } bookmark.setEnabled(true); bookmark.setCheckable(true); if (tab.isBookmark()) { bookmark.setChecked(true); bookmark.setIcon(R.drawable.ic_menu_bookmark_remove); } else { bookmark.setChecked(false); bookmark.setIcon(R.drawable.ic_menu_bookmark_add); } forward.setEnabled(tab.canDoForward()); // Disable share menuitem for about:, chrome: and file: URIs String scheme = Uri.parse(tab.getURL()).getScheme(); boolean enabled = scheme != null && !(scheme.equals("about") || scheme.equals("chrome") || scheme.equals("file")); share.setEnabled(enabled); // Disable save as PDF for about:home and xul pages saveAsPDF.setEnabled(!(tab.getURL().equals("about:home") || tab.getContentType().equals("application/vnd.mozilla.xul+xml"))); charEncoding.setVisible(GeckoPreferences.getCharEncodingState()); return true; }
From source file:com.easemob.chatuidemo.activity.main.MainActivity.java
/** * ?/*from w w w . j ava2 s .co m*/ */ private void initView() { tvMessage = (TextView) findViewById(R.id.user_message); unreadLabel = (TextView) findViewById(R.id.unread_msg_number); unreadAddressLable = (TextView) findViewById(R.id.unread_msg_number_main); mTabs = new Button[3]; mTabs[0] = (Button) findViewById(R.id.btn_schoolyard); mTabs[1] = (Button) findViewById(R.id.btn_seikatsu); mTabs[2] = (Button) findViewById(R.id.btn_setting); registerForContextMenu(mTabs[1]); tvMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(MainActivity.this, MessageActivity.class); intent.putExtra("invitenum", mInviteNum); intent.putExtra("chatnum", mChatNum); startActivityForResult(intent, 301); } }); tvMemu = (TextView) findViewById(R.id.user_menu); popupMenu = new PopupMenu(this, tvMemu); menu = popupMenu.getMenu(); tvMemu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { popupMenu.show(); } }); menu.add(Menu.NONE, Menu.FIRST + 0, 0, ""); menu.add(Menu.NONE, Menu.FIRST + 1, 1, ""); menu.add(Menu.NONE, Menu.FIRST + 2, 2, "?"); MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.popupmenu, menu); // ? popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case Menu.FIRST + 0: Intent intent = new Intent(MainActivity.this, UserProfileActivity.class); intent.putExtra("username", EMChatManager.getInstance().getCurrentUser()); intent.putExtra("nick", DemoApplication.getInstance().getNick()); intent.putExtra("setting", true); startActivity(intent); break; case Menu.FIRST + 1: logout(); break; case Menu.FIRST + 2: intent = new Intent(MainActivity.this, RegisterActivity.class); intent.putExtra("action", "update"); startActivity(intent); break; default: break; } return false; } }); }
From source file:com.silentcircle.contacts.editor.RawContactEditorView.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void showAddInformationPopupWindow() { final ArrayList<KindSectionView> fields = getSectionViewsWithoutFields(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { showAddInformationPopupWindow(fields); } else {//from w ww .j av a 2 s. co m final PopupMenu popupMenu = new PopupMenu(getContext(), mAddFieldButton); final Menu menu = popupMenu.getMenu(); for (int i = 0; i < fields.size(); i++) { menu.add(Menu.NONE, i, Menu.NONE, fields.get(i).getTitle()); } popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { final KindSectionView view = fields.get(item.getItemId()); if (DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME.equals(view.getKind().mimeType)) { mPhoneticNameAdded = true; updatePhoneticNameVisibility(); } else { view.addItem(); } // If this was the last section without an entry, we just added one, and therefore // there's no reason to show the button. if (fields.size() == 1) { mAddFieldButton.setVisibility(GONE); } return true; } }); popupMenu.show(); } }
From source file:com.example.javier.MaterialDesignApp.PlayerActivity.java
public void showAudioPopup(View v) { PopupMenu popup = new PopupMenu(this, v); Menu menu = popup.getMenu();//from w w w . j a v a 2s.co m menu.add(Menu.NONE, Menu.NONE, Menu.NONE, R.string.enable_background_audio); final MenuItem backgroundAudioItem = menu.findItem(0); backgroundAudioItem.setCheckable(true); backgroundAudioItem.setChecked(enableBackgroundAudio); OnMenuItemClickListener clickListener = new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (item == backgroundAudioItem) { enableBackgroundAudio = !item.isChecked(); return true; } return false; } }; configurePopupWithTracks(popup, clickListener, DemoPlayer.TYPE_AUDIO); popup.show(); }
From source file:org.mythdroid.remote.TVRemote.java
/** Compose the menu */ @Override/*from w w w. j a v a 2 s.co m*/ public boolean onCreateOptionsMenu(Menu menu) { menu.add(Menu.NONE, MENU_BUTTON, Menu.NONE, R.string.btnIface).setIcon(drawable.ic_menu_add); menu.add(Menu.NONE, MENU_GESTURE, Menu.NONE, R.string.gestIface).setIcon(R.drawable.ic_menu_finger); MenuItemCompat.setShowAsAction( menu.add(Menu.NONE, MENU_OSDMENU, Menu.NONE, R.string.osdMenu).setIcon(drawable.ic_menu_more), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItemCompat.setShowAsAction( menu.add(Menu.NONE, MENU_MOVE, Menu.NONE, R.string.moveTo).setIcon(drawable.ic_menu_set_as), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); return true; }