本文整理汇总了Java中cn.sharesdk.tencent.qq.QQ类的典型用法代码示例。如果您正苦于以下问题:Java QQ类的具体用法?Java QQ怎么用?Java QQ使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QQ类属于cn.sharesdk.tencent.qq包,在下文中一共展示了QQ类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPushAlias
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
private void addPushAlias() {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
PlatformDb db = ShareSdk.getAuthorizeData(WelcomeActy.this, QQ.NAME);
String userName = db.getUserName();
if (TextUtils.isEmpty(userName)) userName = db.getUserId();
PushAgent.getInstance(WelcomeActy.this).addAlias(userName, ALIAS_TYPE.QQ);
L.d(WelcomeActy.class, "addAlias(" + userName + ", ALIAS_TYPE.QQ)------");
} catch (JSONException e) {
L.e(WelcomeActy.class, e);
}
return null;
}
}.execute();
}
示例2: onResume
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
public void onResume() {
L.d(CategoryActy_v_1.class, "onResume-------------");
if (mShareComplete) {
if (mCurrPlatform.equals(SinaWeibo.NAME)) {
mOkSinaWeibo = true;
} else if (mCurrPlatform.equals(QZone.NAME)) {
mOkQzone = true;
} else if (mCurrPlatform.equals(WechatMoments.NAME)) {
mOkWechatMoments = true;
} else if (mCurrPlatform.equals(Wechat.NAME)) {
mOkWechat = true;
} else if (mCurrPlatform.equals(QQ.NAME)) {
mOkQQ = true;
}
if (isShared()) mBtnComplete.setText(R.string.m_category_v_1_share_link_btn_complete);
}
resetState();
}
示例3: onError
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
@Override
public void onError(Platform platform, int action, Throwable e) {
L.e(CategoryActy_v_1.class, "[onError]platform:" + platform.getName());
mShareComplete = false;
if (action == Platform.ACTION_SHARE) {
if (platform.getName().equals(SinaWeibo.NAME)) {
if (e != null) {
SinaWeiboError error = new SinaWeiboError().fromJson(e.getMessage());
Toast.makeText(mContext, error.error_code == 20016 ?
R.string.d_m_edit_share_error_sina_weibo_update_too_fast_code_20016 :
R.string.d_m_edit_share_error_sina_weibo, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(mContext, R.string.d_m_edit_share_error_sina_weibo, Toast.LENGTH_LONG).show();
}
} else if (platform.getName().equals(QZone.NAME)) {
//
} else if (platform.getName().equals(WechatMoments.NAME)) {
//
} else if (platform.getName().equals(Wechat.NAME)) {
//
} else if (platform.getName().equals(QQ.NAME)) {
//
}
}
}
示例4: onCancel
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
@Override
public void onCancel(Platform platform, int action) {
L.w(CategoryActy_v_1.class, "[onCancel]platform:" + platform.getName());
if (action == Platform.ACTION_SHARE) {
if (platform.getName().equals(SinaWeibo.NAME)) {
//
} else if (platform.getName().equals(QZone.NAME)) {
//
} else if (platform.getName().equals(WechatMoments.NAME)) {
//
} else if (platform.getName().equals(Wechat.NAME)) {
//
} else if (platform.getName().equals(QQ.NAME)) {
//
}
}
}
示例5: onResume
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
public void onResume() {
L.d(EditActy.class, "onResume-------------");
if (mShareComplete) {
if (mCurrPlatform.equals(SinaWeibo.NAME)) {
mOkSinaWeibo.setVisibility(View.VISIBLE);
} else if (mCurrPlatform.equals(QZone.NAME)) {
mOkQzone.setVisibility(View.VISIBLE);
} else if (mCurrPlatform.equals(WechatMoments.NAME)) {
mOkWechatMoments.setVisibility(View.VISIBLE);
} else if (mCurrPlatform.equals(Wechat.NAME)) {
mOkWechat.setVisibility(View.VISIBLE);
} else if (mCurrPlatform.equals(QQ.NAME)) {
mOkQQ.setVisibility(View.VISIBLE);
}
}
resetState();
}
示例6: onCancel
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
@Override
public void onCancel(Platform platform, int action) {
L.w(EditActy.class, "[onCancel]platform:" + platform.getName());
//parseAction(action);
if (action == Platform.ACTION_SHARE) {
if (platform.getName().equals(SinaWeibo.NAME)) {
//
} else if (platform.getName().equals(QZone.NAME)) {
//
} else if (platform.getName().equals(WechatMoments.NAME)) {
//
} else if (platform.getName().equals(Wechat.NAME)) {
//
} else if (platform.getName().equals(QQ.NAME)) {
//
}
}
}
示例7: showShare
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
private void showShare() {
ShareSDK.initSDK(this);
OnekeyShare oks = new OnekeyShare();
//隐藏
oks.addHiddenPlatform(QQ.NAME);
oks.addHiddenPlatform(SinaWeibo.NAME);
oks.addHiddenPlatform(TencentWeibo.NAME);
oks.addHiddenPlatform(QZone.NAME);
oks.addHiddenPlatform(WechatFavorite.NAME);
oks.addHiddenPlatform(Facebook.NAME);
oks.addHiddenPlatform(Twitter.NAME);
oks.addHiddenPlatform(ShortMessage.NAME);
oks.disableSSOWhenAuthorize();
String packgeName = mTextView_Title.getText().toString();
if (!packgeName.isEmpty() && packgeName != "") {
oks.setTitle(packgeName);
mTitle = packgeName;
} else {
oks.setTitle(mTitle);
}
oks.setShareContentCustomizeCallback(new ShareContentCustomizeCallback() {
@Override
public void onShare(Platform platform, Platform.ShareParams paramsToShare) {
if (WechatMoments.NAME.equals(platform.getName())) {
paramsToShare.setTitle(summary);
}
}
});
oks.setText(summary);
// oks.setImagePath(mImageTemp+"/yyox.png"); //分享sdcard目录下的图片
oks.setImageUrl(CommonUtils.getBaseUrl()+"/app/share/images/share.jpg");
oks.setUrl(url + "?orderNo=" + searchNo + "&orderStatus=" + orderStatus + "&companyCode=" + companyCode + "&title=" + mTitle+"&customerId="+mCustomerId);
oks.show(this);
}
示例8: getThirdPartyPlatfromInfo
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
/**
* 转为自己平台的表示
* @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;
}
}
示例9: updateUserInfoFromLocal
import cn.sharesdk.tencent.qq.QQ; //导入依赖的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();
}
示例10: updateUserInfoFromLocal
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
/**
* 从本地更新用户信息 - 登录成功后保存到偏好设置
*/
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();
}
示例11: onComplete
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
@Override
public void onComplete(Platform arg0, int arg1, HashMap<String, Object> arg2)
{//回调的地方是子线程,进行UI操作要用handle处理
if (arg0.getName().equals(SinaWeibo.NAME))
{// 判断成功的平台是不是新浪微博
handler.sendEmptyMessage(SHARE_SINA_WEIBO_SUCCESS);
} else if (arg0.getName().equals(Wechat.NAME))
{
handler.sendEmptyMessage(SHARE_WECHAT_SUCCESS);
} else if (arg0.getName().equals(WechatMoments.NAME))
{
handler.sendEmptyMessage(SHARE_WECHAT_MOMENT_SUCCESS);
} else if (arg0.getName().equals(QQ.NAME))
{
handler.sendEmptyMessage(SHARE_QQ_SUCCESS);
}
}
示例12: onClick
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (!checkLoginedOrGoToMain(true)) {
ShareSdk.authorize(WelcomeActy.this, QQ.NAME, mPlatformActionListener);
updateLoginBtnState(false);
}
}
示例13: onComplete
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
@Override
public void onComplete(Platform platform, int action, HashMap<String, Object> map) {
/*
L.d(WelcomeActy.class, "onComplete---platform:" + platform.getName());
parseAction(action);
if (map != null) {
for (Entry<String, Object> entry : map.entrySet()) {
L.i(WelcomeActy.class, "Map--key:" + entry.getKey() + ", value:" + entry.getValue());
}
}*/
switch (action) {
case Platform.ACTION_AUTHORIZING: //认证登录
if (platform.getName().equals(QQ.NAME)) {
PlatformDb db = ShareSdk.getAuthorizeData(WelcomeActy.this, platform.getName());
loginWithQQ(db.getUserId());
return;
}
break;
case Platform.ACTION_FOLLOWING_USER:
break;
case Platform.ACTION_GETTING_FRIEND_LIST:
break;
case Platform.ACTION_SENDING_DIRECT_MESSAGE:
break;
case Platform.ACTION_SHARE:
break;
case Platform.ACTION_TIMELINE:
break;
case Platform.ACTION_USER_INFOR:
break;
}
updateLoginBtnState(true);
}
示例14: onClick
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
@Override
public void onClick(View v) {
String imgPath = getAdvertImagePath();
if (imgPath != null) {
if (v == mBtnSinaWeibo) {
SinaWeiboShare sina = ShareSdk.share(mContext, SinaWeiboShare.class, mPlatformActionListener);
sina.shareTextImagePath(Share.getTextNotOverMax(sina, mShareText, Const.APP_SITE_URL), imgPath, 0.0f, 0.0f);
mCurrPlatform = SinaWeibo.NAME;
} else if (v == mBtnQzone) {
QZoneShare qzone = ShareSdk.share(mContext, QZoneShare.class, mPlatformActionListener);
//注意有空格和无空格的情况,不可随意修改
//qzone.shareTextImagePath("", Const.APP_SITE_URL, " ", bitmapPath, null, Const.APP_SITE_URL);
qzone.shareTextImagePath("", Const.APP_SITE_URL, Share.getTextNotOverMax(qzone, mShareText, null), imgPath, null, Const.APP_SITE_URL);
mCurrPlatform = QZone.NAME;
//不会正确回调,因此,只要调用成功即视为分享成功
//mPlatformActionListener.onComplete(ShareSdk.getPlatform(mContext, QZone.NAME), Platform.ACTION_SHARE, null);
} else if (v == mBtnWechatMoments) {
WechatMomentsShare wechatMoments = ShareSdk.share(mContext, WechatMomentsShare.class, mPlatformActionListener);
wechatMoments.shareWebPageWithText(Share.getTitleNotOverMax(wechatMoments, mShareText), "", imgPath, Const.APP_SITE_URL);
mCurrPlatform = WechatMoments.NAME;
//不跳页,且不会回调,但是会收到onPause(),只要调用成功即视为分享成功,那么只要在onResume()时认为成功即可
mShareComplete = true;
} else if (v == mBtnWechat) {
WechatShare wechat = ShareSdk.share(mContext, WechatShare.class, mPlatformActionListener);
wechat.shareWebPageWithText("", Share.getTextNotOverMax(wechat, mShareText, null), imgPath, Const.APP_SITE_URL);
mCurrPlatform = Wechat.NAME;
//不会正确回调,但会跳页,因此,只要调用成功即视为分享成功,同上
mShareComplete = true;
} else if (v == mBtnQQ) {
QQShare qq = ShareSdk.share(mContext, QQShare.class, mPlatformActionListener);
qq.shareTextImagePath("", Const.APP_SITE_URL, mShareText, imgPath);
mCurrPlatform = QQ.NAME;
}
}
}
示例15: onComplete
import cn.sharesdk.tencent.qq.QQ; //导入依赖的package包/类
@Override
public void onComplete(Platform platform, int action, HashMap<String, Object> map) {
L.d(CategoryActy_v_1.class, "[onComplete]platform:" + platform.getName());
mShareComplete = true;
if (action == Platform.ACTION_SHARE) {
if (platform.getName().equals(SinaWeibo.NAME)) {
//Platform.isSSODisable()与是否跳客户端没关系
L.e(CategoryActy_v_1.class, "complete---------------SinaWeibo");
/* 启用了客户端分享,但是在打开客户端之前或者没有安装客户端而直接进行了微博分享都会回调本方法,
* 而我无法分辨这两种情况,没有相关的方法或返回参数。
* 但有一个办法:如果是打开客户端,则会先执行onPause(),再执行本方法。so...
*/
if(!mPaused) {
//不跳页,给来个Toast
Toast.makeText(mContext, R.string.d_m_edit_share_complete_sina_weibo, Toast.LENGTH_LONG).show();
mOkSinaWeibo = true;
resetState();
}
} else if (platform.getName().equals(QZone.NAME)) {
//正常跳页且正确回调,但统一放到onStart()
} else if (platform.getName().equals(WechatMoments.NAME)) {
//不跳页,且不会回调,但是会弹窗,因此会收到onPause()
L.e(CategoryActy_v_1.class, "complete---------------WechatMoments");
} else if (platform.getName().equals(Wechat.NAME)) {
//跳页,但不会正确回调,返回即视为发布成功
} else if (platform.getName().equals(QQ.NAME)) {
//会跳页,会正确回调,但是在跳页之前回调,这里等待跳页回来调用onStart()
}
}
}