当前位置: 首页>>代码示例>>Java>>正文


Java ShareDialog.show方法代码示例

本文整理汇总了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);
        }
    }
 
开发者ID:juanjecilla,项目名称:FindMeAHome,代码行数:17,代码来源:ListActivity.java

示例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();
    }
}
 
开发者ID:davideas,项目名称:AndroidBlueprints,代码行数:39,代码来源:FacebookHelper.java

示例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);
    }
}
 
开发者ID:saasquatch,项目名称:mobile-sdk-android-sample,代码行数:19,代码来源:WelcomeActivity.java

示例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);

    }
}
 
开发者ID:harrylefit,项目名称:eazysocial,代码行数:30,代码来源:FacebookManager.java

示例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);
}
 
开发者ID:cscd-488,项目名称:event-app,代码行数:10,代码来源:ShareDrawer.java

示例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);
}
 
开发者ID:WilderPereira,项目名称:Reciclo,代码行数:12,代码来源:Utils.java

示例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);
    }

}
 
开发者ID:kgeriiie,项目名称:android-fagyi,代码行数:23,代码来源:FacebookHandler.java

示例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);
    }
}
 
开发者ID:kgeriiie,项目名称:android-fagyi,代码行数:19,代码来源:FacebookHandler.java

示例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);
	}
}
 
开发者ID:getsocial-im,项目名称:getsocial-android-sdk,代码行数:33,代码来源:FacebookSharePlugin.java

示例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();
}
 
开发者ID:CE-KMITL-OOAD-2015,项目名称:CE-SMART-TRACKER-DEV,代码行数:34,代码来源:MyCourseActivity.java

示例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);
}
 
开发者ID:jguerinet,项目名称:MyMartlet,代码行数:43,代码来源:DrawerActivity.java

示例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);
}
 
开发者ID:Seeed-Studio,项目名称:Wio_Link_Android_App,代码行数:10,代码来源:UmengUtils.java


注:本文中的com.facebook.share.widget.ShareDialog.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。