List of usage examples for android.content Intent EXTRA_SUBJECT
String EXTRA_SUBJECT
To view the source code for android.content Intent EXTRA_SUBJECT.
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 ww . j a v a2 s .com*/ 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.wikonos.fingerprint.activities.MainActivity.java
/** * Create dialog list of logs// ww w . j a v a 2 s . c om * * @return */ public AlertDialog getDialogReviewLogs() { /** * List of logs */ File folder = new File(LogWriter.APPEND_PATH); final String[] files = folder.list(new FilenameFilter() { public boolean accept(File dir, String filename) { if (filename.contains(".log") && !filename.equals(LogWriter.DEFAULT_NAME) && !filename.equals(LogWriterSensors.DEFAULT_NAME) && !filename.equals(ErrorLog.DEFAULT_NAME)) return true; else return false; } }); Arrays.sort(files); ArrayUtils.reverse(files); String[] files_with_status = new String[files.length]; String[] sent_mode = { "", "(s) ", "(e) ", "(s+e) " }; for (int i = 0; i < files.length; ++i) { //0 -- not sent //1 -- server //2 -- email files_with_status[i] = sent_mode[getSentFlags(files[i], this)] + files[i]; } if (files != null && files.length > 0) { final boolean[] selected = new boolean[files.length]; final AlertDialog ald = new AlertDialog.Builder(MainActivity.this) .setMultiChoiceItems(files_with_status, selected, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int which, boolean isChecked) { selected[which] = isChecked; } }) .setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { // removeDialog(DIALOG_ID_REVIEW); } }) /** * Delete log */ .setNegativeButton("Delete", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //Show delete confirm standardConfirmDialog("Delete Logs", "Are you sure you want to delete selected logs?", new OnClickListener() { //Confrim Delete @Override public void onClick(DialogInterface dialog, int which) { int deleteCount = 0; boolean flagSelected = false; for (int i = 0; i < selected.length; i++) { if (selected[i]) { flagSelected = true; LogWriter.delete(files[i]); LogWriter.delete(files[i].replace(".log", ".dev")); deleteCount++; } } reviewLogsCheckItems(flagSelected); removeDialog(DIALOG_ID_REVIEW); Toast.makeText(getApplicationContext(), deleteCount + " logs deleted.", Toast.LENGTH_SHORT).show(); } }, new OnClickListener() { //Cancel Delete @Override public void onClick(DialogInterface dialog, int which) { //Do nothing dialog.dismiss(); Toast.makeText(getApplicationContext(), "Delete cancelled.", Toast.LENGTH_SHORT).show(); } }, false); } }) /** * Send to server functional **/ .setNeutralButton("Send to Server", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (isOnline()) { ArrayList<String> filesList = new ArrayList<String>(); for (int i = 0; i < selected.length; i++) if (selected[i]) { filesList.add(LogWriter.APPEND_PATH + files[i]); //Move to httplogsender //setSentFlags(files[i], 1, MainActivity.this); //Mark file as sent } if (reviewLogsCheckItems(filesList.size() > 0 ? true : false)) { DataPersistence d = new DataPersistence(getApplicationContext()); new HttpLogSender(MainActivity.this, d.getServerName() + getString(R.string.submit_log_url), filesList) .setToken(getToken()).execute(); } // removeDialog(DIALOG_ID_REVIEW); } else { standardAlertDialog(getString(R.string.msg_alert), getString(R.string.msg_no_internet), null); } } }) /** * Email **/ .setPositiveButton("eMail", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { boolean flagSelected = false; // convert from paths to Android friendly // Parcelable Uri's ArrayList<Uri> uris = new ArrayList<Uri>(); for (int i = 0; i < selected.length; i++) if (selected[i]) { flagSelected = true; /** wifi **/ File fileIn = new File(LogWriter.APPEND_PATH + files[i]); Uri u = Uri.fromFile(fileIn); uris.add(u); /** sensors **/ File fileInSensors = new File( LogWriter.APPEND_PATH + files[i].replace(".log", ".dev")); Uri uSens = Uri.fromFile(fileInSensors); uris.add(uSens); setSentFlags(files[i], 2, MainActivity.this); //Mark file as emailed } if (reviewLogsCheckItems(flagSelected)) { /** * Run sending email activity */ Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Wifi Searcher Scan Log"); emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); startActivity(Intent.createChooser(emailIntent, "Send mail...")); } // removeDialog(DIALOG_ID_REVIEW); } }).create(); ald.getListView().setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) { AlertDialog segmentNameAlert = segmentNameDailog("Rename Segment", ald.getContext(), files[position], null, view, files, position); segmentNameAlert.setCanceledOnTouchOutside(false); segmentNameAlert.show(); return false; } }); return ald; } else { return standardAlertDialog(getString(R.string.msg_alert), getString(R.string.msg_log_nocount), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { removeDialog(DIALOG_ID_REVIEW); } }); } }
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; }/*from www. j av a2s . co 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.github.fi3te.iliasdownloader.view.IliasActivity.java
@Override public boolean onNavigationItemSelected(final MenuItem menuItem) { pendingRunnable = new Runnable() { @Override/*from w ww . ja va 2s.c om*/ public void run() { switch (menuItem.getItemId()) { case R.id.ignore_list_item: if (!ilias.isRunning()) { startActivity(new Intent(IliasActivity.this, BlockedFilesActivity.class)); } else { Snackbar.make(coordinatorLayout, R.string.synchronisation_is_running, Snackbar.LENGTH_SHORT) .show(); } break; case R.id.recommendation_item: Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getResources().getString(R.string.app_name)); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, getResources().getString(R.string.recommendation_text)); startActivity( Intent.createChooser(sharingIntent, getResources().getString(R.string.recommend_by))); break; case R.id.rating_item: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse( "https://play.google.com/store/apps/details?id=com.github.fi3te.iliasdownloader"))); break; case R.id.bug_report_item: String versionName = "X.X"; try { PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); versionName = getResources().getString(R.string.version) + " " + packageInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "fiete.wennier@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.app_name) + " " + versionName); startActivity(Intent.createChooser(emailIntent, "E-Mail")); break; case R.id.settings_item: startActivity(new Intent(IliasActivity.this, SettingsActivity.class)); break; case R.id.login_item: startActivity(new Intent(IliasActivity.this, LoginActivity.class)); break; case R.id.logout_item: if (ilias.logout()) { updateNavigationView(); } else { Snackbar.make(coordinatorLayout, R.string.synchronisation_is_running, Snackbar.LENGTH_SHORT) .show(); } break; } } }; drawerLayout.closeDrawers(); return true; }
From source file:com.friedran.appengine.dashboard.gui.DashboardActivity.java
private void sendFeedback() { final Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/html"); intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { getString(R.string.mail_feedback_address) }); intent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.mail_feedback_subject)); intent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.mail_feedback_message)); startActivity(Intent.createChooser(intent, getString(R.string.title_send_feedback))); }
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 w w w . j av a 2 s.c o 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:com.quickcar.thuexe.UI.ListPassengerActivity.java
private void showDialogShareSocial() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Chia s"); String shareMessage = "Bn cn thu xe hay bn l ti x/nh xe/hng xe c xe ring, hy dng th ng dng thu xe trn di ng ti http://thuexevn.com"; shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage); startActivity(Intent.createChooser(shareIntent, "Ch?n phng thc chia s")); }
From source file:com.gh4a.fragment.PullRequestFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.pull_merge: showMergeDialog();/*from w w w.j a v a 2 s . c o m*/ break; case R.id.pull_close: case R.id.pull_reopen: new PullRequestOpenCloseTask(item.getItemId() == R.id.pull_reopen).schedule(); break; case R.id.share: Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_pull_subject, mPullRequest.getNumber(), mPullRequest.getTitle(), mRepoOwner + "/" + mRepoName)); shareIntent.putExtra(Intent.EXTRA_TEXT, mPullRequest.getHtmlUrl()); shareIntent = Intent.createChooser(shareIntent, getString(R.string.share_title)); startActivity(shareIntent); break; } return super.onOptionsItemSelected(item); }
From source file:com.code.android.vibevault.SearchScreen.java
/** Handle user's long-click selection. * *///from w ww. j av 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; }