cn.sharesdk.tencent.qq.QQ Java Examples

The following examples show how to use cn.sharesdk.tencent.qq.QQ. 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 vote down vote up
/**
	 * 转为自己平台的表示
	 * @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: UserBean.java    From LiuAGeAndroid with MIT License 6 votes vote down vote up
/**
 * 从本地更新用户信息 - 登录成功后保存到偏好设置
 */
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 #3
Source File: UserBean.java    From BaoKanAndroid with MIT License 6 votes vote down vote up
/**
 * 从本地更新用户信息 - 登录成功后保存到偏好设置
 */
public void updateUserInfoFromLocal() {

    // 移除第三方授权
    Platform weibo = ShareSDK.getPlatform(SinaWeibo.NAME);
    if (weibo.isAuthValid()) {
        weibo.removeAccount(true);
    }
    Platform qq = ShareSDK.getPlatform(QQ.NAME);
    if (qq.isAuthValid()) {
        qq.removeAccount(true);
    }

    // 内存缓存
    UserBean.userAccount = this;
    // 磁盘缓存
    encode();
}
 
Example #4
Source File: NewsDetailActivity.java    From BaoKanAndroid with MIT License 5 votes vote down vote up
@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 #5
Source File: ShareMobLinkActivity.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareWebPager(){
    Platform platform = ShareSDK.getPlatform(QQ.NAME);
    boolean clientBool = platform.isClientValid();
    if (clientBool) {
        Platform.ShareParams shareParams = new  Platform.ShareParams();
        shareParams.setText(LINK_TEXT);
        shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
        shareParams.setTitleUrl(LINK_URL);
        shareParams.setShareType(Platform.SHARE_WEBPAGE);
        platform.share(shareParams);
    } else {
        Toast.makeText(MobSDK.getContext(), "请先安装QQ客户端", Toast.LENGTH_LONG).show();
    }
}
 
Example #6
Source File: WeiboShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareImage(PlatformActionListener mListener){
	Platform platform = ShareSDK.getPlatform(QQ.NAME);
	Platform.ShareParams shareParams = new  Platform.ShareParams();
	shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
	shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
	shareParams.setShareTencentWeibo(true);
	shareParams.setShareType(Platform.SHARE_IMAGE);
	platform.setPlatformActionListener(mListener);
	platform.share(shareParams);
}
 
Example #7
Source File: QQShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareQQMiniProgram() {
    Platform platform = ShareSDK.getPlatform(QQ.NAME);
    Platform.ShareParams shareParams = new Platform.ShareParams();
    shareParams.setText("QQ小程序");
    shareParams.setTitle("QQ互联");
    shareParams.setTitleUrl("http://www.qq.com/");
    shareParams.setImageUrl("http://www.3wyu.com/wp-content/uploads/6e0eaf15gy1fvr5tnm2dfj20f108gtad.jpg");
    shareParams.setShareType(Platform.QQ_MINI_PROGRAM);
    shareParams.setQQMiniProgramAppid("1108318575"); //官方的
    shareParams.setQQMiniProgramPath("page/share/index.html?share_name=QQ%E9%9F%B3%E4%B9%90&share_key=5aIqFGg&from=disk");
    shareParams.setQQMiniProgramType("");
    platform.setPlatformActionListener(platformActionListener);
    platform.share(shareParams);
}
 
Example #8
Source File: QQShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareMusic(PlatformActionListener mListener) {
    Platform platform = ShareSDK.getPlatform(QQ.NAME);
    Platform.ShareParams shareParams = new Platform.ShareParams();
    shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
    shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
    shareParams.setTitleUrl(ResourcesManager.getInstace(MobSDK.getContext()).getTitleUrl());
    shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
    shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
    shareParams.setMusicUrl(ResourcesManager.getInstace(MobSDK.getContext()).getMusicUrl());
    shareParams.setShareType(Platform.SHARE_MUSIC);
    platform.setPlatformActionListener(mListener);
    platform.share(shareParams);
}
 
Example #9
Source File: QQShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareImage(PlatformActionListener mListener) {
    Platform platform = ShareSDK.getPlatform(QQ.NAME);
    Platform.ShareParams shareParams = new Platform.ShareParams();
    shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
    shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
    shareParams.setShareType(Platform.SHARE_IMAGE);
    platform.setPlatformActionListener(mListener);
    platform.share(shareParams);
}
 
Example #10
Source File: QQShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareWebPager(PlatformActionListener mListener) {
    Platform platform = ShareSDK.getPlatform(QQ.NAME);
    Platform.ShareParams shareParams = new Platform.ShareParams();
    shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
    shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
    shareParams.setTitleUrl(ResourcesManager.getInstace(MobSDK.getContext()).getTitleUrl());
    shareParams.setShareType(Platform.SHARE_WEBPAGE);
    platform.setPlatformActionListener(mListener);
    platform.share(shareParams);
}
 
Example #11
Source File: QQShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareMusic() {
    Platform platform = ShareSDK.getPlatform(QQ.NAME);
    Platform.ShareParams shareParams = new Platform.ShareParams();
    shareParams.setText(ResourcesManager.getInstace(MobSDK.getContext()).getText());
    shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
    shareParams.setTitleUrl(ResourcesManager.getInstace(MobSDK.getContext()).getTitleUrl());
    shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
    shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
    shareParams.setMusicUrl(ResourcesManager.getInstace(MobSDK.getContext()).getMusicUrl());
    shareParams.setShareType(Platform.SHARE_MUSIC);
    platform.setPlatformActionListener(platformActionListener);
    platform.share(shareParams);
}
 
Example #12
Source File: QQShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareImage() {
    Platform platform = ShareSDK.getPlatform(QQ.NAME);
    Platform.ShareParams shareParams = new Platform.ShareParams();
    shareParams.setImagePath(ResourcesManager.getInstace(MobSDK.getContext()).getImagePath());
    shareParams.setImageUrl(ResourcesManager.getInstace(MobSDK.getContext()).getImageUrl());
    //shareParams.setImageUrl("http://pic28.photophoto.cn/20130818/0020033143720852_b.jpg");
    platform.setPlatformActionListener(platformActionListener);
    shareParams.setShareType(Platform.SHARE_IMAGE);
    platform.share(shareParams);
}
 
Example #13
Source File: QQShare.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareWebPager() {
    Platform platform = ShareSDK.getPlatform(QQ.NAME);
    Platform.ShareParams shareParams = new Platform.ShareParams();
    shareParams.setText(LINK_TEXT);
    shareParams.setTitle(ResourcesManager.getInstace(MobSDK.getContext()).getTitle());
    shareParams.setTitleUrl(LINK_URL);
    shareParams.setShareType(Platform.SHARE_WEBPAGE);
    platform.setPlatformActionListener(platformActionListener);
    platform.share(shareParams);
}
 
Example #14
Source File: PlatformShareManager.java    From ShareSDK-for-Android with MIT License 5 votes vote down vote up
public void shareQQMiniProgram(String name, Activity activity) {
	if (name.equals(QQ.NAME)) {
		QQShare qqShare = new QQShare(platformActionListener);
		qqShare.shareQQMiniProgram();
	}
	if (name.equals(QZone.NAME)) {
		QQZoneShare qqZoneShare = new QQZoneShare(platformActionListener);
		qqZoneShare.shareQQMiniProgram(activity);
	}
}
 
Example #15
Source File: WeatherActivity.java    From PoetryWeather with Apache License 2.0 5 votes vote down vote up
private void showShare() {
    OnekeyShare oks = new OnekeyShare();
    //关闭sso授权
    oks.disableSSOWhenAuthorize();

    // title标题,微信、QQ和QQ空间等平台使用
    oks.setTitle(getString(R.string.shareName));
    // titleUrl QQ和QQ空间跳转链接
    oks.setTitleUrl("http://hzmeurasia.cn");
    // text是分享文本,所有平台都需要这个字段
    oks.setText("我是分享文本");
    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    //确保SDcard下面存在此张图片
    oks.setImagePath(Environment.getExternalStorageDirectory().getAbsolutePath()+"/ScreenPoetryWeather.png");
    // url在微信、微博,Facebook等平台中使用
    oks.setShareContentCustomizeCallback(new ShareContentCustomizeCallback() {
        @Override
        public void onShare(Platform platform, Platform.ShareParams shareParams) {
            if (platform.getName().equalsIgnoreCase(QQ.NAME)) {
                shareParams.setText(null);
                shareParams.setTitle(null);
                shareParams.setTitleUrl(null);
                shareParams.setImagePath(Environment.getExternalStorageDirectory().getAbsolutePath()+"/ScreenPoetryWeather.png");
            }
        }
    });
    oks.setUrl("http://hzmeurasia.cn");
    // 启动分享GUI
    oks.show(this);
}
 
Example #16
Source File: LoginActivity.java    From xmpp with Apache License 2.0 5 votes vote down vote up
/**
 * QQ登录
 */
private void qq_login() {
    Platform weibo = ShareSDK.getPlatform(QQ.NAME);
    if (weibo.isValid()) {
        weibo.removeAccount();//删除前一次的授权信息
    }

    weibo.setPlatformActionListener(this); // 设置分享事件回调

    // 设置false表示使用SSO授权方式,意思就是如果有QQ就直接跳到QQ授权,如果没有就跳到网页
    weibo.SSOSetting(false);


    weibo.showUser(null);
}
 
Example #17
Source File: NewsDetailActivity.java    From LiuAGeAndroid with MIT License 5 votes vote down vote up
@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 #18
Source File: LoginActivity.java    From BaoKanAndroid with MIT License 4 votes vote down vote up
/**
 * qq登录
 */
private void qqLogin() {
    showShareSDKLogin(QQ.NAME);
}
 
Example #19
Source File: LoginActivity.java    From LiuAGeAndroid with MIT License 4 votes vote down vote up
/**
 * qq登录
 */
private void qqLogin() {
    showShareSDKLogin(QQ.NAME);
}
 
Example #20
Source File: LoginAty.java    From Huochexing12306 with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(View v) {
	switch (v.getId()) {
	case R.id.login_btnSkip:
		startActivity(new Intent(this, MainActivity.class));
		this.finish();
		break;
	case R.id.login_btnLogin:
		// 登录验证代码
		String usernameText = "";
		String passwordText = "";
		try {
			usernameText = etUserName.getText().toString().trim();
			passwordText = etPwd.getText().toString().trim();
		} catch (Exception e) {
			e.printStackTrace();
		}
		// 检验输入是否合法
		if (!validate(usernameText, passwordText)) {
			return;
		}
		// 登录
		// 检查网络是否可用
		if (HttpUtil.isNetworkConnected(LoginAty.this)) {
			// 登录
			login(usernameText, passwordText, false);
		} else {
			showMsg("网络不可用,请检查网络状态" + SF.NO_NETWORK);
		}
		break;
	case R.id.login_btnFindPwd:
		startActivity(new Intent(this, FindPwdActivity.class));
		break;
	case R.id.login_btnUserRegister:
		startActivity(new Intent(this, RegisterActivity.class));
		break;
	case R.id.login_ivQQ:
		doThirdPartyLogin(new QQ(this));
		break;
	case R.id.login_ivSinaWeibo:
		doThirdPartyLogin(new SinaWeibo(this));
		break;
	case R.id.login_ivDouban:
		break;
	case R.id.login_ivGoogleplus:
		doThirdPartyLogin(new GooglePlus(this));
		break;
	case R.id.login_ivWeichat:
		doThirdPartyLogin(new Wechat(this));
		break;
	case R.id.login_ivYixin:
		doThirdPartyLogin(new Yixin(this));
		break;
	case R.id.login_ivRenren:
		doThirdPartyLogin(new Renren(this));
		break;
	case R.id.login_ivLine:
		doThirdPartyLogin(new Line(this));
		break;
	}
}
 
Example #21
Source File: ShareUtil.java    From CatchPiggy with GNU General Public License v3.0 4 votes vote down vote up
public static void shareToQQ(Context context, boolean isRequestHelp, String message) {
    OnekeyShare onekeyShare = getData(context, isRequestHelp, message);
    onekeyShare.setPlatform(QQ.NAME);
    onekeyShare.show(context);
}