當前位置: 首頁>>代碼示例>>Java>>正文


Java ShareCompat.IntentBuilder方法代碼示例

本文整理匯總了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();
	}
}
 
開發者ID:fengdongfei,項目名稱:CXJPadProject,代碼行數:19,代碼來源:EmailSpan.java

示例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();
}
 
開發者ID:johnjohndoe,項目名稱:Umweltzone,代碼行數:17,代碼來源:IntentHelper.java

示例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;
    }
}
 
開發者ID:google,項目名稱:iosched,代碼行數:25,代碼來源:SessionDetailFragment.java

示例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);
}
 
開發者ID:hoang8f,項目名稱:android-flat-button,代碼行數:22,代碼來源:MainActivity.java

示例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();
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:9,代碼來源:SessionsHelper.java

示例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();
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:15,代碼來源:EmailSpan.java

示例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");
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:14,代碼來源:ReportIssueDialogBuilder.java

示例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);
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:10,代碼來源:RequestCoinsFragment.java

示例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");
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:15,代碼來源:ArchiveBackupDialogFragment.java

示例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)));
}
 
開發者ID:filipnyquist,項目名稱:lbry-android,代碼行數:10,代碼來源:UiUtils.java

示例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);
        }
    }
}
 
開發者ID:canyapan,項目名稱:DietDiaryApp,代碼行數:33,代碼來源:BackupAsyncTask.java

示例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);
}
 
開發者ID:canyapan,項目名稱:DietDiaryApp,代碼行數:30,代碼來源:DayFragment.java

示例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();
}
 
開發者ID:naoto0822,項目名稱:miita-android,代碼行數:11,代碼來源:ShareUtil.java

示例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!"));
}
 
開發者ID:Rashwan,項目名稱:Reactive-Popular-Movies,代碼行數:13,代碼來源:Utilities.java

示例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();
}
 
開發者ID:The-WebOps-Club,項目名稱:saarang-iosched,代碼行數:9,代碼來源:SessionsHelper.java


注:本文中的android.support.v4.app.ShareCompat.IntentBuilder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。