本文整理汇总了Java中android.support.v4.app.ShareCompat.IntentBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java ShareCompat.IntentBuilder方法的具体用法?Java ShareCompat.IntentBuilder怎么用?Java ShareCompat.IntentBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.ShareCompat
的用法示例。
在下文中一共展示了ShareCompat.IntentBuilder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
@Override
public void onClick(View widget) {
if (SobotOption.hyperlinkListener != null){
SobotOption.hyperlinkListener.onEmailClick(email);
return;
}
try {
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder
.from((Activity)widget.getContext());
builder.setType("message/rfc822");
builder.addEmailTo(email);
builder.setSubject("");
builder.setChooserTitle("");
builder.startChooser();
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: getSendEmailIntent
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
public static Intent getSendEmailIntent(
@NonNull Activity activity,
@NonNull String[] toRecipients,
@Nullable String[] bccRecipient,
@NonNull String subject,
@NonNull String message) {
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(activity);
builder.setEmailTo(toRecipients);
if (bccRecipient != null) {
builder.setEmailBcc(bccRecipient);
}
builder.setSubject(subject);
builder.setType("message/rfc822");
builder.setHtmlText(message);
return builder.getIntent();
}
示例3: displayUserActionResult
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
@Override
public void displayUserActionResult(SessionDetailModel data,
SessionDetailUserActionEnum userAction, boolean success) {
switch (userAction) {
case SHOW_MAP:
Intent mapIntent = new Intent(getActivity(), MapActivity.class);
mapIntent.putExtra(MapActivity.EXTRA_ROOM, data.getRoomId());
getActivity().startActivity(mapIntent);
break;
case SHOW_SHARE:
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(getActivity())
.setType("text/plain")
.setText(getString(R.string.share_template, data.getSessionTitle(),
BuildConfig.CONFERENCE_HASHTAG, data.getSessionUrl()));
Intent shareIntent = Intent.createChooser(
builder.getIntent(),
getString(R.string.title_share));
getActivity().startActivity(shareIntent);
break;
default:
// Other user actions are completely handled in model
break;
}
}
示例4: onOptionsItemSelected
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
switch (item.getItemId()) {
case R.id.action_github:
Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(Config.GITHUB_URL));
startActivity(browse);
return true;
case R.id.action_social:
ShareCompat.IntentBuilder intentBuilder = ShareCompat.IntentBuilder.from(MainActivity.this);
intentBuilder.setChooserTitle("Choose Share App")
.setType("text/plain")
.setSubject("Flat button for android")
.setText("A flat button library for android #AndroidFlat goo.gl/C6aLDi")
.startChooser();
return true;
}
return super.onOptionsItemSelected(item);
}
示例5: createShareIntent
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
public Intent createShareIntent(int messageTemplateResId, String title, String hashtags,
String url) {
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(mActivity)
.setType("text/plain")
.setText(mActivity.getString(messageTemplateResId,
title, BuildConfig.CONFERENCE_HASHTAG, " " + url));
return builder.getIntent();
}
示例6: onClick
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
@Override
public void onClick(View widget) {
try {
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder
.from((Activity) widget.getContext());
builder.setType("message/rfc822");
builder.addEmailTo(email);
builder.setSubject("");
builder.setChooserTitle("");
builder.startChooser();
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: startSend
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
private void startSend(final String subject, final CharSequence text, final List<Uri> attachments) {
final ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(activity);
for (final Uri attachment : attachments)
builder.addStream(attachment);
builder.addEmailTo(Constants.REPORT_EMAIL);
if (subject != null)
builder.setSubject(subject);
builder.setText(text);
builder.setType("text/plain");
builder.setChooserTitle(R.string.report_issue_dialog_mail_intent_chooser);
builder.startChooser();
log.info("invoked chooser for sending issue report");
}
示例8: handleShare
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
private void handleShare() {
final String request = determineBitcoinRequestStr(false);
final ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(activity);
builder.setType("text/plain");
builder.setText(request);
builder.setChooserTitle(R.string.request_coins_share_dialog_title);
builder.startChooser();
log.info("payment request shared via intent: {}", request);
}
示例9: archiveWalletBackup
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
private void archiveWalletBackup(final File backupFile) {
final ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(activity);
builder.setSubject(getString(R.string.export_keys_dialog_mail_subject)
+ Constants.Files.EXTERNAL_WALLET_BACKUP_SUBJECT_SUFFIX);
builder.setText(getString(R.string.export_keys_dialog_mail_text) + "\n\n"
+ String.format(Constants.WEBMARKET_APP_URL, activity.getPackageName()) + "\n\n" + Constants.SOURCE_URL
+ '\n');
builder.setType(Constants.MIMETYPE_WALLET_BACKUP);
builder.setStream(
FileProvider.getUriForFile(activity, activity.getPackageName() + ".file_attachment", backupFile));
builder.setChooserTitle(R.string.export_keys_dialog_mail_intent_chooser);
builder.startChooser();
log.info("invoked chooser for archiving wallet backup");
}
示例10: share
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
static public void share(Activity activity, String text) {
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(activity)
.setType("text/plain")
.setText(text);
activity.startActivity(Intent.createChooser(
builder.getIntent(),
activity.getString(com.fillerino.wallet.R.string.action_share)));
}
示例11: onPostExecute
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
@Override
protected void onPostExecute(Boolean result) {
backupFragment.mAsyncTask = null;
if (backupFragment.mProgressDialog.isShowing()) {
backupFragment.mProgressDialog.dismiss();
}
if (null == result || result.equals(false)) {
Snackbar.make(backupFragment.mGridLayout, mErrorString, Snackbar.LENGTH_INDEFINITE).show();
} else if (result.equals(true)) {
Snackbar.make(backupFragment.mGridLayout, backupFragment.getString(R.string.backup_external_successful, mFile.getName()), Snackbar.LENGTH_SHORT).show();
if (mDestination == TO_SHARE) {
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(backupFragment.getActivity())
.setType(SharingSupportProvider.MIME_TYPE_CSV)
.setStream(Uri.parse(SharingSupportProvider.CONTENT_URI_PREFIX + mFile.getName()));
builder.getIntent().addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
builder.startChooser();
backupFragment.mListener.onShareComplete(Uri.fromFile(mFile), backupFragment.mFromDate, backupFragment.mToDate);
} else {
// initiate media scan and put the new things into the path array to
// make the scanner aware of the location and the files
MediaScannerConnection.scanFile(backupFragment.getContext(), new String[]{mFile.getPath()}, null, null);
backupFragment.mListener.onBackupComplete(Uri.fromFile(mFile), backupFragment.mFromDate, backupFragment.mToDate);
}
}
}
示例12: onOptionsItemSelected
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_share:
if (null != mAdapter) {
if (0 == mAdapter.getItemCount()) {
Toast.makeText(getContext(), R.string.day_fragment_nothing_to_share, Toast.LENGTH_SHORT).show();
return true;
}
StringBuilder sb = new StringBuilder(getString(R.string.app_name));
sb.append(" - ").append(mDate.toString(DateTimeFormat.longDate())).append('\n');
for (Event e : mAdapter.getDataSet()) {
sb.append(getEventText(e));
sb.append('\n');
}
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(getActivity())
.setType("text/plain")
.setText(sb.toString());
builder.startChooser();
}
return true;
}
return super.onOptionsItemSelected(item);
}
示例13: share
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
public static void share(Activity activity, BaseItem item) {
final String shareBody = "「" + item.getTitle() + "」" + " " + item.getUrlString();
final ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(activity);
builder.setChooserTitle(R.string.title_share_item);
builder.setSubject(item.getTitle());
builder.setText(shareBody);
builder.setType("text/plain");
builder.startChooser();
}
示例14: createShareIntent
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
/**
* Create a share intent for a movie using its title and a trailer.
* @param activity The activity to start the intent chooser from.
* @param title The title of the movie to be shared.
* @param trailerUrl The Youtube url for a trailer of the movie to be shared.
*/
public static void createShareIntent(Activity activity, String title, String trailerUrl) {
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(activity)
.setType("text/plain")
.setText("check out the trailer for the movie " + title + ", at : " + trailerUrl);
activity.startActivity(Intent.createChooser(builder.getIntent(), "Share Movie!"));
}
示例15: createShareIntent
import android.support.v4.app.ShareCompat; //导入方法依赖的package包/类
public Intent createShareIntent(int messageTemplateResId, String title, String hashtags,
String url) {
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(mActivity)
.setType("text/plain")
.setText(mActivity.getString(messageTemplateResId,
title, UIUtils.getSessionHashtagsString(hashtags), " " + url));
return builder.getIntent();
}