本文整理汇总了Java中cn.sharesdk.sina.weibo.SinaWeibo类的典型用法代码示例。如果您正苦于以下问题:Java SinaWeibo类的具体用法?Java SinaWeibo怎么用?Java SinaWeibo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SinaWeibo类属于cn.sharesdk.sina.weibo包,在下文中一共展示了SinaWeibo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResume
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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();
}
示例2: onError
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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)) {
//
}
}
}
示例3: onCancel
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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)) {
//
}
}
}
示例4: onResume
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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();
}
示例5: onCancel
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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)) {
//
}
}
}
示例6: showShare
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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);
}
示例7: getThirdPartyPlatfromInfo
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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;
}
}
示例8: updateUserInfoFromLocal
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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();
}
示例9: onClick
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的package包/类
@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;
}
}
示例10: onComplete
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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);
}
}
示例11: onClick
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的package包/类
@Override
public void onClick(View view) {
LogUtil.d("onClicked!!!!");
switch (view.getId()) {
case R.id.btn_login:
break;
case R.id.btn_singup:
break;
case R.id.signup_tip:
inflateSignUpView();
mSignUpView.setVisibility(View.VISIBLE);
mLoginView.setVisibility(View.GONE);
break;
case R.id.forget_password_tip:
break;
case R.id.signup_back:
backToLogin();
break;
case R.id.weibo_singup:
login(SinaWeibo.NAME);
break;
case R.id.wechat_singup:
login(Wechat.NAME);
break;
}
}
示例12: onClick
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_sms://短信分享
showShare(true, ShortMessage.NAME);
break;
case R.id.btn_sina://新浪分享
showShare(true, SinaWeibo.NAME);
break;
case R.id.btn_tencent://腾讯分享
showShare(true, TencentWeibo.NAME);
break;
case R.id.btn_wechatmoment://朋友圈分享
showShare(true, WechatMoments.NAME);
break;
default:
break;
}
}
示例13: onClick
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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;
}
}
}
示例14: onComplete
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的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()
}
}
}
示例15: shareTextImagePath
import cn.sharesdk.sina.weibo.SinaWeibo; //导入依赖的package包/类
/**
* 本地图片的图文位置分享
* @param text 不能超过140个汉字。
* @param imgPath 可选。本地图片路径(非私有目录),图片最大5M,仅支持JPEG、GIF、PNG格式。
* @param latitude 可选。有效范围:-90.0到+90.0,+表示北纬。
* @param longitude 可选。有效范围:-180.0到+180.0,+表示东经。
*/
public void shareTextImagePath(String text, String imgPath, float latitude, float longitude) {
checkText(text);
checkImage(imgPath);
cn.sharesdk.sina.weibo.SinaWeibo.ShareParams params = new cn.sharesdk.sina.weibo.SinaWeibo.ShareParams();
params.text = text;
params.imagePath = imgPath;
if (latitude != 0.0f) params.latitude = latitude;
if (longitude != 0.0f) params.longitude = longitude;
share(params);
}