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.dvdprime.mobile.android.ui.DocumentViewActivity.java
private Response.Listener<JSONObject> createShortenerReqSuccessListener() { return new Response.Listener<JSONObject>() { public void onResponse(JSONObject result) { try { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, getSupportActionBar().getSubtitle()); Object[] data = new Object[2]; data[0] = getSupportActionBar().getSubtitle(); data[1] = result.getString("id"); intent.putExtra(Intent.EXTRA_TEXT, StringUtil.format("[DP]{0} - {1}", data)); startActivity(Intent.createChooser(intent, getString(R.string.action_bar_share_with))); return; } catch (JSONException localJSONException) { LOGD(TAG, "Parse error"); }//ww w. j a v a2 s. c om } }; }
From source file:com.andrewshu.android.reddit.threads.ThreadsListActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info; info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); ThingInfo _item = mThreadsAdapter.getItem(info.position); switch (item.getItemId()) { case Constants.VIEW_SUBREDDIT_CONTEXT_ITEM: new MyDownloadThreadsTask(_item.getSubreddit()).execute(); return true; case Constants.SHARE_CONTEXT_ITEM: Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, _item.getUrl()); try {/*from w ww .j a v a2s. c o m*/ startActivity(Intent.createChooser(intent, "Share Link")); } catch (android.content.ActivityNotFoundException ex) { if (Constants.LOGGING) Log.e(TAG, "Share Link", ex); } return true; case Constants.OPEN_IN_BROWSER_CONTEXT_ITEM: setLinkClicked(_item); Common.launchBrowser(this, _item.getUrl(), Util.createThreadUri(_item).toString(), false, true, true, mSettings.isSaveHistory()); return true; case Constants.SAVE_CONTEXT_ITEM: new SaveTask(true, _item, mSettings, getApplicationContext()).execute(); return true; case Constants.UNSAVE_CONTEXT_ITEM: new SaveTask(false, _item, mSettings, getApplicationContext()).execute(); return true; case Constants.HIDE_CONTEXT_ITEM: new MyHideTask(true, _item, mSettings, getApplicationContext()).execute(); return true; case Constants.UNHIDE_CONTEXT_ITEM: new MyHideTask(false, _item, mSettings, getApplicationContext()).execute(); case Constants.DIALOG_VIEW_PROFILE: Intent i = new Intent(this, ProfileActivity.class); i.setData(Util.createProfileUri(_item.getAuthor())); startActivity(i); return true; default: return super.onContextItemSelected(item); } }
From source file:com.android.messaging.datamodel.BugleNotifications.java
private static void addWearableVoiceReplyAction(final WearableExtender wearableExtender, final NotificationState notificationState) { if (!(notificationState instanceof MultiMessageNotificationState)) { return;/*from www .j a v a 2 s.co m*/ } final MultiMessageNotificationState multiMessageNotificationState = (MultiMessageNotificationState) notificationState; final Context context = Factory.get().getApplicationContext(); final String conversationId = notificationState.mConversationIds.first(); final ConversationLineInfo convInfo = multiMessageNotificationState.mConvList.mConvInfos.get(0); final String selfId = convInfo.mSelfParticipantId; final boolean requiresMms = MmsSmsUtils.getRequireMmsForEmailAddress(convInfo.mIncludeEmailAddress, convInfo.mSubId) || (convInfo.mIsGroup && MmsUtils.groupMmsEnabled(convInfo.mSubId)); final int requestCode = multiMessageNotificationState.getReplyIntentRequestCode(); final PendingIntent replyPendingIntent = UIIntents.get().getPendingIntentForSendingMessageToConversation( context, conversationId, selfId, requiresMms, requestCode); final int replyLabelRes = requiresMms ? R.string.notification_reply_via_mms : R.string.notification_reply_via_sms; final NotificationCompat.Action.Builder actionBuilder = new NotificationCompat.Action.Builder( R.drawable.ic_wear_reply, context.getString(replyLabelRes), replyPendingIntent); final String[] choices = context.getResources().getStringArray(R.array.notification_reply_choices); final RemoteInput remoteInput = new RemoteInput.Builder(Intent.EXTRA_TEXT) .setLabel(context.getString(R.string.notification_reply_prompt)).setChoices(choices).build(); actionBuilder.addRemoteInput(remoteInput); wearableExtender.addAction(actionBuilder.build()); }
From source file:com.mibr.android.intelligentreminder.INeedToo.java
public void TrialIsEndingWarningOrLicensingFailed(String verbiage, Boolean wereDealingWithLicensingHere) { final Boolean wdwlh = wereDealingWithLicensingHere; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(verbiage).setCancelable(false) .setNeutralButton(R.string.msg_cus, new DialogInterface.OnClickListener() { @Override/*from w ww . j a va2 s .c om*/ public void onClick(DialogInterface dialog, int id) { String[] mailto = { "diamondsoftware222@gmail.com", "" }; Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "".toString()); sendIntent.putExtra(Intent.EXTRA_TEXT, "".toString()); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, "Send EMail...")); } }).setPositiveButton(R.string.msg_register, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { Intent i4 = new Intent(INeedToo.this, INeedToPay.class); startActivity(i4); } }).setNegativeButton(R.string.msg_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (wdwlh) { INeedToo.this.finish(); } } }); AlertDialog alert = builder.create(); try { alert.show(); } catch (Exception ee33) { int bkhere = 3; int bkhere2 = bkhere; } }
From source file:com.aimfire.gallery.GalleryActivity.java
/** * share only to certain apps. code based on "http://stackoverflow.com/questions/ * 9730243/how-to-filter-specific-apps-for-action-send-intent-and-set-a-different- * text-for/18980872#18980872"/*from w w w. j a v a2s . c o m*/ * * "copy link" inspired by http://cketti.de/2016/06/15/share-url-to-clipboard/ * * in general, "deep linking" is supported by the apps below. Facebook, Wechat, * Telegram are exceptions. click on the link would bring users to the landing * page. * * Facebook doesn't take our EXTRA_TEXT so user will have to "copy link" first * then paste the link */ private void shareMedia(Intent data) { /* * we log this as "share complete", but user can still cancel the share at this point, * and we wouldn't be able to know */ mFirebaseAnalytics.logEvent(MainConsts.FIREBASE_CUSTOM_EVENT_SHARE_COMPLETE, null); Resources resources = getResources(); /* * get the resource id for the shared file */ String id = data.getStringExtra(MainConsts.EXTRA_ID_RESOURCE); /* * construct link */ String link = "https://" + resources.getString(R.string.app_domain) + "/?id=" + id + "&name=" + ((mPreviewName != null) ? mPreviewName : mMediaName); /* * message subject and text */ String emailSubject, emailText, twitterText; if (MediaScanner.isPhoto(mMediaPath)) { emailSubject = resources.getString(R.string.emailSubjectPhoto); emailText = resources.getString(R.string.emailBodyPhotoPrefix) + link; twitterText = resources.getString(R.string.emailBodyPhotoPrefix) + link + resources.getString(R.string.twitterHashtagPhoto) + resources.getString(R.string.app_hashtag); } else if (MediaScanner.is3dMovie(mMediaPath)) { emailSubject = resources.getString(R.string.emailSubjectVideo); emailText = resources.getString(R.string.emailBodyVideoPrefix) + link; twitterText = resources.getString(R.string.emailBodyVideoPrefix) + link + resources.getString(R.string.twitterHashtagVideo) + resources.getString(R.string.app_hashtag); } else //if(MediaScanner.is2dMovie(mMediaPath)) { emailSubject = resources.getString(R.string.emailSubjectVideo2d); emailText = resources.getString(R.string.emailBodyVideoPrefix2d) + link; twitterText = resources.getString(R.string.emailBodyVideoPrefix2d) + link + resources.getString(R.string.twitterHashtagVideo) + resources.getString(R.string.app_hashtag); } Intent emailIntent = new Intent(); emailIntent.setAction(Intent.ACTION_SEND); // Native email client doesn't currently support HTML, but it doesn't hurt to try in case they fix it emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject); emailIntent.putExtra(Intent.EXTRA_TEXT, emailText); //emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(resources.getString(R.string.share_email_native))); emailIntent.setType("message/rfc822"); PackageManager pm = getPackageManager(); Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.setType("text/plain"); Intent openInChooser = Intent.createChooser(emailIntent, resources.getString(R.string.share_chooser_text)); List<ResolveInfo> resInfo = pm.queryIntentActivities(sendIntent, 0); List<LabeledIntent> intentList = new ArrayList<LabeledIntent>(); for (int i = 0; i < resInfo.size(); i++) { // Extract the label, append it, and repackage it in a LabeledIntent ResolveInfo ri = resInfo.get(i); String packageName = ri.activityInfo.packageName; if (packageName.contains("android.email")) { emailIntent.setPackage(packageName); } else if (packageName.contains("twitter") || packageName.contains("facebook") || packageName.contains("whatsapp") || packageName.contains("tencent.mm") || //wechat packageName.contains("line") || packageName.contains("skype") || packageName.contains("viber") || packageName.contains("kik") || packageName.contains("sgiggle") || //tango packageName.contains("kakao") || packageName.contains("telegram") || packageName.contains("nimbuzz") || packageName.contains("hike") || packageName.contains("imoim") || packageName.contains("bbm") || packageName.contains("threema") || packageName.contains("mms") || packageName.contains("android.apps.messaging") || //google messenger packageName.contains("android.talk") || //google hangouts packageName.contains("android.gm")) { Intent intent = new Intent(); intent.setComponent(new ComponentName(packageName, ri.activityInfo.name)); intent.setAction(Intent.ACTION_SEND); intent.setType("text/plain"); if (packageName.contains("twitter")) { intent.putExtra(Intent.EXTRA_TEXT, twitterText); } else if (packageName.contains("facebook")) { /* * the warning below is wrong! at least on GS5, Facebook client does take * our text, however it seems it takes only the first hyperlink in the * text. * * Warning: Facebook IGNORES our text. They say "These fields are intended * for users to express themselves. Pre-filling these fields erodes the * authenticity of the user voice." * One workaround is to use the Facebook SDK to post, but that doesn't * allow the user to choose how they want to share. We can also make a * custom landing page, and the link will show the <meta content ="..."> * text from that page with our link in Facebook. */ intent.putExtra(Intent.EXTRA_TEXT, link); } else if (packageName.contains("tencent.mm")) //wechat { /* * wechat appears to do this similar to Facebook */ intent.putExtra(Intent.EXTRA_TEXT, link); } else if (packageName.contains("android.gm")) { // If Gmail shows up twice, try removing this else-if clause and the reference to "android.gm" above intent.putExtra(Intent.EXTRA_SUBJECT, emailSubject); intent.putExtra(Intent.EXTRA_TEXT, emailText); //intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(resources.getString(R.string.share_email_gmail))); intent.setType("message/rfc822"); } else if (packageName.contains("android.apps.docs")) { /* * google drive - no reason to send link to it */ continue; } else { intent.putExtra(Intent.EXTRA_TEXT, emailText); } intentList.add(new LabeledIntent(intent, packageName, ri.loadLabel(pm), ri.icon)); } } /* * create "Copy Link To Clipboard" Intent */ Intent clipboardIntent = new Intent(this, CopyToClipboardActivity.class); clipboardIntent.setData(Uri.parse(link)); intentList.add(new LabeledIntent(clipboardIntent, getPackageName(), getResources().getString(R.string.clipboard_activity_name), R.drawable.ic_copy_link)); // convert intentList to array LabeledIntent[] extraIntents = intentList.toArray(new LabeledIntent[intentList.size()]); openInChooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents); startActivity(openInChooser); }
From source file:com.hivewallet.androidclient.wallet.ui.WalletActivity.java
private boolean archiveWalletBackup(@Nonnull final File file) { Uri shareableUri = null;/*from w ww. j av a2 s . c o m*/ try { shareableUri = FileProvider.getUriForFile(this, Constants.FILE_PROVIDER_AUTHORITY, file); } catch (IllegalArgumentException e) { throw new RuntimeException("Backup file cannot be shared", e); } log.info("Shareable URI: {}", shareableUri); final Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.export_keys_dialog_mail_subject)); intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.export_keys_dialog_mail_text) + "\n\n" + String.format(Constants.WEBMARKET_APP_URL, getPackageName()) + "\n\n" + Constants.SOURCE_URL + '\n'); intent.setType(Constants.MIMETYPE_WALLET_BACKUP); intent.putExtra(Intent.EXTRA_STREAM, shareableUri); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); try { startActivity(Intent.createChooser(intent, getString(R.string.export_keys_dialog_mail_intent_chooser))); log.info("invoked chooser for archiving wallet backup"); return true; } catch (final Exception x) { longToast(R.string.export_keys_dialog_mail_intent_failed); log.error("archiving wallet backup failed", x); return false; } }
From source file:org.planetmono.dcuploader.ActivityUploader.java
@SuppressWarnings("unchecked") @Override//from w w w . ja va2 s .co m public void onCreate(Bundle savedState) { super.onCreate(savedState); initViews(); if (formLocation) queryLocation(true); if (savedState != null) { if (savedState.containsKey("tempfile")) tempFile = new File(savedState.getString("tempfile")); if (savedState.containsKey("target")) resolveTarget(savedState.getString("target")); if (savedState.containsKey("tempfiles")) tempFiles = savedState.getStringArrayList("tempfiles"); if (savedState.containsKey("contents")) { contents = new ArrayList<Uri>(); String[] carr = savedState.getStringArray("contents"); for (String s : carr) contents.add(Uri.parse(s)); } } postfix = "from <a href=\"http://palladium.planetmono.org/dcuploader\">DCUploader</a>"; Button uploadVisit = (Button) findViewById(R.id.upload_visit); if (passThrough || target == null) uploadVisit.setEnabled(false); else uploadVisit.setEnabled(true); /* populate data by getting STREAM parameter */ Intent i = getIntent(); Bundle b = i.getExtras(); String action = i.getAction(); if (action.equals(Intent.ACTION_SEND) || action.equals(Intent.ACTION_SEND_MULTIPLE)) { called = true; if (i.hasExtra(Intent.EXTRA_STREAM)) { Object o = b.get(Intent.EXTRA_STREAM); /* quick and dirty. any better idea? */ try { contents.add((Uri) o); } catch (Exception e1) { try { contents = (ArrayList<Uri>) ((ArrayList<Uri>) o).clone(); } catch (Exception e2) { } } boolean exceeded = false; if (contents.size() > 5) { exceeded = true; do { contents.remove(5); } while (contents.size() > 5); } galleryChanged = true; updateImageButtons(); resetThumbnails(); updateGallery(); if (exceeded) Toast.makeText(this, " 5 . 5 ??? ? ?.", Toast.LENGTH_LONG).show(); } if (i.hasExtra(Intent.EXTRA_TEXT)) { ((EditText) findViewById(R.id.upload_text)).setText(b.getString(Intent.EXTRA_TEXT)); } } else if (action.equals("share")) { called = true; /* HTC web browser uses non-standard intent */ ((EditText) findViewById(R.id.upload_text)).setText(b.getString(Intent.EXTRA_TITLE)); } else if (action.equals(Intent.ACTION_VIEW)) { Uri uri = i.getData(); if (i.getCategories().contains(Intent.CATEGORY_BROWSABLE)) { passThrough = true; Pattern p = Pattern.compile("id=([\\-a-zA-Z0-9_]+)"); Matcher m = p.matcher(uri.toString()); if (m.find()) { resolveTarget(m.group(1)); } else { passThrough = false; } if (uri.getHost().equals(Application.HOST_DCMYS)) { destination = Application.DESTINATION_DCMYS; postfix = "from dc.m.dcmys.kr w/ <a href=\"http://palladium.planetmono.org/dcuploader\">DCUploader</a>"; } else if (uri.getHost().equals(Application.HOST_MOOLZO)) { destination = Application.DESTINATION_MOOLZO; postfix = "- From m.oolzo.com w/ <a href=\"http://palladium.planetmono.org/dcuploader\">DCUploader</a>"; } else if (uri.getHost().equals(Application.HOST_DCINSIDE)) { destination = Application.DESTINATION_DCINSIDE; } setDefaultImage(); } } reloadConfigurations(); }
From source file:com.intel.xdk.device.Device.java
public void sendEmail(String body, String to, String subject, boolean ishtml, String cc, String bcc) { String toArray[] = to.split(","); String ccArray[] = cc.split(","); String bccArray[] = bcc.split(","); Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); // it's not ACTION_SEND if (ishtml) { //Android default mail clients poorly support html formatted mail :( //intent.setType("text/html"); //intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body,null,null)); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, body); } else {/* www. ja va 2s.com*/ intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, body); } intent.putExtra(Intent.EXTRA_SUBJECT, subject); if (toArray.length > 0 && !toArray[0].equals("")) { intent.putExtra(Intent.EXTRA_EMAIL, toArray); } if (ccArray.length > 0 && !ccArray[0].equals("")) { intent.putExtra(Intent.EXTRA_CC, ccArray); } if (bccArray.length > 0 && !bccArray[0].equals("")) { intent.putExtra(Intent.EXTRA_BCC, bccArray); } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //return user to app after sending mail activity.startActivity(intent); }
From source file:com.nttec.everychan.ui.presentation.BoardFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { //? ? -/*from w w w.j a va 2 s. com*/ switch (item.getItemId()) { case R.id.context_menu_thumb_load_thumb: bitmapCache.asyncGet( ChanModels.hashAttachmentModel((AttachmentModel) lastContextMenuAttachment.getTag()), ((AttachmentModel) lastContextMenuAttachment.getTag()).thumbnail, resources.getDimensionPixelSize(R.dimen.post_thumbnail_size), chan, null, imagesDownloadTask, (ImageView) lastContextMenuAttachment.findViewById(R.id.post_thumbnail_image), imagesDownloadExecutor, Async.UI_HANDLER, true, R.drawable.thumbnail_error); return true; case R.id.context_menu_thumb_download: downloadFile((AttachmentModel) lastContextMenuAttachment.getTag()); return true; case R.id.context_menu_thumb_copy_url: String url = chan.fixRelativeUrl(((AttachmentModel) lastContextMenuAttachment.getTag()).path); Clipboard.copyText(activity, url); Toast.makeText(activity, resources.getString(R.string.notification_url_copied, url), Toast.LENGTH_LONG) .show(); return true; case R.id.context_menu_thumb_attachment_info: String info = Attachments.getAttachmentInfoString(chan, ((AttachmentModel) lastContextMenuAttachment.getTag()), resources); Toast.makeText(activity, info, Toast.LENGTH_LONG).show(); return true; case R.id.context_menu_thumb_reverse_search: ReverseImageSearch.openDialog(activity, chan.fixRelativeUrl(((AttachmentModel) lastContextMenuAttachment.getTag()).path)); return true; } //? ? ? int position = lastContextMenuPosition; if (item.getMenuInfo() != null && item.getMenuInfo() instanceof AdapterView.AdapterContextMenuInfo) { position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position; } if (nullAdapterIsSet || position == -1 || adapter.getCount() <= position) return false; switch (item.getItemId()) { case R.id.context_menu_open_in_new_tab: UrlPageModel modelNewTab = new UrlPageModel(); modelNewTab.chanName = chan.getChanName(); modelNewTab.type = UrlPageModel.TYPE_THREADPAGE; modelNewTab.boardName = tabModel.pageModel.boardName; modelNewTab.threadNumber = adapter.getItem(position).sourceModel.parentThread; String tabTitle = null; String subject = adapter.getItem(position).sourceModel.subject; if (subject != null && subject.length() != 0) { tabTitle = subject; } else { Spanned spannedComment = adapter.getItem(position).spannedComment; if (spannedComment != null) { tabTitle = spannedComment.toString().replace('\n', ' '); if (tabTitle.length() > MAX_TITLE_LENGHT) tabTitle = tabTitle.substring(0, MAX_TITLE_LENGHT); } } if (tabTitle != null) tabTitle = resources.getString(R.string.tabs_title_threadpage_loaded, modelNewTab.boardName, tabTitle); UrlHandler.open(modelNewTab, activity, false, tabTitle); return true; case R.id.context_menu_thread_preview: showThreadPreviewDialog(position); return true; case R.id.context_menu_reply_no_reading: UrlPageModel model = new UrlPageModel(); model.chanName = chan.getChanName(); model.type = UrlPageModel.TYPE_THREADPAGE; model.boardName = tabModel.pageModel.boardName; model.threadNumber = adapter.getItem(position).sourceModel.parentThread; openPostForm(ChanModels.hashUrlPageModel(model), presentationModel.source.boardModel, getSendPostModel(model)); return true; case R.id.context_menu_hide: adapter.getItem(position).hidden = true; database.addHidden(tabModel.pageModel.chanName, tabModel.pageModel.boardName, pageType == TYPE_POSTSLIST ? tabModel.pageModel.threadNumber : adapter.getItem(position).sourceModel.number, pageType == TYPE_POSTSLIST ? adapter.getItem(position).sourceModel.number : null); adapter.notifyDataSetChanged(); return true; case R.id.context_menu_reply: openReply(position, false, null); return true; case R.id.context_menu_reply_with_quote: openReply(position, true, null); return true; case R.id.context_menu_select_text: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && lastContextMenuPosition == -1) { int firstPosition = listView.getFirstVisiblePosition() - listView.getHeaderViewsCount(); int wantedChild = position - firstPosition; if (wantedChild >= 0 && wantedChild < listView.getChildCount()) { View v = listView.getChildAt(wantedChild); if (v != null && v.getTag() != null && v.getTag() instanceof PostsListAdapter.PostViewTag) { ((PostsListAdapter.PostViewTag) v.getTag()).commentView.startSelection(); return true; } } } Clipboard.copyText(activity, adapter.getItem(position).spannedComment.toString()); Toast.makeText(activity, resources.getString(R.string.notification_comment_copied), Toast.LENGTH_LONG) .show(); return true; case R.id.context_menu_share: UrlPageModel sharePostUrlPageModel = new UrlPageModel(); sharePostUrlPageModel.chanName = chan.getChanName(); sharePostUrlPageModel.type = UrlPageModel.TYPE_THREADPAGE; sharePostUrlPageModel.boardName = tabModel.pageModel.boardName; sharePostUrlPageModel.threadNumber = tabModel.pageModel.threadNumber; sharePostUrlPageModel.postNumber = adapter.getItem(position).sourceModel.number; Intent sharePostIntent = new Intent(Intent.ACTION_SEND); sharePostIntent.setType("text/plain"); sharePostIntent.putExtra(Intent.EXTRA_SUBJECT, chan.buildUrl(sharePostUrlPageModel)); sharePostIntent.putExtra(Intent.EXTRA_TEXT, adapter.getItem(position).spannedComment.toString()); startActivity(Intent.createChooser(sharePostIntent, resources.getString(R.string.share_via))); return true; case R.id.context_menu_delete: DeletePostModel delModel = new DeletePostModel(); delModel.chanName = chan.getChanName(); delModel.boardName = tabModel.pageModel.boardName; delModel.threadNumber = tabModel.pageModel.threadNumber; delModel.postNumber = adapter.getItem(position).sourceModel.number; runDelete(delModel, adapter.getItem(position).sourceModel.attachments != null && adapter.getItem(position).sourceModel.attachments.length > 0); return true; case R.id.context_menu_report: DeletePostModel reportModel = new DeletePostModel(); reportModel.chanName = chan.getChanName(); reportModel.boardName = tabModel.pageModel.boardName; reportModel.threadNumber = tabModel.pageModel.threadNumber; reportModel.postNumber = adapter.getItem(position).sourceModel.number; runReport(reportModel); return true; case R.id.context_menu_subscribe: String chanName = chan.getChanName(); String board = tabModel.pageModel.boardName; String thread = tabModel.pageModel.threadNumber; String post = adapter.getItem(position).sourceModel.number; if (subscriptions.hasSubscription(chanName, board, thread, post)) { subscriptions.removeSubscription(chanName, board, thread, post); for (int i = position; i < adapter.getCount(); ++i) adapter.getItem(i).onUnsubscribe(post); } else { subscriptions.addSubscription(chanName, board, thread, post); for (int i = position; i < adapter.getCount(); ++i) adapter.getItem(i).onSubscribe(post); } adapter.notifyDataSetChanged(); return true; } return false; }
From source file:com.javielinux.utils.Utils.java
public static void sendLastCrash(Activity cnt) { try {/*from w w w .j a va2 s . co m*/ Intent gmail = new Intent(Intent.ACTION_VIEW); gmail.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail"); gmail.putExtra(Intent.EXTRA_EMAIL, new String[] { cnt.getString(R.string.email_send_errors) }); gmail.setData(Uri.parse(cnt.getString(R.string.email_send_errors))); gmail.putExtra(Intent.EXTRA_SUBJECT, "TweetTopics crash"); gmail.setType("plain/text"); gmail.putExtra(Intent.EXTRA_TEXT, ErrorReporter.getErrors(cnt)); cnt.startActivity(gmail); } catch (ActivityNotFoundException e) { Intent msg = new Intent(Intent.ACTION_SEND); msg.putExtra(Intent.EXTRA_EMAIL, new String[] { cnt.getString(R.string.email_send_errors) }); msg.putExtra(Intent.EXTRA_SUBJECT, "TweetTopics crash"); msg.setType("plain/text"); msg.putExtra(Intent.EXTRA_TEXT, ErrorReporter.getErrors(cnt)); cnt.startActivity(msg); } }