本文整理汇总了Java中com.facebook.share.widget.ShareDialog.show方法的典型用法代码示例。如果您正苦于以下问题:Java ShareDialog.show方法的具体用法?Java ShareDialog.show怎么用?Java ShareDialog.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.share.widget.ShareDialog
的用法示例。
在下文中一共展示了ShareDialog.show方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shareOnFacebook
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
private void shareOnFacebook() {
facebookCallbackManager = CallbackManager.Factory.create();
ShareDialog shareDialog = new ShareDialog(this);
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setShareHashtag(new ShareHashtag.Builder()
.setHashtag(getString(R.string.nomorehomelessanimals)).build())
.setQuote(getString(R.string.explore_adoption))
.setContentUrl(Uri.parse(getString(R.string.findmeahome_store_url)))
.build();
shareDialog.show(linkContent);
}
}
示例2: shareLinkOnFacebook
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
/**
* Share content on facebook wall
*
* @param activity the activity
* @param callback the callback to receive a result of this share
* @param url the url you wish to share
* @param quote the text you wish to associate with the url shared
*/
private void shareLinkOnFacebook(@NonNull final Activity activity, @NonNull final FacebookShareResultCallback callback, @NonNull String url, @Nullable String quote) {
ShareDialog shareDialog = new ShareDialog(activity);
shareDialog.registerCallback(mCallbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
callback.onFacebookShareSuccess(result);
}
@Override
public void onCancel() {
callback.onFacebookShareCancel();
}
@Override
public void onError(FacebookException error) {
callback.onFacebookShareError(error);
}
}, RC_FACEBOOK_SHARE);
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder().setContentUrl(Uri.parse(url))
.setQuote(quote)
.build();
shareDialog.show(linkContent);
} else {
callback.onFacebookShareCannotShowDialog();
}
}
示例3: shareFacebook
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
/**
* This method creates a facebook share button
*
* @param shareButton button pressed for a facebook share button
*/
public void shareFacebook(View shareButton) {
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse(mUser.shareLinks.get("facebook")))
.setContentTitle("Get SaaS for 10% less!")
.setContentDescription("Sign up for a SaaS account and we both get 10% off our SaaS!")
.build();
ShareDialog dialog = new ShareDialog(this);
if (ShareDialog.canShow(ShareLinkContent.class)) {
dialog.show(content);
}
}
示例4: setUpShareConfig
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
private void setUpShareConfig(String url, ShareDialog shareDialog) {
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent shareLinkContent = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse(url))
.build();
shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
if (onFacebookShareEvent != null) {
onFacebookShareEvent.onShareSuccessFacebook();
}
}
@Override
public void onCancel() {
if (onFacebookShareEvent != null) {
onFacebookShareEvent.onShareCanceledFacebook();
}
}
@Override
public void onError(FacebookException error) {
error.printStackTrace();
}
});
shareDialog.show(shareLinkContent);
}
}
示例5: shareOnFacebook
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
private static void shareOnFacebook(){
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentTitle(mMediaContent.getTitle())
.setContentDescription(mMediaContent.getDescription())
.setContentUrl(Uri.parse(mMediaContent.getImageSrc()))
.build();
ShareDialog.show(mActivity, content);
}
示例6: reciclo
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
public static void reciclo(ShareDialog shareDialog){
//TODO Get random phrases
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("Reciclô")
.setContentDescription(
"Veja só o que acabei de fazer utilizando o Reciclô!")
.setContentUrl(Uri.parse("http://developers.facebook.com/android"))
.build();
shareDialog.show(linkContent);
}
示例7: shareLink
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
/**
* Share ritch content on facebook.
* @param activity Application base context.
* @param contentUrl Redirect url.
* @param contentTitle Title of content.
* @param imageUrl url of content's image.
* @param contentDescription description of the content.
*/
public void shareLink(Activity activity, String contentUrl, String contentTitle, String imageUrl, String contentDescription) {
ShareDialog shareDialog = new ShareDialog(activity);
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse(contentUrl))
.setContentTitle(contentTitle)
.setContentDescription(contentDescription)
.setImageUrl(Uri.parse(imageUrl)).build();
shareDialog.show(content);
}
}
示例8: sharePhoto
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
/**
* share bitmap content.
* @param bitmap
*/
public void sharePhoto(Bitmap bitmap) {
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(bitmap)
.build();
SharePhotoContent photoContent = new SharePhotoContent.Builder().addPhoto(photo).build();
ShareDialog shareDialog = new ShareDialog(activity);
if (ShareDialog.canShow(SharePhotoContent.class)) {
shareDialog.show(photoContent);
}
}
示例9: presentChannelInterface
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
@Override
public void presentChannelInterface(InviteChannel inviteChannel, InvitePackage invitePackage, final InviteCallback callback) {
if (isConnected()) {
ShareLinkContent.Builder shareLinkBuilder = new ShareLinkContent.Builder();
shareLinkBuilder.setContentUrl(Uri.parse(invitePackage.getReferralUrl()));
ShareLinkContent sharedContent = shareLinkBuilder.build();
ShareDialog shareDialog = new ShareDialog(_activity);
shareDialog.registerCallback(_callbackManager, new FacebookCallback<ShareDialog.Result>() {
@Override
public void onSuccess(ShareDialog.Result result) {
callback.onComplete();
}
@Override
public void onCancel() {
callback.onCancel();
}
@Override
public void onError(FacebookException facebookException) {
callback.onError(facebookException);
}
}
);
shareDialog.show(sharedContent, ShareDialog.Mode.WEB);
} else {
onError("Can't reach Facebook. No internet connection.", callback);
}
}
示例10: onShareResult
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
public void onShareResult(){
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
final ShareDialog shareDialog = new ShareDialog(this);
shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
}
@Override
public void onError(FacebookException error) {
}
@Override
public void onCancel() {
}
});
if (shareDialog.canShow(ShareLinkContent.class)) {
String link = "http://203.151.92.187:8080/courseSchedule?username=" + SingletonID.getInstance().getUserName();
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("CE SMART TRACKER")
.setContentDescription("วิชาที่เรียน")
.setContentUrl(Uri.parse(link))
.build();
shareDialog.show(linkContent);
}
else Toast.makeText(getApplicationContext(),"ลงทะเบียนผ่าน Facebook",Toast.LENGTH_SHORT).show();
}
示例11: shareOnFacebook
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
/**
* Shares the app on Facebook
*/
private void shareOnFacebook() {
analytics.sendEvent("facebook", "attempt_post");
// Set up all of the info
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentTitle(getString(R.string.social_facebook_title, "Android"))
.setContentDescription(getString(R.string.social_facebook_description_android))
.setContentUrl(Uri.parse(getString(R.string.social_link_android)))
.setImageUrl(Uri.parse(getString(R.string.social_facebook_image)))
.build();
// Show the dialog
ShareDialog dialog = new ShareDialog(this);
dialog.registerCallback(facebookCallbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
if (result.getPostId() != null) {
// Let the user know they posted successfully
Utils.toast(DrawerActivity.this, R.string.social_post_success);
analytics.sendEvent("facebook", "successful_post");
} else {
Timber.i("Facebook post cancelled");
}
}
@Override
public void onCancel() {
Timber.i("Facebook post cancelled");
}
@Override
public void onError(FacebookException e) {
Timber.e(e, "Error posting to Facebook");
Utils.toast(DrawerActivity.this, R.string.social_post_failure);
analytics.sendEvent("facebook", "failed_post");
}
});
dialog.show(content);
}
示例12: shareFacebook
import com.facebook.share.widget.ShareDialog; //导入方法依赖的package包/类
public static void shareFacebook(Activity activity, String url, String imgUrl) {
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse(url))
.setContentDescription(url)
.setContentTitle("Wio")
// .setImageUrl(imgUri)
.build();
ShareDialog.show(activity, content);
}