@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.operation, menu); mMenu = menu; mSharePanoramaMenuItem = menu.findItem(R.id.action_share_panorama); if (mSharePanoramaMenuItem != null) { mSharePanoramaActionProvider = (ShareActionProvider) mSharePanoramaMenuItem .getActionProvider(); mSharePanoramaActionProvider.setOnShareTargetSelectedListener( mShareTargetSelectedListener); mSharePanoramaActionProvider.setShareHistoryFileName("panorama_share_history.xml"); } mShareMenuItem = menu.findItem(R.id.action_share); if (mShareMenuItem != null) { mShareActionProvider = (ShareActionProvider) mShareMenuItem .getActionProvider(); mShareActionProvider.setOnShareTargetSelectedListener( mShareTargetSelectedListener); mShareActionProvider.setShareHistoryFileName("share_history.xml"); } return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // 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. Intent shareIntent = new org.bbs.apklauncher.emb.IntentHelper(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate your menu. getMenuInflater().inflate(R.menu.action_bar_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()); // Set file with share history to the provider and set the share intent. MenuItem overflowItem = menu.findItem(R.id.menu_item_share_action_provider_overflow); ShareActionProvider overflowProvider = (ShareActionProvider) overflowItem.getActionProvider(); overflowProvider.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. overflowProvider.setShareIntent(createShareIntent()); return true; }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.actionbar_menu_browserwebfragment, menu); MenuItem item = menu.findItem(R.id.menu_share); mShareActionProvider = (ShareActionProvider) item.getActionProvider(); refreshItem = menu.findItem(R.id.menu_refresh); super.onCreateOptionsMenu(menu, inflater); if (Utility.isWeiboAccountDomainLink(mUrl)) { String result = Utility.getDomainFromWeiboAccountLink(mUrl); Intent intent = new Intent(getActivity(), UserInfoActivity.class); intent.putExtra("domain", result); getActivity().startActivity(intent); getActivity().finish(); } else if (Utility.isWeiboMid(mUrl)) { String mid = Utility.getMidFromUrl(mUrl); RedirectLinkToWeiboIdTask task = new RedirectLinkToWeiboIdTask(BrowserWebFragment.this, mUrl, mid); task.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR); } else { mWebView.loadUrl(mUrl); } }
public void createActionBarMenu(int menuRes, Menu menu) { mActivity.getMenuInflater().inflate(menuRes, menu); mActionBarMenu = menu; MenuItem item = menu.findItem(R.id.action_share_panorama); if (item != null) { mSharePanoramaActionProvider = (ShareActionProvider) item.getActionProvider(); mSharePanoramaActionProvider .setShareHistoryFileName("panorama_share_history.xml"); mSharePanoramaActionProvider.setShareIntent(mSharePanoramaIntent); } item = menu.findItem(R.id.action_share); if (item != null) { mShareActionProvider = (ShareActionProvider) item.getActionProvider(); mShareActionProvider .setShareHistoryFileName("share_history.xml"); mShareActionProvider.setShareIntent(mShareIntent); } }
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.movie, menu); // Document says EXTRA_STREAM should be a content: Uri // So, we only share the video if it's "content:". MenuItem shareItem = menu.findItem(R.id.action_share); if (ContentResolver.SCHEME_CONTENT.equals(mUri.getScheme())) { shareItem.setVisible(true); ((ShareActionProvider) shareItem.getActionProvider()) .setShareIntent(createShareIntent()); } else { shareItem.setVisible(false); } return true; }
@Override public boolean onShareTargetSelected(ShareActionProvider arg0, Intent arg1) { // First, let's tell the SharedImageProvider that it will need to wait // for the image Uri uri = Uri.withAppendedPath(SharedImageProvider.CONTENT_URI, Uri.encode(mSharedOutputFile.getAbsolutePath())); ContentValues values = new ContentValues(); values.put(SharedImageProvider.PREPARE, true); getContentResolver().insert(uri, values); mSharingImage = true; // Process and save the image in the background. showSavingProgress(null); mImageShow.saveImage(this, mSharedOutputFile); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.filtershow_activity_menu, menu); MenuItem showState = menu.findItem(R.id.showImageStateButton); if (mShowingImageStatePanel) { showState.setTitle(R.string.hide_imagestate_panel); } else { showState.setTitle(R.string.show_imagestate_panel); } mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_share) .getActionProvider(); mShareActionProvider.setShareIntent(getDefaultShareIntent()); mShareActionProvider.setOnShareTargetSelectedListener(this); mMenu = menu; setupMenu(); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.operations, menu); mActionBarMenu = menu; // Configure the standard share action provider MenuItem item = menu.findItem(R.id.action_share); mStandardShareActionProvider = (ShareActionProvider) item.getActionProvider(); mStandardShareActionProvider.setShareHistoryFileName("standard_share_history.xml"); if (mStandardShareIntent != null) { mStandardShareActionProvider.setShareIntent(mStandardShareIntent); } // Configure the panorama share action provider item = menu.findItem(R.id.action_share_panorama); mPanoramaShareActionProvider = (ShareActionProvider) item.getActionProvider(); mPanoramaShareActionProvider.setShareHistoryFileName("panorama_share_history.xml"); if (mPanoramaShareIntent != null) { mPanoramaShareActionProvider.setShareIntent(mPanoramaShareIntent); } return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.share_file, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_item_share); // Fetch and store ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider(); this.menu = menu; // Calling super after populating the menu is necessary here to ensure that the // action bar helpers have a chance to handle this event. return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // 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. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(final Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_show_location, menu); final MenuItem item = menu.findItem(R.id.action_share_location); if (item.getActionProvider() != null && loc != null) { final ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider(); final Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TEXT, createGeoUri().toString()); shareIntent.setType("text/plain"); mShareActionProvider.setShareIntent(shareIntent); } else { // This isn't really necessary, but while I was testing it was useful. Possibly remove it? item.setVisible(false); } return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { System.out.println("[WebViewActivity] onCreateOptionsMenu " + url); // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.webview, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.action_share); // Fetch and store ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider(); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, url); setShareIntent(intent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.game, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_item_share); // Fetch and store ShareActionProvider ShareActionProvider provider = (ShareActionProvider) item.getActionProvider(); if (provider != null) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, game.getTitle() + " " + game.getUrl()); sendIntent.setType("text/plain"); provider.setShareIntent(sendIntent); } return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main_menu, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.action_share); // Fetch and store ShareActionProvider ShareActionProvider shareActionProvider = (ShareActionProvider) item .getActionProvider(); // set the log content as share content Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getResources().getString(R.string.action_share_subject)); shareIntent.putExtra(Intent.EXTRA_TEXT, AppController.getInstance() .getLog()); shareIntent.setType("text/plain"); shareActionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.recipe_viewer, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_item_share); // Fetch and store ShareActionProvider ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider(); Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, name+": "+url); sendIntent.setType("text/plain"); mShareActionProvider.setShareIntent(sendIntent); return true; }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.actionbar_menu_browserwebfragment, menu); MenuItem item = menu.findItem(R.id.menu_share); mShareActionProvider = (ShareActionProvider) item.getActionProvider(); refreshItem = menu.findItem(R.id.menu_refresh); super.onCreateOptionsMenu(menu, inflater); if (Utility.isWeiboAccountDomainLink(mUrl)) { String result = Utility.getDomainFromWeiboAccountLink(mUrl); Intent intent = new Intent(getActivity(), UserInfoActivity.class); intent.putExtra("domain", result); getActivity().startActivity(intent); getActivity().finish(); } else if (Utility.isWeiboMid(mUrl)) { String mid = Utility.getMidFromUrl(mUrl); RedirectLinkToWeiboIdTask task = new RedirectLinkToWeiboIdTask( BrowserWebFragment.this, mUrl, mid); task.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR); } else { mWebView.loadUrl(mUrl); } }
@Override public boolean onCreateOptionsMenu(Menu menu) { if (msg == null) { return super.onCreateOptionsMenu(menu); } getMenuInflater().inflate(R.menu.actionbar_menu_browserweibomsgactivity, menu); if (msg.getUser() != null && msg.getUser().getId() .equals(GlobalContext.getInstance().getCurrentAccountId())) { menu.findItem(R.id.menu_delete).setVisible(true); } MenuItem item = menu.findItem(R.id.menu_share); shareActionProvider = (ShareActionProvider) item.getActionProvider(); return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { // 创建标题栏菜单 getMenuInflater().inflate(R.menu.main, menu); // 设置分享 MenuItem item = menu.findItem(R.id.action_share); ShareActionProvider provider = (ShareActionProvider) item .getActionProvider(); // 定义分享的Intent Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "share"); intent.putExtra(Intent.EXTRA_TEXT, "share by Action Provider"); provider.setShareIntent(intent); return true; }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (BuildConfig.DEBUG) Log.d(getLogTag(), "onCreateOptionsMenu"); inflater.inflate(R.menu.photoviewer_menu, menu); mFavoriteButton = menu.findItem(R.id.menu_favorite); mWallpaperButton = menu.findItem(R.id.menu_set_wallpaper); /* The task could return before this has inflated, so make sure it's up * to date */ if (mPhotoExtendedInfo != null) { updateFavoriteButtonIcon(mPhotoExtendedInfo.isFavorite()); } /* Set file with share history to the provider and set the share * intent. */ MenuItem shareActionItem = menu.findItem(R.id.menu_share); ShareActionProvider shareActionProvider = (ShareActionProvider) shareActionItem.getActionProvider(); shareActionProvider.setShareHistoryFileName( ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); shareActionProvider.setShareIntent(createShareIntent()); }
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { // Inflate a menu resource providing context menu items MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.context_action, menu); try { /** Getting the actionprovider associated with the menu item whose id is share */ mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_item_share).getActionProvider(); /** Setting a share intent */ mShareActionProvider.setShareIntent(getStringShareIntent("")); } catch(Exception e){ e.printStackTrace(); } return true; }
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { this.actionMode = mode; mode.getMenuInflater().inflate(R.menu.podcast_list_context, menu); sharePodcastMenuItem = menu.findItem(R.id.podcast_share_menuitem); editAuthMenuItem = menu.findItem(R.id.edit_auth_contextmenuitem); sendSuggestionMenuItem = menu.findItem(R.id.suggest_podcast_contextmenuitem); selectAllMenuItem = menu.findItem(R.id.podcast_select_all_contextmenuitem); // Make sure we are notified when the share action is selected // so we can finish the action mode and close the context menu ((ShareActionProvider) sharePodcastMenuItem.getActionProvider()).setOnShareTargetSelectedListener(this); return true; }
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { this.actionMode = mode; mode.getMenuInflater().inflate(R.menu.episode_list_context, menu); newMenuItem = menu.findItem(R.id.episode_new_contextmenuitem); oldMenuItem = menu.findItem(R.id.episode_old_contextmenuitem); downloadMenuItem = menu.findItem(R.id.episode_download_contextmenuitem); deleteMenuItem = menu.findItem(R.id.episode_remove_contextmenuitem); addToPlaylistMenuItem = menu.findItem(R.id.episode_add_to_playlist_contextmenuitem); removeFromPlaylistMenuItem = menu.findItem(R.id.episode_remove_from_playlist_contextmenuitem); shareEpisodeMenuItem = menu.findItem(R.id.episode_share_contextmenuitem); selectAllMenuItem = menu.findItem(R.id.episode_select_all_contextmenuitem); // Make sure we are notified when the share action is selected // so we can finish the action mode and close the context menu ((ShareActionProvider) shareEpisodeMenuItem.getActionProvider()).setOnShareTargetSelectedListener(this); return true; }
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { this.actionMode = mode; mode.getMenuInflater().inflate(R.menu.episode_list_context, menu); downloadMenuItem = menu.findItem(R.id.episode_download_contextmenuitem); deleteMenuItem = menu.findItem(R.id.episode_remove_contextmenuitem); shareEpisodeMenuItem = menu.findItem(R.id.episode_share_contextmenuitem); selectAllMenuItem = menu.findItem(R.id.episode_select_all_contextmenuitem); // Make sure we are notified when the share action is selected // so we can finish the action mode and close the context menu ((ShareActionProvider) shareEpisodeMenuItem.getActionProvider()).setOnShareTargetSelectedListener(this); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate menu resource file. getMenuInflater().inflate(R.menu.share_menu, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_item_share); // Fetch and store ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider(); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TEXT, " https://play.google.com/store/apps/details?id=com.icareyou.highwaycal"); shareIntent.setType("text/plain"); if (mShareActionProvider != null) mShareActionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(final Menu menu) { this.menu = menu; final MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); super.onCreateOptionsMenu(menu); // manage menu actions menu.findItem(R.id.action_previous_move).setEnabled(!game.isFirstMove()); menu.findItem(R.id.action_next_move).setEnabled(!game.isLastMove()); final MenuItem item = menu.findItem(R.id.action_share); shareActionProvider = (ShareActionProvider) item.getActionProvider(); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.webview_menu, menu); // Set up browser controls browserControls.backItem = menu.findItem(R.id.browser_back); browserControls.forwardItem= menu.findItem(R.id.browser_forward); browserControls.reloadItem = menu.findItem(R.id.browser_reload); browserControls.mobilizerItem = menu.findItem(R.id.browser_reader_toggle); // Set up ShareActionProvider browserControls.shareItem = menu.findItem(R.id.browser_share); mShareActionProvider = (ShareActionProvider) browserControls.shareItem.getActionProvider(); // Show the last app used: //mShareActionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Set a "send action" intent Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, articleLink); mShareActionProvider.setShareIntent(browserControls.createShareIntent()); browserControls.update(); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.comments_menu, menu); MenuItem shareItem = menu.findItem(R.id.comments_share); ShareActionProvider mShareActionProvider = (ShareActionProvider) shareItem.getActionProvider(); // Set a "send action" intent Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, commentsUrl); mShareActionProvider.setShareIntent(createShareIntent()); return true; }