本文整理汇总了Java中cn.sharesdk.framework.ShareSDK类的典型用法代码示例。如果您正苦于以下问题:Java ShareSDK类的具体用法?Java ShareSDK怎么用?Java ShareSDK使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ShareSDK类属于cn.sharesdk.framework包,在下文中一共展示了ShareSDK类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectCells
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
protected ArrayList<Object> collectCells() {
ArrayList<Object> cells = new ArrayList<Object>();
Platform[] platforms = ShareSDK.getPlatformList();
if (platforms == null) {
platforms = new Platform[0];
}
HashMap<String, String> hides = getHiddenPlatforms();
if (hides == null) {
hides = new HashMap<String, String>();
}
for (Platform p : platforms) {
if (!hides.containsKey(p.getName())) {
cells.add(p);
}
}
ArrayList<CustomerLogo> customers = getCustomerLogos();
if (customers != null && customers.size() > 0) {
cells.addAll(customers);
}
return cells;
}
示例2: showEditPage
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
public final void showEditPage(final Platform platform) {
beforeFinish = new Runnable() {
public void run() {
boolean isSilent = isSilent();
boolean isCustomPlatform = platform instanceof CustomPlatform;
boolean isUseClientToShare = isUseClientToShare(platform);
if (isSilent || isCustomPlatform || isUseClientToShare) {
shareSilently(platform);
} else {
ShareParams sp = formateShareData(platform);
if (sp != null) {
// 编辑分享内容的统计
ShareSDK.logDemoEvent(3, null);
if (getCustomizeCallback() != null) {
getCustomizeCallback().onShare(platform, sp);
}
impl.showEditPage(activity, platform, sp);
}
}
}
};
finish();
}
示例3: collectCells
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
protected ArrayList<Object> collectCells() {
ArrayList<Object> cells = new ArrayList<Object>();
Platform[] platforms = ShareSDK.getPlatformList();
if (platforms == null) {
platforms = new Platform[0];
}
HashMap<String, String> hides = getHiddenPlatforms();
if (hides == null) {
hides = new HashMap<String, String>();
}
for (Platform p : platforms) {
if (!hides.containsKey(p.getName())) {
cells.add(p);
}
}
ArrayList<CustomerLogo> customers = getCustomerLogos();
if (customers != null && customers.size() > 0) {
cells.addAll(customers);
}
return cells;
}
示例4: b
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
public static void b(Context context, b bVar) {
ShareParams shareParams = new ShareParams();
shareParams.setShareType(4);
Bitmap bitmap = null;
if (!TextUtils.isEmpty(bVar.c())) {
bitmap = BitmapFactory.decodeFile(bVar.c());
}
if (bitmap != null) {
bitmap = Bitmap.createScaledBitmap(bitmap, 150, 150, true);
} else {
bitmap = Bitmap.createScaledBitmap(Bitmap.createBitmap(150, 150, Config.ARGB_8888),
150, 150, true);
}
shareParams.setImageData(bitmap);
shareParams.setTitle(bVar.a());
shareParams.setText(bVar.b());
shareParams.setUrl(bVar.e());
Platform platform = ShareSDK.getPlatform(WechatMoments.NAME);
if (platform.isClientValid()) {
platform.share(shareParams);
return;
}
Toast.makeText(context, o.a("未安装微信或者微信版本过低。", "There is no WeChat or the version is too " +
"low."), 0).show();
c.d(o.a("未安装微信或者微信版本过低。", "There is no WeChat or the version is too low."));
}
示例5: show
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
public final void show(Context context) {
this.context = context;
// 显示方式是由platform和silent两个字段控制的
// 如果platform设置了,则无须显示九宫格,否则都会显示;
// 如果silent为true,表示不进入编辑页面,否则会进入。
if (shareParamsMap.containsKey("platform")) {
String name = String.valueOf(shareParamsMap.get("platform"));
Platform platform = ShareSDK.getPlatform(name);
boolean isCustomPlatform = platform instanceof CustomPlatform;
boolean isUseClientToShare = isUseClientToShare(platform);
if (silent || isCustomPlatform || isUseClientToShare) {
shareSilently(platform);
} else {
prepareForEditPage(platform);
}
} else {
showPlatformPage(context);
}
}
示例6: showShare
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
private void showShare() {
ShareSDK.initSDK(this);
OnekeyShare oks = new OnekeyShare();
//关闭sso授权
oks.disableSSOWhenAuthorize();
// title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间等使用
oks.setTitle(mWebView.getTitle());
// titleUrl是标题的网络链接,QQ和QQ空间等使用
oks.setTitleUrl(mUrl);
// text是分享文本,所有平台都需要这个字段
oks.setText("哇,这家伙做的高仿微信跟真的一样耶");
// imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
//oks.setImagePath("/sdcard/test.jpg");//确保SDcard下面存在此张图片
// url仅在微信(包括好友和朋友圈)中使用
oks.setUrl(mUrl);
// site是分享此内容的网站名称,仅在QQ空间使用
oks.setSite(getString(R.string.app_name_in_about));
// siteUrl是分享此内容的网站地址,仅在QQ空间使用
oks.setSiteUrl(mUrl);
// 启动分享GUI
oks.show(this);
}
示例7: Share
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
public static void Share(Context context){
ShareSDK.initSDK(context);
OnekeyShare oks = new OnekeyShare();
//关闭sso授权
oks.disableSSOWhenAuthorize();
// 分享时Notification的图标和文字 2.5.9以后的版本不调用此方法
//oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name));
// title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
oks.setTitle("我是分享标题");
// titleUrl是标题的网络链接,仅在人人网和QQ空间使用
oks.setTitleUrl("http://sharesdk.cn");
// text是分享文本,所有平台都需要这个字段
oks.setText("我是分享文本,啦啦啦~");
// imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
oks.setImagePath("/sdcard/test.jpg");//确保SDcard下面存在此张图片
// url仅在微信(包括好友和朋友圈)中使用
oks.setUrl("http://sharesdk.cn");
// comment是我对这条分享的评论,仅在人人网和QQ空间使用
oks.setComment("我是测试评论文本");
// site是分享此内容的网站名称,仅在QQ空间使用
oks.setSite("我也是分享标题");
// siteUrl是分享此内容的网站地址,仅在QQ空间使用
oks.setSiteUrl("http://sharesdk.cn");
// 启动分享GUI
oks.show(context);
}
示例8: onClick
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
public void onClick(View v) {
if(v.getTag() == null)
return;
String tag = (String) v.getTag();
if (tag.equals("close")) {
// 取消分享的统计
for(Platform plat : platforms) {
ShareSDK.logDemoEvent(5, plat);
}
finish();
return;
}
if (tag.equals("ok")) {
onShareButtonClick(v);
return;
}
}
示例9: run
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
public void run() {
try {
Message message = new Message();
message.what = 2;
if ("none".equals(DeviceHelper.getInstance(this.a.activity).getDetailNetworkTypeForStatic())) {
message.arg1 = 1;
UIHandler.sendMessage(message, this.a);
return;
}
if (ShareSDK.isRemoveCookieOnAuthorize()) {
CookieSyncManager.createInstance(this.a.activity);
CookieManager.getInstance().removeAllCookie();
}
message.obj = this.a.a.getAuthorizeUrl();
UIHandler.sendMessage(message, this.a);
} catch (Throwable th) {
Ln.e(th);
}
}
示例10: j
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
private String j(String str) {
JSONObject i = i();
DeviceHelper instance = DeviceHelper.getInstance(this.a);
try {
i.put("type", "DEVICE");
i.put("key", instance.getDeviceKey());
i.put("carrier", instance.getCarrier());
i.put("appkey", str);
i.put("apppkg", instance.getPackageName());
i.put("appver", String.valueOf(instance.getAppVersion()));
i.put("sdkver", 50000 + ShareSDK.getSDKVersionCode());
i.put("networktype", instance.getDetailNetworkTypeForStatic());
} catch (Throwable e) {
Ln.e(e);
}
return i.toString();
}
示例11: a
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
public static void a(Context context, b bVar) {
ShareParams shareParams = new ShareParams();
shareParams.setShareType(4);
Bitmap bitmap = null;
if (!TextUtils.isEmpty(bVar.c())) {
bitmap = BitmapFactory.decodeFile(bVar.c());
}
if (bitmap != null) {
bitmap = Bitmap.createScaledBitmap(bitmap, 150, 150, true);
} else {
bitmap = Bitmap.createScaledBitmap(Bitmap.createBitmap(150, 150, Config.ARGB_8888),
150, 150, true);
}
shareParams.setImageData(bitmap);
shareParams.setTitle(bVar.a());
shareParams.setText(bVar.b());
shareParams.setUrl(bVar.e());
Platform platform = ShareSDK.getPlatform(Wechat.NAME);
if (platform.isClientValid()) {
platform.share(shareParams);
return;
}
Toast.makeText(context, o.a("未安装微信或者微信版本过低。", "There is no WeChat or the version is too " +
"low."), 0).show();
c.d(o.a("未安装微信或者微信版本过低。", "There is no WeChat or the version is too low."));
}
示例12: initSocialLogin
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
private void initSocialLogin() {
Platform[] platforms = ShareSDK.getPlatformList();
if (platforms == null) {
return;
}
for (Platform p : platforms) {
if ("QQ".equals(p.getName())) {
qqLoginView.setVisibility(View.VISIBLE);
otherLoginView.setVisibility(View.VISIBLE);
}
if ("Wechat".equals(p.getName())) {
wxLoginView.setVisibility(View.VISIBLE);
otherLoginView.setVisibility(View.VISIBLE);
}
}
}
示例13: onCreate
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Compact.getInstance().init(this);
ShareSDK.initSDK(this, Constants.SHARE_SDK_APPID);
Intent intent = getIntent();
if (Intent.ACTION_SEND.equals(intent.getAction())
&& "text/plain".equals(intent.getType())) {
String text = intent.getStringExtra(Intent.EXTRA_TEXT);
int textSize = SharePreferencesUtils.textSize(this, getResources().getInteger(R.integer.option_default_textSize));
Bitmap bitmap = getShareBitmap(text, textSize);
TCAgentUtils.Share(this, Constants.LABEL_FROM_SHARE, text);
WeixinShareUtils.shareImage(bitmap);
finish();
}
}
示例14: updateUserInfoFromLocal
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
/**
* 从本地更新用户信息 - 登录成功后保存到偏好设置
*/
public void updateUserInfoFromLocal() {
// 移除第三方授权
Platform wechat = ShareSDK.getPlatform(Wechat.NAME);
if (wechat.isAuthValid()) {
wechat.removeAccount(true);
}
Platform qq = ShareSDK.getPlatform(QQ.NAME);
if (qq.isAuthValid()) {
qq.removeAccount(true);
}
// 内存缓存
UserBean.userAccount = this;
// 磁盘缓存
encode();
}
示例15: onError
import cn.sharesdk.framework.ShareSDK; //导入依赖的package包/类
public final void onError(Platform platform, int action, Throwable t) {
t.printStackTrace();
Message msg = new Message();
msg.arg1 = 2;
msg.arg2 = action;
msg.obj = t;
UIHandler.sendMessage(msg, this);
// 分享失败的统计
ShareSDK.logDemoEvent(4, platform);
}