Java Code Examples for cn.sharesdk.framework.ShareSDK#getPlatform()

The following examples show how to use cn.sharesdk.framework.ShareSDK#getPlatform() . 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 YiZhi with Apache License 2.0 6 votes vote down vote up
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);
	}
}
 
Example 2
Source File: OnekeyShareThemeImpl.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
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);
	}
}
 
Example 3
Source File: ShareItemClickListener.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
private void doShare(String platformName) {

//        shareParams.setImageUrl("http://mobfile.youzu.com/show/Uploads_image/2/e/a/d/eadf1eda9529216516c1af5a5dd3fa5f_1024_1024.png");
//        shareParams.setText("bdjdhdhdhhdjdjdj");
//        shareParams.setTitle("hdjdbdj");
//        shareParams.setUrl("http://192.168.180.23:8080/luyi3.2gbk/forum.php?mod=viewthread&tid=1");

//        ZogUtils.printError(ShareItemClickListener.class, "title:::" + shareParams.getTitle() + "\ntext:::" + shareParams.getText());

        ZogUtils.printError(ShareItemClickListener.class, "do doShare:" + JsonUtils.toJSON(shareParams).toString());

        Platform plat = ShareSDK.getPlatform(context, platformName);
        plat.SSOSetting(true);
        if (platformActionListener != null) {
            plat.setPlatformActionListener(platformActionListener);
        }
        plat.share(shareParams);


//        plat.setPlatformActionListener(platformActionListener);
//        ShareCore shareCore = new ShareCore();
////        shareCore.setShareContentCustomizeCallback(customizeCallback);
//        shareCore.share(plat, data);
    }
 
Example 4
Source File: FacebookMessengerShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareImage(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(FacebookMessenger.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.setImageArray(ResourcesManager.getInstace(MobSDK.getContext()).randomPic());
	shareParams.setShareType(Platform.SHARE_IMAGE);
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 5
Source File: NetEaseMicroBlog.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareText(){
	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(platformActionListener);
	platform.share(shareParams);
}
 
Example 6
Source File: TelegramShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareText(){
	Platform platform = ShareSDK.getPlatform(Telegram.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(LINK_TEXT);
	shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
	shareParams.setUrl(LINK_URL);
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 7
Source File: QQZoneShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareWebPager(){
	Platform platform = ShareSDK.getPlatform(QZone.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(LINK_TEXT);
	shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
	shareParams.setUrl(LINK_URL);
	shareParams.setTitleUrl(ResourcesManager.getInstace(MobSDK.getContext()).getTitleUrl());
	shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
	platform.setPlatformActionListener(platformActionListener);
	shareParams.setShareType(Platform.SHARE_WEBPAGE);
	platform.share(shareParams);
}
 
Example 8
Source File: WechatFavoriteShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareFile(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(WechatFavorite.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 9
Source File: WhatsAppShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareVideo(){
	Platform platform = ShareSDK.getPlatform(WhatsApp.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath());
	platform.setPlatformActionListener(platformActionListener);
	shareParams.setShareType(Platform.SHARE_VIDEO);
	platform.share(shareParams);
}
 
Example 10
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 11
Source File: VKontakteShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareMessage(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(VKontakte.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.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl());
	shareParams.setFriend(ResourcesManager.IS_FRIEND);
	shareParams.setLatitude(ResourcesManager.latitude);
	shareParams.setLongitude(ResourcesManager.longitude);
	shareParams.setGroupId(" ");
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 12
Source File: KakaoTalkShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareImage(){
	Platform platform = ShareSDK.getPlatform(KakaoTalk.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.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
	shareParams.setShareType(Platform.SHARE_IMAGE);
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 13
Source File: TwitterShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareVideo(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(Twitter.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath());
	shareParams.setShareType(Platform.SHARE_VIDEO);
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 14
Source File: GooglePlusShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareVideo() {
	Platform platform = ShareSDK.getPlatform(GooglePlus.NAME);
	if (platform != null && platform.isClientValid()) {
		Platform.ShareParams shareParams = new Platform.ShareParams();
		shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
		shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath());
		shareParams.setShareType(Platform.SHARE_VIDEO);
		platform.setPlatformActionListener(platformActionListener);
		platform.share(shareParams);
	} else {
		Toast.makeText(MobSDK.getContext(), "Client is not found or version low.", Toast.LENGTH_SHORT).show();
	}

}
 
Example 15
Source File: QQZoneShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareVideo(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(QZone.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath());
	shareParams.setShareType(Platform.SHARE_VIDEO);
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 16
Source File: WeiboShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareText(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(TencentWeibo.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	shareParams.setShareTencentWeibo(true);
	shareParams.setShareType(Platform.SHARE_TEXT);
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 17
Source File: TelegramShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareImage(){
	Platform platform = ShareSDK.getPlatform(Telegram.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.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
	//shareParams.setImageArray(ResourcesManager.getInstace(MobSDK.getContext()).randomPic());
	shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl());
	platform.setPlatformActionListener(platformActionListener);
	platform.share(shareParams);
}
 
Example 18
Source File: EvernoteShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareVideo(PlatformActionListener mListener) {
	Platform platform = ShareSDK.getPlatform(Evernote.NAME);
	Platform.ShareParams shareParams = new Platform.ShareParams();
	shareParams.setFilePath(ResourcesManager.getInstace(MobSDK.getContext()).getFilePath());
	shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
	shareParams.setShareType(Platform.SHARE_VIDEO);
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 19
Source File: DingdingMessageShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareMusic(PlatformActionListener mListener){
	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.setMusicUrl(ResourcesManager.getInstace(MobSDK.getContext()).getMusicUrl());
	shareParams.setUrl(ResourcesManager.getInstace(MobSDK.getContext()).getUrl());
	shareParams.setShareType(Platform.SHARE_MUSIC);
	shareParams.setScence(1);
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example 20
Source File: PlatformAuthorizeUserInfoManager.java    From ShareSDK-for-Android with MIT License 4 votes vote down vote up
public void flickrAuthorize() {
	Platform flickrShare = ShareSDK.getPlatform(Flickr.NAME);
	doAuthorize(flickrShare);
}