Java Code Examples for cn.sharesdk.framework.Platform#share()

The following examples show how to use cn.sharesdk.framework.Platform#share() . 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: OnekeyShareThemeImpl.java    From HHComicViewer with Apache License 2.0 6 votes vote down vote up
final void shareSilently(Platform platform) {
	if (formateShareData(platform)) {
		ShareParams sp = shareDataToShareParams(platform);
		if (sp != null) {
			toast("ssdk_oks_sharing");
			if (customizeCallback != null) {
				customizeCallback.onShare(platform, sp);
			}
			if (disableSSO) {
				platform.SSOSetting(disableSSO);
			}
			platform.setPlatformActionListener(callback);
			platform.share(sp);
		}
	}
}
 
Example 2
Source File: ShareItemClickListener.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
/**
 * 分享到短信
 */
private void shortMessage() {
    Platform.ShareParams sp = new Platform.ShareParams();
    sp.setAddress("");
    sp.setText(shareParams.getText() + "这是网址《" + shareParams.getUrl() + "》很给力哦!");

    Platform circle = ShareSDK.getPlatform(context, "ShortMessage");
    circle.setPlatformActionListener(platformActionListener); // 设置分享事件回调
    // 执行图文分享
    circle.share(sp);
}
 
Example 3
Source File: SohuSuishenkanShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareText(){
	Platform platform = ShareSDK.getPlatform("SohuSuishenkan");
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl());
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 4
Source File: NetEaseMicroBlog.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareText(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform("NetEaseMicroBlog");
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	shareParams.setShareType(Platform.SHARE_VIDEO);
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 5
Source File: WechatMomentsShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareVideo(){
	Platform platform = ShareSDK.getPlatform(WechatMoments.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.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
	shareParams.setShareType(Platform.SHARE_VIDEO);
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 6
Source File: LineShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareImage(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(Line.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
	shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 7
Source File: SohuMicroBlogShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareImage(){
	Platform platform = ShareSDK.getPlatform("SohuMicroBlog");
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
	shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 8
Source File: TumblrShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareText(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(Tumblr.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 9
Source File: TwitterShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareText(){
	Platform platform = ShareSDK.getPlatform(Twitter.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 10
Source File: PocketShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareWebPager(){
	Platform platform = ShareSDK.getPlatform(Pocket.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
	shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl());
	shareParams.setTags(ResourcesManager.TAGS);
	shareParams.setExtInfo(ResourcesManager.EXT_INFO);
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 11
Source File: KakaoStoryShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareVideo(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(KakaoStory.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath());
	shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
	shareParams.setShareType(Platform.SHARE_VIDEO);
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 12
Source File: KakaoStoryShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareText(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(KakaoStory.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
	shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
	shareParams.setSite(ResourcesManager.getInstace(MobSDK.getContext()).getSite());
	shareParams.setComment(ResourcesManager.getInstace(MobSDK.getContext()).getComment());
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 13
Source File: DingdingMessageShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareVideo(){
	Platform platform = ShareSDK.getPlatform(Dingding.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
	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.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl());
	shareParams.setShareType(Platform.SHARE_VIDEO);
	shareParams.setScence(1);
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 14
Source File: YixinMomentsShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareVideo(){
	Platform platform = ShareSDK.getPlatform(YixinMoments.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText("yixinText");
	shareParams.setTitle("title");
	shareParams.setImageUrl("https://t3.ftcdn.net/jpg/02/01/25/00/240_F_201250053_xMFe9Hax6w01gOiinRLEPX0Wt1zGCzYz.jpg");
	shareParams.setMusicUrl("https://y.qq.com/n/yqq/song/807557_num.html?ADTAG=h5_playsong&no_redirect=1");
	shareParams.setUrl("http://f1.webshare.mob.com/dvideo/demovideos.mp4");
	shareParams.setShareType(Platform.SHARE_VIDEO);
	shareParams.setScence(1);
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 15
Source File: RedditShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
/** 即时分享链接,setText也不能为空,虽然text并不会显示出来 **/
public void shareUrl(){
    Platform reddit = ShareSDK.getPlatform(Reddit.NAME);
    Platform.ShareParams sp = new Platform.ShareParams();
    sp.setTitle("URL shareText please ignore,If excuse , say sorry for you ===> 2018.09.14.1228");
    sp.setText(LINK_TEXT);
    sp.setSubreddit("dotnet");
    sp.setUrl(LINK_URL);
    reddit.share(sp);
}
 
Example 16
Source File: DropboxShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareImage(){
	Platform platform = ShareSDK.getPlatform(Dropbox.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
	shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 17
Source File: ShareCore.java    From WeCenterMobile-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 向指定平台分享内容
 * <p>
 * <b>注意:</b><br>
 * 参数data的键值需要严格按照{@link ShareParams}不同子类具体字段来命名,
 *否则无法反射此字段,也无法设置其值。
 */
public boolean share(Platform plat, HashMap<String, Object> data) {
	if (plat == null || data == null) {
		return false;
	}

	try {
		String imagePath = (String) data.get("imagePath");
		Bitmap viewToShare = (Bitmap) data.get("viewToShare");
		if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
			String path = R.getCachePath(plat.getContext(), "screenshot");
			File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
			FileOutputStream fos = new FileOutputStream(ss);
			viewToShare.compress(CompressFormat.JPEG, 100, fos);
			fos.flush();
			fos.close();
			data.put("imagePath", ss.getAbsolutePath());
		}
	} catch (Throwable t) {
		t.printStackTrace();
		return false;
	}

	ShareParams sp = new ShareParams(data);
	if (customizeCallback != null) {
		customizeCallback.onShare(plat, sp);
	}

	String[] flags = new String[] {
			"OnekeyShare",
			plat.getContext().getPackageName(),
			String.valueOf(ShareSDK.getSDKVersionCode())
	};
	sp.setCustomFlag(flags);
	plat.share(sp);
	return true;
}
 
Example 18
Source File: WeworkShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
/** 企业微信图片 **/
public void shareImage(String path) {
    Platform platform = ShareSDK.getPlatform(Wework.NAME);
    Platform.ShareParams sp = new Platform.ShareParams();
    sp.setText("TESTESTETS");
    sp.setImagePath(path);
    sp.setShareType(Platform.SHARE_IMAGE);
    platform.setPlatformActionListener(platformActionListener);
    platform.share(sp);
}
 
Example 19
Source File: WeiboShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareText(){
	Platform platform = ShareSDK.getPlatform(SinaWeibo.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 20
Source File: YixinShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareWebPager() {
	Platform platform = ShareSDK.getPlatform(Yixin.NAME);
	Platform.ShareParams shareParams = new Platform.ShareParams();
	shareParams.setText(LINK_TEXT);
	shareParams.setTitle("title");
	shareParams.setImageUrl("https://t3.ftcdn.net/jpg/02/01/25/00/240_F_201250053_xMFe9Hax6w01gOiinRLEPX0Wt1zGCzYz.jpg");
	shareParams.setMusicUrl("https://y.qq.com/n/yqq/song/807557_num.html?ADTAG=h5_playsong&no_redirect=1");
	shareParams.setUrl(LINK_URL);
	shareParams.setShareType(Platform.SHARE_WEBPAGE);
	shareParams.setScence(0);
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}