本文整理汇总了Java中cn.sharesdk.onekeyshare.OnekeyShare.setShareContentCustomizeCallback方法的典型用法代码示例。如果您正苦于以下问题:Java OnekeyShare.setShareContentCustomizeCallback方法的具体用法?Java OnekeyShare.setShareContentCustomizeCallback怎么用?Java OnekeyShare.setShareContentCustomizeCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.sharesdk.onekeyshare.OnekeyShare
的用法示例。
在下文中一共展示了OnekeyShare.setShareContentCustomizeCallback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showShare
import cn.sharesdk.onekeyshare.OnekeyShare; //导入方法依赖的package包/类
private void showShare() {
ShareSDK.initSDK(this);
OnekeyShare oks = new OnekeyShare();
//隐藏
oks.addHiddenPlatform(QQ.NAME);
oks.addHiddenPlatform(SinaWeibo.NAME);
oks.addHiddenPlatform(TencentWeibo.NAME);
oks.addHiddenPlatform(QZone.NAME);
oks.addHiddenPlatform(WechatFavorite.NAME);
oks.addHiddenPlatform(Facebook.NAME);
oks.addHiddenPlatform(Twitter.NAME);
oks.addHiddenPlatform(ShortMessage.NAME);
oks.disableSSOWhenAuthorize();
String packgeName = mTextView_Title.getText().toString();
if (!packgeName.isEmpty() && packgeName != "") {
oks.setTitle(packgeName);
mTitle = packgeName;
} else {
oks.setTitle(mTitle);
}
oks.setShareContentCustomizeCallback(new ShareContentCustomizeCallback() {
@Override
public void onShare(Platform platform, Platform.ShareParams paramsToShare) {
if (WechatMoments.NAME.equals(platform.getName())) {
paramsToShare.setTitle(summary);
}
}
});
oks.setText(summary);
// oks.setImagePath(mImageTemp+"/yyox.png"); //分享sdcard目录下的图片
oks.setImageUrl(CommonUtils.getBaseUrl()+"/app/share/images/share.jpg");
oks.setUrl(url + "?orderNo=" + searchNo + "&orderStatus=" + orderStatus + "&companyCode=" + companyCode + "&title=" + mTitle+"&customerId="+mCustomerId);
oks.show(this);
}
示例2: showShare
import cn.sharesdk.onekeyshare.OnekeyShare; //导入方法依赖的package包/类
private void showShare(boolean silent, String platform){
final OnekeyShare oks = new OnekeyShare();
oks.setNotification(R.drawable.ic_launcher, this.getString(R.string.app_name));
//不同平台的分享参数,请看文档
//http://wiki.mob.com/Android_%E4%B8%8D%E5%90%8C%E5%B9%B3%E5%8F%B0%E5%88%86%E4%BA%AB%E5%86%85%E5%AE%B9%E7%9A%84%E8%AF%A6%E7%BB%86%E8%AF%B4%E6%98%8E
String text = this.getString(R.string.share_title) + "http://www.mob.com";
oks.setTitle("share title");
oks.setText(text);
//oks.setSilent(silent);
oks.setDialogMode();
oks.disableSSOWhenAuthorize();
if (platform != null) {
oks.setPlatform(platform);
}
// 去自定义不同平台的字段内容
// http://wiki.mob.com/Android_%E5%BF%AB%E6%8D%B7%E5%88%86%E4%BA%AB#.E4.B8.BA.E4.B8.8D.E5.90.8C.E5.B9.B3.E5.8F.B0.E5.AE.9A.E4.B9.89.E5.B7.AE.E5.88.AB.E5.8C.96.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9
oks.setShareContentCustomizeCallback(new ShareContentCustomizeDemo());
oks.show(this);
}
示例3: share
import cn.sharesdk.onekeyshare.OnekeyShare; //导入方法依赖的package包/类
public static void share(ActionBarActivity activity, String title, String text, String comment
, String titleUrl, String siteName, String siteUrl, String imagePath, String imageUrl, final String weiboAt) {
ShareSDK.initSDK(activity);
final OnekeyShare oks = new OnekeyShare();
title = HtmlUtils.delHTMLTag(title);
text = HtmlUtils.delHTMLTag(text);
//关闭sso授权
oks.disableSSOWhenAuthorize();
// 分享时Notification的图标和文字 2.5.9以后的版本不调用此方法
//oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name));
// title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
oks.setTitle(title);
// titleUrl是标题的网络链接,仅在人人网和QQ空间使用
oks.setTitleUrl(titleUrl);
// text是分享文本,所有平台都需要这个字段
oks.setText(text);
// imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
if (imagePath != null && imagePath.length() > 0) {
oks.setImagePath(imagePath);//确保SDcard下面存在此张图片
} else
oks.setImageUrl(imageUrl);
// url仅在微信(包括好友和朋友圈)中使用
oks.setUrl(titleUrl);
// comment是我对这条分享的评论,仅在人人网和QQ空间使用
oks.setComment(comment);
// site是分享此内容的网站名称,仅在QQ空间使用
oks.setSite(siteName);
// siteUrl是分享此内容的网站地址,仅在QQ空间使用
oks.setSiteUrl(siteUrl);
oks.setOnShareButtonClickListener(new PlatformListFakeActivity.OnShareButtonClickListener() {
@Override
public void onClick(View v, List<Object> checkPlatforms) {
ZogUtils.printLog(ShareSDKUtils.class, "v:" + v + " checkPlatforms:" + checkPlatforms + " " + checkPlatforms.size());
if (checkPlatforms != null && !checkPlatforms.isEmpty() && (checkPlatforms.get(0) instanceof SinaWeibo)) {
// String shareContent = oks.getTitle() + " " + oks.getTitleUrl() + ((weiboAt != null && weiboAt.length() > 0) ? " @" + weiboAt : "");
String shareContent = oks.getTitle();
oks.setText(shareContent);
oks.setImageUrl(null);
}
}
});
ShareContentCustomizeDemo shareContentCustomizeDemo = new ShareContentCustomizeDemo();
shareContentCustomizeDemo.setSinaWeiboAt(weiboAt);
oks.setShareContentCustomizeCallback(shareContentCustomizeDemo);
// 启动分享GUI
oks.show(activity);
}
示例4: showShare
import cn.sharesdk.onekeyshare.OnekeyShare; //导入方法依赖的package包/类
private void showShare(boolean silent, String platform) {
final OnekeyShare oks = new OnekeyShare();
oks.setNotification(R.drawable.ic_launcher, menu.getContext().getString(R.string.app_name));
oks.setAddress("12345678901");
oks.setTitle(menu.getContext().getString(R.string.evenote_title));
oks.setTitleUrl("http://sharesdk.cn");
oks.setText(menu.getContext().getString(R.string.share_content));
oks.setImagePath(MainActivity.TEST_IMAGE);
oks.setImageUrl("http://img.appgo.cn/imgs/sharesdk/content/2013/07/25/1374723172663.jpg");
oks.setUrl("http://www.sharesdk.cn");
oks.setFilePath(MainActivity.TEST_IMAGE);
oks.setComment(menu.getContext().getString(R.string.share));
oks.setSite(menu.getContext().getString(R.string.app_name));
oks.setSiteUrl("http://sharesdk.cn");
oks.setVenueName("ShareSDK");
oks.setVenueDescription("This is a beautiful place!");
oks.setLatitude(23.056081f);
oks.setLongitude(113.385708f);
oks.setSilent(silent);
if (platform != null) {
oks.setPlatform(platform);
}
// remove comments, display editpage in dialog mode
// oks.setDialogMode();
// remove comments, disable sso in authorizing
// oks.disableSSOWhenAuthorize();
// remove comments, use OneKeyShareCallback as the share action callback
// oks.setCallback(new OneKeyShareCallback());
oks.setShareContentCustomizeCallback(new ShareContentCustomizeDemo());
// remove comments, shows how to add custom logos in platform gridview
// Bitmap logo = BitmapFactory.decodeResource(menu.getResources(), R.drawable.ic_launcher);
// String label = menu.getResources().getString(R.string.app_name);
// OnClickListener listener = new OnClickListener() {
// public void onClick(View v) {
// String text = "Customer Logo -- ShareSDK " + ShareSDK.getSDKVersionName();
// Toast.makeText(menu.getContext(), text, Toast.LENGTH_SHORT).show();
// oks.finish();
// }
// };
// oks.setCustomerLogo(logo, label, listener);
oks.show(menu.getContext());
}