cn.sharesdk.wechat.friends.Wechat Java Examples
The following examples show how to use
cn.sharesdk.wechat.friends.Wechat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoginAty.java From Huochexing12306 with Apache License 2.0 | 6 votes |
/** * 转为自己平台的表示 * @param plat * @return */ private ThirdPartyPlatformInfo getThirdPartyPlatfromInfo(Platform plat) { Map<Integer, ThirdPartyPlatformInfo> map = TT.getPlatformInfos(); if (QQ.NAME.equals(plat.getName())){ return map.get(TT.PLATFORM_QQ); }else if (SinaWeibo.NAME.equals(plat.getName())){ return map.get(TT.PLATFORM_SINA_WEIBO); } // else if (Douban.NAME.equals(plat.getName())){ // return map.get(TT.PLATFORM_DOUBAN); // } else if (GooglePlus.NAME.equals(plat.getName())){ return map.get(TT.PLATFORM_GOOGLE_PLUS); }else if (Wechat.NAME.equals(plat.getName())){ return map.get(TT.PLATFORM_WECHAT); }else if (Yixin.NAME.equals(plat.getName())){ return map.get(TT.PLATFORM_YIXIN); }else if (Renren.NAME.equals(plat.getName())){ return map.get(TT.PLATFORM_RENREN); }else if (Line.NAME.equals(plat.getName())){ return map.get(TT.PLATFORM_LINE); }else{ return null; } }
Example #2
Source File: AuthPageAty.java From Huochexing12306 with Apache License 2.0 | 6 votes |
public AuthAdapter(Context context) { this.context = context; // 获取平台列表 Platform[] tmp = ShareSDK.getPlatformList(); platforms = new ArrayList<Platform>(); if (tmp == null) { return; } for (Platform p : tmp) { String name = p.getName(); if ((p instanceof CustomPlatform) || !ShareCore.canAuthorize(p.getContext(), name)) { continue; } if (p.getName().equals(Wechat.NAME)){ continue; } platforms.add(p); } }
Example #3
Source File: UserBean.java From LiuAGeAndroid with MIT License | 6 votes |
/** * 从本地更新用户信息 - 登录成功后保存到偏好设置 */ 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(); }
Example #4
Source File: PlatformShareManager.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareFile(String name, Activity activity) { if (name.equals(Dropbox.NAME)) { DropboxShare dropboxShare = new DropboxShare(platformActionListener); dropboxShare.shareFile(); } else if (name.equals(QZone.NAME)) { QQZoneShare qqZoneShare = new QQZoneShare(platformActionListener); qqZoneShare.shareVideo(); } else if (name.equals(Wechat.NAME)) { WechatShare wechatShare = new WechatShare(platformActionListener); wechatShare.shareFile(); } else if (name.equals(WechatFavorite.NAME)) { WechatFavoriteShare wechatFavoriteShare = new WechatFavoriteShare(platformActionListener); wechatFavoriteShare.shareFile(); } else if (name.equals(Wework.NAME)) { WeworkShare weworkShare = new WeworkShare(platformActionListener); weworkShare.shareFile(activity); } else { Platform platform = ShareSDK.getPlatform(name); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath()); shareParams.setShareType(Platform.SHARE_FILE); platform.setPlatformActionListener(platformActionListener); platform.share(shareParams); } }
Example #5
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareVideo(PlatformActionListener mListener){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl()); shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath()); shareParams.setScence(0); shareParams.setShareType(Platform.SHARE_VIDEO); platform.setPlatformActionListener(mListener); platform.share(shareParams); }
Example #6
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareMusic(PlatformActionListener mListener){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath()); shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl()); shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl()); shareParams.setMusicUrl(ResourcesManager.getInstace(MobSDK.getContext()).getMusicUrl()); shareParams.setShareType(Platform.SHARE_MUSIC); platform.setPlatformActionListener(mListener); platform.share(shareParams); }
Example #7
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareImage(PlatformActionListener mListener){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath()); shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl()); shareParams.setImageData(ResourcesManager.getInstace(MobSDK.getContext()).getImageBmp()); shareParams.setShareType(Platform.SHARE_IMAGE); platform.setPlatformActionListener(mListener); platform.share(shareParams); }
Example #8
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareText(PlatformActionListener mListener){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setShareType(Platform.SHARE_TEXT); platform.setPlatformActionListener(mListener); platform.share(shareParams); }
Example #9
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareMiniProgram(){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl()); shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath()); shareParams.setImageData(ResourcesManager.getInstace(MobSDK.getContext()).getImageBmp()); shareParams.setImageUrl("https://t3.ftcdn.net/jpg/02/01/25/00/240_F_201250053_xMFe9Hax6w01gOiinRLEPX0Wt1zGCzYz.jpg"); shareParams.setShareType(Platform.SHARE_WXMINIPROGRAM); platform.setPlatformActionListener(platformActionListener); platform.share(shareParams); }
Example #10
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareEmoji(){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setImageUrl("https://t3.ftcdn.net/jpg/02/01/25/00/240_F_201250053_xMFe9Hax6w01gOiinRLEPX0Wt1zGCzYz.jpg"); shareParams.setShareType(Platform.SHARE_EMOJI); platform.setPlatformActionListener(platformActionListener); platform.share(shareParams); }
Example #11
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareFile(){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath()); shareParams.setImageUrl("https://t3.ftcdn.net/jpg/02/01/25/00/240_F_201250053_xMFe9Hax6w01gOiinRLEPX0Wt1zGCzYz.jpg"); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setShareType(Platform.SHARE_FILE); platform.setPlatformActionListener(platformActionListener); platform.share(shareParams); }
Example #12
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareWebpager(){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setUrl(LINK_URL); shareParams.setImageUrl("https://t3.ftcdn.net/jpg/02/01/25/00/240_F_201250053_xMFe9Hax6w01gOiinRLEPX0Wt1zGCzYz.jpg"); shareParams.setShareType(Platform.SHARE_WEBPAGE); platform.setPlatformActionListener(platformActionListener); platform.share(shareParams); }
Example #13
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareVideo(){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl()); shareParams.setImageUrl("https://t3.ftcdn.net/jpg/02/01/25/00/240_F_201250053_xMFe9Hax6w01gOiinRLEPX0Wt1zGCzYz.jpg"); shareParams.setShareType(Platform.SHARE_VIDEO); platform.setPlatformActionListener(platformActionListener); platform.share(shareParams); }
Example #14
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareMusic(){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath()); shareParams.setImageUrl("https://t3.ftcdn.net/jpg/02/01/25/00/240_F_201250053_xMFe9Hax6w01gOiinRLEPX0Wt1zGCzYz.jpg"); String musicUrl = "http://music.baidu.com/song/546920050?pst=sug"; shareParams.setMusicUrl(musicUrl); shareParams.setUrl(musicUrl); shareParams.setShareType(Platform.SHARE_MUSIC); platform.setPlatformActionListener(platformActionListener); platform.share(shareParams); }
Example #15
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareImage(){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setImageUrl("https://t3.ftcdn.net/jpg/02/01/25/00/240_F_201250053_xMFe9Hax6w01gOiinRLEPX0Wt1zGCzYz.jpg"); shareParams.setShareType(Platform.SHARE_IMAGE); platform.setPlatformActionListener(platformActionListener); platform.share(shareParams); }
Example #16
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareText(){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setShareType(Platform.SHARE_TEXT); platform.setPlatformActionListener(platformActionListener); platform.share(shareParams); }
Example #17
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareWebpager(PlatformActionListener mListener){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath()); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl()); shareParams.setImageData(ResourcesManager.getInstace(MobSDK.getContext()).getImageBmp()); shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath()); shareParams.setShareType(Platform.SHARE_WEBPAGE); platform.setPlatformActionListener(mListener); platform.share(shareParams); }
Example #18
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareFile(PlatformActionListener mListener){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath()); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setShareType(Platform.SHARE_FILE); shareParams.setImageData(ResourcesManager.getInstace(MobSDK.getContext()).getImageBmp()); shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath()); platform.setPlatformActionListener(mListener); platform.share(shareParams); }
Example #19
Source File: FragmentLogin.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
@Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 0: Platform platform = (Platform) msg.obj; String platformName = ""; if (Wechat.NAME.equals(platform.getName())) { platformName = "wechat"; } else if (QZone.NAME.equals(platform.getName())) { platformName = "qq"; } else if (SinaWeibo.NAME.equals(platform.getName())) { platformName = "sina"; } checkBind(platform.getDb(), platformName); break; case 1: ZToastUtils.toastMessage(mContext.getApplicationContext(), getString(R.string.wechat_client_inavailable)); break; case 2: ZToastUtils.toastMessage(mContext.getApplicationContext(), getString(R.string.v_toast_third_sso_fail)); break; case 3: ZToastUtils.toastMessage(mContext.getApplicationContext(), getString(R.string.v_toast_third_sso_cancel)); break; } }
Example #20
Source File: FragmentLogin.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { int vId = v.getId(); switch (vId) { case R.id.tv_regist: mCallBack.fragmentChanged(FragmentRegist.class.getSimpleName(), null, false); break; case R.id.tv_forgetpwd: //TODO // mCallBack.fragmentChanged(FragmentForgetPwd.class.getSimpleName(), null, false); break; case R.id.iv_wechat: ShareSDK.initSDK(mContext); authorize(ShareSDK.getPlatform(Wechat.NAME), "wechat"); break; case R.id.iv_qq: ShareSDK.initSDK(mContext); authorize(ShareSDK.getPlatform(QZone.NAME), "qq"); break; case R.id.iv_sina: ShareSDK.initSDK(mContext); authorize(ShareSDK.getPlatform(SinaWeibo.NAME), "sina"); break; case R.id.iv_close: getActivity().onBackPressed(); break; case R.id.btn_login: String userName = mEt_username.getText().toString(); String pwd = mEt_pwd.getText().toString(); if (TextUtils.isEmpty(userName) || TextUtils.isEmpty(pwd)) { ZToastUtils.toastMessage(mContext.getApplicationContext(), R.string.z_toast_name_pwd_not_null); return; } login(userName, pwd); break; } }
Example #21
Source File: InitUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
public static void initShareSDK(Context context) { ShareSDK.initSDK(context, true); HashMap<String, Object> hashMap1 = new HashMap<String, Object>(); hashMap1.put("Id", 1); hashMap1.put("Enable", ClanUtils.isUseShareSDKPlatformName(context, SinaWeibo.NAME) + ""); ShareSDK.setPlatformDevInfo(Wechat.NAME, hashMap1); // HashMap<String, Object> hashMap3 = new HashMap<String, Object>(); // hashMap3.put("Id", 6); // hashMap3.put("Enable", ClanUtils.isUseShareSDKPlatformName(context, QQ.NAME) + ""); // ShareSDK.setPlatformDevInfo("QZone", hashMap3); HashMap<String, Object> hashMap4 = new HashMap<String, Object>(); hashMap4.put("Id", 4); hashMap4.put("Enable", ClanUtils.isUseShareSDKPlatformName(context, Wechat.NAME) + ""); ShareSDK.setPlatformDevInfo(Wechat.NAME, hashMap4); HashMap<String, Object> hashMap5 = new HashMap<String, Object>(); hashMap5.put("Id", 5); hashMap5.put("Enable", ClanUtils.isUseShareSDKPlatformName(context, Wechat.NAME) + ""); ShareSDK.setPlatformDevInfo(WechatMoments.NAME, hashMap5); // HashMap<String, Object> hashMap6 = new HashMap<String, Object>(); // hashMap6.put("Id", 6); // hashMap6.put("Enable", ClanUtils.isUseShareSDKPlatformName(context, Wechat.NAME) + ""); // ShareSDK.setPlatformDevInfo(WechatFavorite.NAME, hashMap6); // HashMap<String, Object> hashMap7 = new HashMap<String, Object>(); // hashMap7.put("Id", 7); // hashMap7.put("Enable", ClanUtils.isUseShareSDKPlatformName(context, QQ.NAME) + ""); // ShareSDK.setPlatformDevInfo(QQ.NAME, hashMap7); }
Example #22
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareEmoji(PlatformActionListener mListener){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath()); shareParams.setImageData(ResourcesManager.getInstace(MobSDK.getContext()).getImageBmp()); shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl()); shareParams.setShareType(Platform.SHARE_EMOJI); platform.setPlatformActionListener(mListener); platform.share(shareParams); }
Example #23
Source File: WechatShare.java From ShareSDK-for-Android with MIT License | 5 votes |
public void shareMiniProgram(PlatformActionListener mListener){ Platform platform = ShareSDK.getPlatform(Wechat.NAME); Platform.ShareParams shareParams = new Platform.ShareParams(); shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText()); shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle()); shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl()); shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath()); shareParams.setImageData(ResourcesManager.getInstace(MobSDK.getContext()).getImageBmp()); shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl()); shareParams.setShareType(Platform.SHARE_WXMINIPROGRAM); platform.setPlatformActionListener(mListener); platform.share(shareParams); }
Example #24
Source File: NewsDetailActivity.java From BaoKanAndroid with MIT License | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.ib_news_detail_bottom_bar_back: finish(); break; case R.id.ib_news_detail_bottom_bar_edit: showCommentDialog(); break; case R.id.ib_news_detail_bottom_bar_font: showSetFontDialog(); break; case R.id.ib_news_detail_bottom_bar_collection: collectArticle(); break; case R.id.ib_news_detail_bottom_bar_share: // 弹出分享ui showShare(null); break; case R.id.ll_article_content_share_qq: // qq分享 showShare(ShareSDK.getPlatform(QQ.NAME).getName()); break; case R.id.ll_article_content_share_weixin: // 微信分享 showShare(ShareSDK.getPlatform(Wechat.NAME).getName()); break; case R.id.ll_article_content_share_pyq: // 朋友圈分享 showShare(ShareSDK.getPlatform(WechatMoments.NAME).getName()); break; } }
Example #25
Source File: NewsDetailActivity.java From LiuAGeAndroid with MIT License | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.ib_news_detail_bottom_bar_back: finish(); break; case R.id.ib_news_detail_bottom_bar_edit: showCommentDialog(); break; case R.id.ib_news_detail_bottom_bar_font: showSetFontDialog(); break; case R.id.ib_news_detail_bottom_bar_collection: collectArticle(); break; case R.id.ib_news_detail_bottom_bar_share: // 弹出分享ui showShare(null); break; case R.id.ll_article_content_share_qq: // qq分享 showShare(ShareSDK.getPlatform(QQ.NAME).getName()); break; case R.id.ll_article_content_share_weixin: // 微信分享 showShare(ShareSDK.getPlatform(Wechat.NAME).getName()); break; case R.id.ll_article_content_share_pyq: // 朋友圈分享 showShare(ShareSDK.getPlatform(WechatMoments.NAME).getName()); break; case R.id.iv_news_detail_ad_image: didTappedAdImageView(); break; } }
Example #26
Source File: SdkTagsMainActivity.java From ShareSDK-for-Android with MIT License | 5 votes |
private void WeChat() { Platform plat = ShareSDK.getPlatform(Wechat.NAME); ShareSDK.setEnableAuthTag(true); plat.removeAccount(true); //plat.SSOSetting(false); plat.setPlatformActionListener(this); if (plat.isClientValid()) { } if (plat.isAuthValid()) { } //plat.authorize(); //要功能,不要数据 plat.showUser(null); //要数据不要功能,主要体现在不会重复出现授权界面 }
Example #27
Source File: MainActivity.java From -Android_ShareSDK_Example_Wechat with MIT License | 4 votes |
@Override public void onClick(View v) { if(v.getId() == R.id.button1){ //快捷分享,没有九宫格,只有编辑页 //Using onekeyshare library to share wechat OnekeyShare oks = new OnekeyShare(); // 分享时Notification的图标和文字 //Settig the notification of picture and content on the status bar when share successfully oks.setNotification(R.drawable.ic_launcher, "Gtpass"); //设置默认微博平台,例如腾讯微博的,可以是TencentWeibo.NAME //Setting the share platform //If it is not been setted, that will show the Nine Grid Palace oks.setPlatform(Wechat.NAME); //分享纯文本 //微信分享必须要有text和title这两个参数 //不同的分享类型,分享参数不一样,可以参考sample中wechatpage这个类 //参数文档:http://sharesdk.cn/androidDoc/index.html?cn/sharesdk/framework/Platform.html //Share the text and title to a wechat friend //the document of the params are required when wechat share,http://sharesdk.cn/androidDoc/index.html?cn/sharesdk/framework/Platform.html oks.setText("ShareSDK share text"); oks.setTitle("ShareSDK share title"); oks.setSilent(true); oks.show(MainActivity.this); }else if (v.equals(ctvStWm)) { //微信朋友圈,wechat moment ctvStWm.setChecked(!ctvStWm.isChecked()); findViewById(R.id.btnApp).setVisibility(ctvStWm.isChecked() ? View.GONE : View.VISIBLE); findViewById(R.id.btnAppExt).setVisibility(ctvStWm.isChecked() ? View.GONE : View.VISIBLE); findViewById(R.id.btnFile).setVisibility(ctvStWm.isChecked() ? View.GONE : View.VISIBLE); return; }else{ //微信好友,wechat friend String name = ctvStWm.isChecked() ? WechatMoments.NAME : Wechat.NAME; Platform plat = ShareSDK.getPlatform(MainActivity.this, name); plat.setPlatformActionListener(this); ShareParams sp = ctvStWm.isChecked() ? getWechatMomentsShareParams(v) : getWechatShareParams(v); plat.share(sp); } }
Example #28
Source File: ShareUtil.java From CatchPiggy with GNU General Public License v3.0 | 4 votes |
public static void shareToWeChat(Context context, boolean isRequestHelp, String message) { OnekeyShare onekeyShare = getData(context, isRequestHelp, message); onekeyShare.setPlatform(Wechat.NAME); onekeyShare.show(context); }
Example #29
Source File: PlatformShareManager.java From ShareSDK-for-Android with MIT License | 4 votes |
public void shareApp(String name) { if (name.equals(Wechat.NAME)) { WechatShare wechatShare = new WechatShare(platformActionListener); //wechatShare.shareApps(); } }
Example #30
Source File: PlatformAuthorizeUserInfoManager.java From ShareSDK-for-Android with MIT License | 4 votes |
public void WeiXinAuthorize() { Platform weiXin = ShareSDK.getPlatform(Wechat.NAME); doAuthorize(weiXin); }