Java Code Examples for com.actionbarsherlock.view.Menu#findItem()
The following examples show how to use
com.actionbarsherlock.view.Menu#findItem() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeoARActivity.java From geoar-app with Apache License 2.0 | 6 votes |
@Override public boolean onPrepareOptionsMenu(Menu menu) { // Set data source action providers here, since it depends on this // instance MenuItem menuItem = menu.findItem(R.id.item_map_datasource); if (menuItem != null) menuItem.setActionProvider(new DataSourcesActionProvider( Visualization.MapVisualization.class)); menuItem = menu.findItem(R.id.item_ar_datasource); if (menuItem != null) menuItem.setActionProvider(new DataSourcesActionProvider( Visualization.ARVisualization.class)); menuItem = menu.findItem(R.id.item_map); if (menuItem != null) IntroController.addViewToStep(7, menuItem.getActionView()); return super.onPrepareOptionsMenu(menu); }
Example 2
Source File: ChannelStreamFragment.java From buddycloud-android with Apache License 2.0 | 6 votes |
@Override public void createOptions(Menu menu) { if (!isAttachedToActivity()) { return; } getSherlockActivity().getSupportMenuInflater().inflate( R.menu.channel_fragment_options, menu); MenuItem followItem = menu.findItem(R.id.menu_follow); if (SubscribedChannelsModel.isFollowing(getRole())) { followItem.setTitle(R.string.menu_unfollow); } else { followItem.setTitle(R.string.menu_follow); } MenuItem pendingSubscriptionsItem = menu.findItem(R.id.menu_pending_subscriptions); boolean canApprove = SubscribedChannelsModel.canChangeAffiliation(getRole()); pendingSubscriptionsItem.setVisible(canApprove); MenuItem deleteChannelItem = menu.findItem(R.id.menu_delete_channel); JSONObject metadata = ChannelMetadataModel.getInstance().getFromCache(getActivity(), getChannelJid()); boolean isPersonal = metadata == null || metadata.optString("channelType").equals("personal"); boolean canDelete = SubscribedChannelsModel.canDeleteChannel(getRole()); deleteChannelItem.setVisible(canDelete && !isPersonal); }
Example 3
Source File: ResultActivity.java From ContentProviderHelper with MIT License | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.result_activity, menu); MenuItem item = menu.findItem(R.id.share); ShareActionProvider shareActionProvider = (ShareActionProvider) item.getActionProvider(); Intent shareIntent = createShareIntent(); shareActionProvider.setShareIntent(shareIntent); return super.onCreateOptionsMenu(menu); }
Example 4
Source File: GalleryView.java From Favorite-Android-Client with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem item; if(edit_mode){ menu.add(0, 1, 0, getString(R.string.ok)).setIcon(R.drawable.accept) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); }else{ // Inflate your menu. getSupportMenuInflater().inflate(R.menu.share_action_provider, menu); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu .findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem .getActionProvider(); actionProvider .setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. actionProvider.setShareIntent(createShareIntent()); } return true; }
Example 5
Source File: AddEditHostActivity.java From hosts-editor-android with Apache License 2.0 | 5 votes |
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem item = menu.findItem(R.id.action_add_rm_comment); if (mFragment.hasComment()) { item.setTitle(R.string.action_remove_comment); } else { item.setTitle(R.string.action_add_comment); } return super.onPrepareOptionsMenu(menu); }
Example 6
Source File: ListHostsActivity.java From hosts-editor-android with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.list_menu, menu); // Init search mSearchItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) mSearchItem.getActionView(); if (searchView != null) { searchView.setQueryHint(getString(R.string.action_search)); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { mSearchItem.collapseActionView(); return true; } @Override public boolean onQueryTextChange(String newText) { Timber.d("Search query: %s", newText); setSearchQuery(newText); mFragment.filterList(newText); return true; } }); } return true; }
Example 7
Source File: FollowersAdapter.java From buddycloud-android with Apache License 2.0 | 5 votes |
@Override protected void onCreateActionMode(ActionMode mode, Menu menu) { MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.channel_followers_options, menu); if (!SubscribedChannelsModel.canMakeModerator(role)) { MenuItem menuModerator = menu.findItem(R.id.menu_role_moderator); menuModerator.setVisible(false); } }
Example 8
Source File: LoginActivity.java From buddycloud-android with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.login_screen_options, menu); MenuItem item = menu.findItem(R.id.menu_signup); if (item != null) { item.setTitle(getString(R.string.signup_button).toUpperCase(Locale.ENGLISH)); } return super.onCreateOptionsMenu(menu); }
Example 9
Source File: StyledActivity.java From RefreshActionItem with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.save, menu); MenuItem item = menu.findItem(R.id.save_button); mSaveButton = (RefreshActionItem) item.getActionView(); mSaveButton.setMenuItem(item); mSaveButton.setMax(100); mSaveButton.setRefreshActionListener(this); String[] items = generateRandomItemList(); setListAdapter(new ArrayAdapter<String>(getApplicationContext(), R.layout.simple_list_item, android.R.id.text1, items)); return true; }
Example 10
Source File: BasicUsageActivity.java From RefreshActionItem with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.refresh, menu); MenuItem item = menu.findItem(R.id.refresh_button); mRefreshActionItem = (RefreshActionItem) item.getActionView(); mRefreshActionItem.setMenuItem(item); mRefreshActionItem.setMax(100); mRefreshActionItem.setRefreshActionListener(this); loadData(); return true; }
Example 11
Source File: IndeterminateProgressActivity.java From RefreshActionItem with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.refresh, menu); MenuItem item = menu.findItem(R.id.refresh_button); mRefreshActionItem = (RefreshActionItem)item.getActionView(); mRefreshActionItem.setMenuItem(item); mRefreshActionItem.setProgressIndicatorType(ProgressIndicatorType.INDETERMINATE); mRefreshActionItem.setRefreshActionListener(this); loadData(); return true; }
Example 12
Source File: BadgeActivity.java From RefreshActionItem with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.refresh, menu); MenuItem item = menu.findItem(R.id.refresh_button); mRefreshActionItem = (RefreshActionItem) item.getActionView(); mRefreshActionItem.setMenuItem(item); mRefreshActionItem.setMax(100); mRefreshActionItem.setRefreshActionListener(this); loadData(); return true; }
Example 13
Source File: ListHostsFragment.java From hosts-editor-android with Apache License 2.0 | 4 votes |
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { mEditMenuItem = menu.findItem(R.id.cab_action_edit); return false; }
Example 14
Source File: PostDetailFragment.java From Broadsheet.ie-Android with MIT License | 4 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); if (mPost != null) { inflater.inflate(R.menu.post_detail, menu); menu.findItem(R.id.menu_make_comment).setVisible(mPost.getComment_status().equals("open")); menu.findItem(R.id.menu_view_comments).setVisible((mPost.getComment_count() > 0)); MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); mActionProvider = (ShareActionProvider) actionItem.getActionProvider(); mActionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); mActionProvider.setShareIntent(createShareIntent()); } }