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.example.testtab.fragment.TwitEyesPageFragment.java
public boolean onCreateOptionsMenu(Menu menu) { // boolean result = super.onCreateOptionsMenu(menu); // OPTION/* ww w. ja v a 2 s. c o m*/ MenuItem item0 = menu.add(0, MENU0_ID, Menu.NONE, R.string.menu0); item0.setIcon(R.drawable.home); // REFRESH MenuItem item1 = menu.add(0, MENU1_ID, Menu.NONE, R.string.menu1); item1.setIcon(R.drawable.cancel); // return result; return false; }
From source file:com.nttec.everychan.ui.presentation.BoardFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); //? ? -/*from ww w . j a v a 2s .c o m*/ if (v.getTag() != null && v.getTag() instanceof AttachmentModel) { lastContextMenuAttachment = v; AttachmentModel model = (AttachmentModel) v.getTag(); View tnView = v.findViewById(R.id.post_thumbnail_image); if (tnView != null && tnView.getTag() == Boolean.FALSE && !downloadThumbnails()) { menu.add(Menu.NONE, R.id.context_menu_thumb_load_thumb, 1, R.string.context_menu_show_thumbnail) .setOnMenuItemClickListener(contextMenuListener); } menu.add(Menu.NONE, R.id.context_menu_thumb_download, 2, R.string.context_menu_download_file); menu.add(Menu.NONE, R.id.context_menu_thumb_copy_url, 3, R.string.context_menu_copy_url); menu.add(Menu.NONE, R.id.context_menu_thumb_attachment_info, 4, R.string.context_menu_attachment_info); menu.add(Menu.NONE, R.id.context_menu_thumb_reverse_search, 5, R.string.context_menu_reverse_search); for (int id : new int[] { R.id.context_menu_thumb_download, R.id.context_menu_thumb_copy_url, R.id.context_menu_thumb_attachment_info, R.id.context_menu_thumb_reverse_search }) { menu.findItem(id).setOnMenuItemClickListener(contextMenuListener); } switch (model.type) { case AttachmentModel.TYPE_AUDIO: case AttachmentModel.TYPE_VIDEO: case AttachmentModel.TYPE_OTHER_FILE: menu.findItem(R.id.context_menu_thumb_reverse_search).setVisible(false); break; case AttachmentModel.TYPE_OTHER_NOTFILE: menu.findItem(R.id.context_menu_thumb_reverse_search).setVisible(false); menu.findItem(R.id.context_menu_thumb_download).setVisible(false); break; } if (tabModel.type == TabModel.TYPE_LOCAL) { menu.findItem(R.id.context_menu_thumb_download).setVisible(false); } return; } if (menu.findItem(R.id.context_menu_thumb_copy_url) != null) return; //? ? ? boolean isList = true; lastContextMenuPosition = -1; final PresentationItemModel model; if (v.getId() == android.R.id.list) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; model = adapter.getItem(info.position); if (model.hidden) { return; } } else { if (v.getTag() != null && v.getTag() instanceof PostsListAdapter.PostViewTag) { PostsListAdapter.PostViewTag tag = (PostsListAdapter.PostViewTag) v.getTag(); if (!tag.isPopupDialog) return; isList = false; lastContextMenuPosition = tag.position; model = adapter.getItem(lastContextMenuPosition); } else { return; } } if (pageType == TYPE_POSTSLIST) { menu.add(Menu.NONE, R.id.context_menu_reply, 1, R.string.context_menu_reply); menu.add(Menu.NONE, R.id.context_menu_reply_with_quote, 2, R.string.context_menu_reply_with_quote); menu.add(Menu.NONE, R.id.context_menu_select_text, 3, Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && isList ? R.string.context_menu_select_text : R.string.context_menu_copy_text); menu.add(Menu.NONE, R.id.context_menu_share, 4, R.string.context_menu_share); menu.add(Menu.NONE, R.id.context_menu_hide, 5, R.string.context_menu_hide_post); menu.add(Menu.NONE, R.id.context_menu_delete, 6, R.string.context_menu_delete); menu.add(Menu.NONE, R.id.context_menu_report, 7, R.string.context_menu_report); menu.add(Menu.NONE, R.id.context_menu_subscribe, 8, R.string.context_menu_subscribe); if (!isList) { for (int id : new int[] { R.id.context_menu_reply, R.id.context_menu_reply_with_quote, R.id.context_menu_select_text, R.id.context_menu_share, R.id.context_menu_hide, R.id.context_menu_delete, R.id.context_menu_report, R.id.context_menu_subscribe }) { menu.findItem(id).setOnMenuItemClickListener(contextMenuListener); } } if (presentationModel.source.boardModel.readonlyBoard || tabModel.type == TabModel.TYPE_LOCAL) { menu.findItem(R.id.context_menu_reply).setVisible(false); menu.findItem(R.id.context_menu_reply_with_quote).setVisible(false); } if (model.isDeleted || (!presentationModel.source.boardModel.allowDeletePosts && (!presentationModel.source.boardModel.allowDeleteFiles || model.sourceModel.attachments == null || model.sourceModel.attachments.length == 0)) || tabModel.type == TabModel.TYPE_LOCAL) { menu.findItem(R.id.context_menu_delete).setVisible(false); } if (model.isDeleted || presentationModel.source.boardModel.allowReport == BoardModel.REPORT_NOT_ALLOWED || tabModel.type == TabModel.TYPE_LOCAL) { menu.findItem(R.id.context_menu_report).setVisible(false); } if (settings.isSubscriptionsEnabled()) { if (subscriptions.hasSubscription(chan.getChanName(), presentationModel.source.boardModel.boardName, presentationModel.source.pageModel.threadNumber, model.sourceModel.number)) { menu.findItem(R.id.context_menu_subscribe).setTitle(R.string.context_menu_unsubscribe); } } else { menu.findItem(R.id.context_menu_subscribe).setVisible(false); } } else if (pageType == TYPE_THREADSLIST && isList) { menu.add(Menu.NONE, R.id.context_menu_open_in_new_tab, 1, R.string.context_menu_open_in_new_tab); menu.add(Menu.NONE, R.id.context_menu_thread_preview, 2, R.string.context_menu_thread_preview); menu.add(Menu.NONE, R.id.context_menu_reply_no_reading, 3, R.string.context_menu_reply_no_reading); menu.add(Menu.NONE, R.id.context_menu_hide, 4, R.string.context_menu_hide_thread); if (presentationModel.source.boardModel.readonlyBoard || tabModel.type == TabModel.TYPE_LOCAL) { menu.findItem(R.id.context_menu_reply_no_reading).setVisible(false); } } }
From source file:tw.com.geminihsu.app01.fragment.Fragment_PickUpAirPlane.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item = menu.add(Menu.NONE, ACTIONBAR_MENU_ITEM_SUMMIT, Menu.NONE, getString(R.string.menu_take)); SpannableString spanString = new SpannableString(item.getTitle().toString()); spanString.setSpan(new ForegroundColorSpan(Color.WHITE), 0, spanString.length(), 0); //fix the color to white item.setTitle(spanString);/*from www . j av a 2 s . c o m*/ item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.eugene.fithealthmaingit.UI.NavFragments.FragmentJournalMainHome.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { String[] menuItems = getResources().getStringArray(R.array.context_menu); switch (v.getId()) { case R.id.listSnack: for (int i = 0; i < menuItems.length; i++) { menu.add(Menu.NONE, i, i, menuItems[i]); }/*from ww w . j a v a2 s .c om*/ contextListChoice = 1; break; case R.id.listBreakfast: for (int i = 0; i < menuItems.length; i++) { menu.add(Menu.NONE, i, i, menuItems[i]); } contextListChoice = 2; break; case R.id.listLunch: for (int i = 0; i < menuItems.length; i++) { menu.add(Menu.NONE, i, i, menuItems[i]); } contextListChoice = 3; break; case R.id.listDinner: for (int i = 0; i < menuItems.length; i++) { menu.add(Menu.NONE, i, i, menuItems[i]); } contextListChoice = 4; break; } }
From source file:org.cobaltians.cobalt.activities.CobaltActivity.java
protected void addMenuItem(Menu menu, int order, JSONObject action, final int id, String position, String barsColor) {//from w w w. j a v a 2 s . c o m try { final String name = action.getString(Cobalt.kActionName); String title = action.getString(Cobalt.kActionTitle); boolean visible = action.optBoolean(Cobalt.kActionVisible, true); boolean enabled = action.optBoolean(Cobalt.kActionEnabled, true); final MenuItem menuItem = menu.add(Menu.NONE, id, order, title); int showAsAction = MenuItemCompat.SHOW_AS_ACTION_IF_ROOM; switch (position) { case Cobalt.kPositionBottom: showAsAction = MenuItemCompat.SHOW_AS_ACTION_ALWAYS; break; case Cobalt.kPositionOverflow: showAsAction = MenuItemCompat.SHOW_AS_ACTION_NEVER; break; } MenuItemCompat.setShowAsAction(menuItem, showAsAction); ActionViewMenuItem actionView = new ActionViewMenuItem(this, action, barsColor); actionView.setActionViewMenuItemListener(new WeakReference<>(this)); MenuItemCompat.setActionView(menuItem, actionView); menuItem.setVisible(visible); menuItem.setEnabled(enabled); mMenuItemsHashMap.put(name, actionView); //need this next hashmap to send onPressed when item is on overflow mMenuItemsIdMap.put(id, name); //need this next hashmap to set menuItem mMenuItemByNameMap.put(name, menuItem); } catch (JSONException exception) { if (Cobalt.DEBUG) { Log.w(Cobalt.TAG, TAG + "addMenuItem: action " + action.toString() + " format not supported, use at least {\n" + "\tname: \"name\",\n" + "\ttitle: \"title\",\n" + "}"); } exception.printStackTrace(); } }
From source file:org.uguess.android.sysinfo.ApplicationManager.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem mi = menu.add(Menu.NONE, MI_DELETE, Menu.NONE, R.string.uninstall); mi.setIcon(android.R.drawable.ic_menu_delete); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = menu.add(Menu.NONE, MI_SHARE, Menu.NONE, R.string.share); mi.setIcon(android.R.drawable.ic_menu_share); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_IF_ROOM); if (Util.getSettingsIntent(getActivity().getPackageManager(), "com.android.settings.UsageStats") != null) //$NON-NLS-1$ {// w w w. j a v a 2 s . com mi = menu.add(Menu.NONE, MI_USAGE_STATS, Menu.NONE, R.string.usage_stats); mi.setIcon(android.R.drawable.ic_menu_recent_history); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_NEVER); } mi = menu.add(Menu.NONE, MI_REVERT, Menu.NONE, R.string.restore); mi.setIcon(android.R.drawable.ic_menu_revert); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_ALWAYS); mi = menu.add(Menu.NONE, MI_PREFERENCE, Menu.NONE, R.string.preference); mi.setIcon(android.R.drawable.ic_menu_preferences); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_NEVER); }
From source file:org.alfresco.mobile.android.application.fragments.node.browser.DocumentFolderBrowserFragment.java
public void getMenu(Menu menu) { if (parentFolder == null) { return;/*from ww w . j a v a 2s . com*/ } 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;//from w w w .j a va 2 s.c o m 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.opendatakit.survey.activities.MainMenuActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); PropertiesSingleton props = CommonToolProperties.get(this, getAppName()); int showOption = MenuItem.SHOW_AS_ACTION_IF_ROOM; MenuItem item;//from ww w .j av a 2s.c om if (currentFragment != ScreenList.WEBKIT) { ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.action_bar); actionBar.setDisplayShowCustomEnabled(true); actionBar.show(); item = menu.add(Menu.NONE, MENU_CLOUD_FORMS, Menu.NONE, R.string.sync); item.setIcon(R.drawable.ic_cached_black_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, R.string.about); item.setIcon(R.drawable.ic_info_outline_black_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } else { ActionBar actionBar = getActionBar(); actionBar.hide(); } return true; }
From source file:org.path.episample.android.fragments.NavigateFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v.getId() == android.R.id.list) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; MainMenuActivity.SELECTED_CENSUS = (((CensusListAdapter) getListAdapter()).getItem(info.position)); if (MainMenuActivity.SELECTED_CENSUS != null) { menu.setHeaderTitle(MainMenuActivity.SELECTED_CENSUS.getHeadName() + " (" + MainMenuActivity.SELECTED_CENSUS.getHouseNumber() + ")"); menu.add(Menu.NONE, MENU_START_QUESTIONNAIRE, Menu.NONE, getActivity().getString(R.string.start_questionnaire)); if (mEditSavedData == true) { menu.add(Menu.NONE, MENU_EDIT_POINT, menu.NONE, getActivity().getString(R.string.edit_point)); }/*from ww w . ja v a2s .com*/ if (mMarkAsFinalizedByFriends == true && MainMenuActivity.SELECTED_CENSUS.getProcessed() != 3) { menu.add(Menu.NONE, MENU_MARK_AS_FINALIZED_BY_FRIENDS, menu.NONE, getActivity().getString(R.string.mark_as_finalized_by_friends)); } } } }