List of usage examples for android.content Intent EXTRA_TEXT
String EXTRA_TEXT
To view the source code for android.content Intent EXTRA_TEXT.
Click Source Link
From source file:com.wellsandwhistles.android.redditsp.reddit.api.RedditAPICommentAction.java
public static void onActionMenuItemSelected(final RedditRenderableComment renderableComment, final RedditCommentView commentView, final AppCompatActivity activity, final CommentListingFragment commentListingFragment, final RedditCommentAction action, final RedditChangeDataManager changeDataManager) { final RedditComment comment = renderableComment.getParsedComment().getRawComment(); switch (action) { case UPVOTE://from w w w. j a va 2 s . c o m action(activity, comment, RedditAPI.ACTION_UPVOTE, changeDataManager); break; case DOWNVOTE: action(activity, comment, RedditAPI.ACTION_DOWNVOTE, changeDataManager); break; case UNVOTE: action(activity, comment, RedditAPI.ACTION_UNVOTE, changeDataManager); break; case SAVE: action(activity, comment, RedditAPI.ACTION_SAVE, changeDataManager); break; case UNSAVE: action(activity, comment, RedditAPI.ACTION_UNSAVE, changeDataManager); break; case REPORT: new AlertDialog.Builder(activity).setTitle(R.string.action_report) .setMessage(R.string.action_report_sure) .setPositiveButton(R.string.action_report, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { action(activity, comment, RedditAPI.ACTION_REPORT, changeDataManager); } }).setNegativeButton(R.string.dialog_cancel, null).show(); break; case REPLY: { final Intent intent = new Intent(activity, CommentReplyActivity.class); intent.putExtra(CommentReplyActivity.PARENT_ID_AND_TYPE_KEY, comment.getIdAndType()); intent.putExtra(CommentReplyActivity.PARENT_MARKDOWN_KEY, StringEscapeUtils.unescapeHtml4(comment.body)); activity.startActivity(intent); break; } case EDIT: { final Intent intent = new Intent(activity, CommentEditActivity.class); intent.putExtra("commentIdAndType", comment.getIdAndType()); intent.putExtra("commentText", StringEscapeUtils.unescapeHtml4(comment.body)); activity.startActivity(intent); break; } case DELETE: { new AlertDialog.Builder(activity).setTitle(R.string.accounts_delete).setMessage(R.string.delete_confirm) .setPositiveButton(R.string.action_delete, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { action(activity, comment, RedditAPI.ACTION_DELETE, changeDataManager); } }).setNegativeButton(R.string.dialog_cancel, null).show(); break; } case COMMENT_LINKS: final HashSet<String> linksInComment = comment.computeAllLinks(); if (linksInComment.isEmpty()) { General.quickToast(activity, R.string.error_toast_no_urls_in_comment); } else { final String[] linksArr = linksInComment.toArray(new String[linksInComment.size()]); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setItems(linksArr, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { LinkHandler.onLinkClicked(activity, linksArr[which], false); dialog.dismiss(); } }); final AlertDialog alert = builder.create(); alert.setTitle(R.string.action_comment_links); alert.setCanceledOnTouchOutside(true); alert.show(); } break; case SHARE: final Intent mailer = new Intent(Intent.ACTION_SEND); mailer.setType("text/plain"); mailer.putExtra(Intent.EXTRA_SUBJECT, "Comment by " + comment.author + " on Reddit"); // TODO this currently just dumps the markdown mailer.putExtra(Intent.EXTRA_TEXT, StringEscapeUtils.unescapeHtml4(comment.body) + "\r\n\r\n" + comment.getContextUrl().generateNonJsonUri().toString()); activity.startActivityForResult(Intent.createChooser(mailer, activity.getString(R.string.action_share)), 1); break; case COPY_TEXT: { ClipboardManager manager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); // TODO this currently just dumps the markdown manager.setText(StringEscapeUtils.unescapeHtml4(comment.body)); break; } case COPY_URL: { ClipboardManager manager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); // TODO this currently just dumps the markdown manager.setText(comment.getContextUrl().context(null).generateNonJsonUri().toString()); break; } case COLLAPSE: { commentListingFragment.handleCommentVisibilityToggle(commentView); break; } case USER_PROFILE: LinkHandler.onLinkClicked(activity, new UserProfileURL(comment.author).toString()); break; case PROPERTIES: CommentPropertiesDialog.newInstance(comment).show(activity.getSupportFragmentManager(), null); break; case GO_TO_COMMENT: { LinkHandler.onLinkClicked(activity, comment.getContextUrl().context(null).toString()); break; } case CONTEXT: { LinkHandler.onLinkClicked(activity, comment.getContextUrl().toString()); break; } case ACTION_MENU: showActionMenu(activity, commentListingFragment, renderableComment, commentView, changeDataManager, comment.isArchived()); break; case BACK: activity.onBackPressed(); break; } }
From source file:com.krayzk9s.imgurholo.ui.ImagesFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // handle item selection final Activity activity = getActivity(); switch (item.getItemId()) { case R.id.action_download: Toast.makeText(activity,//ww w . j ava 2 s .c o m String.format(getActivity().getResources().getString(R.string.toast_downloading), urls.size()), Toast.LENGTH_SHORT).show(); Intent serviceIntent = new Intent(activity, DownloadService.class); serviceIntent.putParcelableArrayListExtra("ids", ids); if (albumId != null) serviceIntent.putExtra("albumName", albumId); else serviceIntent.putExtra("albumName", imageCall); activity.startService(serviceIntent); return true; case R.id.action_refresh: urls = new ArrayList<String>(); ids = new ArrayList<JSONParcelable>(); page = 0; makeGallery(); return true; case R.id.action_copy: ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("imgur Link", "http://imgur.com/a/" + albumId); clipboard.setPrimaryClip(clip); Toast.makeText(activity, R.string.toast_copied, Toast.LENGTH_SHORT).show(); return true; case R.id.action_share: Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intent.EXTRA_TEXT, "http://imgur.com/a/" + albumId); startActivity(intent); return true; case R.id.action_new: Intent i = new Intent(this.getActivity().getApplicationContext(), ImageSelectActivity.class); startActivityForResult(i, 1); //select image return true; case R.id.action_comments: if (galleryAlbumData != null) { CommentsAsync commentsAsync = new CommentsAsync(((ImgurHoloActivity) getActivity()), galleryAlbumData); commentsAsync.execute(); return true; } else return super.onOptionsItemSelected(item); default: return super.onOptionsItemSelected(item); } }
From source file:it.mb.whatshare.SendToGCMActivity.java
private void shareViaGCM(Intent intent) { String subject = intent.getExtras().getString(Intent.EXTRA_SUBJECT); String text = intent.getExtras().getString(Intent.EXTRA_TEXT); String type = intent.getExtras().getString(MainActivity.INTENT_TYPE_EXTRA); if (type == null) type = MainActivity.SHARE_VIA_WHATSAPP_EXTRA; if (mustIncludeSubject(subject, text)) { text = subject + " - " + text; }//ww w .j a v a 2s . c o m int sharedWhat = text.contains("http://") ? R.string.link : R.string.selection; Utils.debug("sharing with %s this: '%s'", outboundDevice.type, text); new CallGCM().execute(text, type); tracker.sendEvent("gcm", "share", sharedWhat == R.string.link ? "link" : "text", 0L); showNotification(sharedWhat, MainActivity.SHARE_VIA_WHATSAPP_EXTRA.equals(type)); }
From source file:com.game.simple.Game3.java
public static void sendEmail(String address, String subject, String content) { //---timer---// //StartReConnect(); //-----------// String[] _address = { address.toString() }; Intent email = new Intent(Intent.ACTION_SEND); email.putExtra(Intent.EXTRA_EMAIL, _address); email.putExtra(Intent.EXTRA_SUBJECT, subject); email.putExtra(Intent.EXTRA_TEXT, content); email.setType("message/rfc822"); self.startActivity(Intent.createChooser(email, "Choose an Email client :")); }
From source file:com.stepinmobile.fantasticbutton.api.ButtonHandle.java
/** * This method search in all applications, and if it will find one, which contains in package name parameter <b>type</b>, it will create share intent and return it. * In another case, if application wouldn't be found it will return null. * * @param type part of application package name * @param subject title, which would be applied to created share event * @param text content, which would be provided into share intent * @return created share intent or <b>null</b>, if application wouldn't be found *//*from ww w . j a v a2 s .co m*/ private Intent getShareIntent(String type, String subject, String text) { boolean found = false; Intent share = new Intent(android.content.Intent.ACTION_SEND); share.setType("text/plain"); // gets the list of intents that can be loaded. List<ResolveInfo> resInfo = ((Activity) aq.getContext()).getPackageManager().queryIntentActivities(share, 0); if (!resInfo.isEmpty()) { for (ResolveInfo info : resInfo) { if (info.activityInfo.packageName.toLowerCase().contains(type) || info.activityInfo.name.toLowerCase().contains(type)) { share.putExtra(Intent.EXTRA_SUBJECT, subject); share.putExtra(Intent.EXTRA_TEXT, text); share.setPackage(info.activityInfo.packageName); found = true; break; } } if (!found) return null; return share; } return null; }
From source file:fr.simon.marquis.secretcodes.ui.MainActivity.java
private void sendEmail(ArrayList<SecretCode> secretCodes) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.extra_email) }); i.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.extra_subject)); i.putExtra(Intent.EXTRA_TEXT, generateEmailBody(secretCodes)); i.putExtra(Intent.EXTRA_STREAM, ExportContentProvider.CONTENT_URI); startActivity(Intent.createChooser(i, null)); }
From source file:com.code.android.vibevault.SearchScreen.java
/** Handle user's long-click selection. * *//* w w w .j a v a 2s.c o m*/ @Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo(); if (menuInfo != null) { ArchiveShowObj selShow = (ArchiveShowObj) searchList.getAdapter().getItem(menuInfo.position); switch (item.getItemId()) { case VibeVault.EMAIL_LINK: final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Great show on archive.org: " + selShow.getArtistAndTitle()); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Hey,\n\nYou should listen to " + selShow.getArtistAndTitle() + ". You can find it here: " + selShow.getShowURL() + "\n\nSent using VibeVault for Android."); startActivity(Intent.createChooser(emailIntent, "Send mail...")); return true; case VibeVault.SHOW_INFO: AlertDialog.Builder ad = new AlertDialog.Builder(this); ad.setTitle("Show Info"); View v = LayoutInflater.from(this).inflate(R.layout.scrollable_dialog, null); ((TextView) v.findViewById(R.id.DialogText)).setText(selShow.getSource()); ad.setPositiveButton("Okay.", new android.content.DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int arg1) { } }); ad.setView(v); ad.show(); return true; case (VibeVault.ADD_TO_FAVORITE_LIST): VibeVault.db.insertFavoriteShow(selShow); return true; default: return false; } } return false; }
From source file:name.zurell.kirk.apps.android.rhetolog.RhetologApplication.java
/** Called when a session detail view asks to send session results somewhere. * Generates a link to the session report Uri, and lets the remote program read from it. * The {@link RhetologContentProvider} generates the result file on demand. * /*from w ww . j a v a 2 s.c o m*/ * */ @Override public void onSessionSend(Context context, Uri session) { // Send to the program selected by the chooser below. Intent sendSession = new Intent(Intent.ACTION_SEND); // Permit to read from Rhetolog URIs. sendSession.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // Note type of send as report. sendSession.setType(RhetologContract.RHETOLOG_TYPE_SESSION_REPORT); sendSession.putExtra(Intent.EXTRA_SUBJECT, "Sending session " + session); // Send text as text. sendSession.putExtra(Intent.EXTRA_TEXT, reportForSession(session)); // Send text as URI to be read. sendSession.putExtra(Intent.EXTRA_STREAM, Uri.parse(RhetologContract.SESSIONSREPORT + "/" + session.getLastPathSegment())); // Permit user to choose target of send. context.startActivity(Intent.createChooser(sendSession, "Send session results")); }
From source file:barqsoft.footballscores.Fragments.DetailFragment.java
public Intent createShareForecastIntent(String ShareText) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, ShareText + getString(R.string.football_scores_hashtag)); return shareIntent; }
From source file:com.baruckis.nanodegree.spotifystreamer.PlayerService.java
private void updateShareTrackURL() { CustomTrack track = getCurrentTrack(); if (track == null) return;/*from w w w.ja va 2 s .c o m*/ Intent shareIntent = new Intent(BaseActivity.RECEIVE_BROADCAST_INTENT_SHARE_UPDATE); shareIntent.putExtra(Intent.EXTRA_TEXT, track.getExternalUrl()); LocalBroadcastManager.getInstance(this).sendBroadcast(shareIntent); }