本文整理汇总了Java中cn.sharesdk.wechat.moments.WechatMoments类的典型用法代码示例。如果您正苦于以下问题:Java WechatMoments类的具体用法?Java WechatMoments怎么用?Java WechatMoments使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WechatMoments类属于cn.sharesdk.wechat.moments包,在下文中一共展示了WechatMoments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResume
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的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.wechat.moments.WechatMoments; //导入依赖的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.wechat.moments.WechatMoments; //导入依赖的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.wechat.moments.WechatMoments; //导入依赖的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.wechat.moments.WechatMoments; //导入依赖的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.wechat.moments.WechatMoments; //导入依赖的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: b
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的package包/类
public static void b(Context context, b bVar) {
ShareParams shareParams = new ShareParams();
shareParams.setShareType(4);
Bitmap bitmap = null;
if (!TextUtils.isEmpty(bVar.c())) {
bitmap = BitmapFactory.decodeFile(bVar.c());
}
if (bitmap != null) {
bitmap = Bitmap.createScaledBitmap(bitmap, 150, 150, true);
} else {
bitmap = Bitmap.createScaledBitmap(Bitmap.createBitmap(150, 150, Config.ARGB_8888),
150, 150, true);
}
shareParams.setImageData(bitmap);
shareParams.setTitle(bVar.a());
shareParams.setText(bVar.b());
shareParams.setUrl(bVar.e());
Platform platform = ShareSDK.getPlatform(WechatMoments.NAME);
if (platform.isClientValid()) {
platform.share(shareParams);
return;
}
Toast.makeText(context, o.a("未安装微信或者微信版本过低。", "There is no WeChat or the version is too " +
"low."), 0).show();
c.d(o.a("未安装微信或者微信版本过低。", "There is no WeChat or the version is too low."));
}
示例8: onComplete
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的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);
}
}
示例9: onClick
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的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;
}
}
示例10: onClick
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的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;
}
}
}
示例11: onComplete
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的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()
}
}
}
示例12: shareImage
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的package包/类
@Override
public void shareImage(String imgPath) {
checkImage(imgPath);
cn.sharesdk.wechat.moments.WechatMoments.ShareParams params = new cn.sharesdk.wechat.moments.WechatMoments.ShareParams();
params.shareType = WechatMoments.SHARE_IMAGE;
params.imagePath = imgPath;
share(params);
}
示例13: shareWebPageWithText
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的package包/类
/**标题字段将显示到内容中,而text字段只会出现在分享的对话框的图片右边,而最终不会显示到朋友圈,为保险起见,两者可以设置为一样**/
@Override
public void shareWebPageWithText(String title, String text, String imgPath, String pageUrl) {
checkTitle(title);
checkUrl(pageUrl);
cn.sharesdk.wechat.moments.WechatMoments.ShareParams params = new cn.sharesdk.wechat.moments.WechatMoments.ShareParams();
params.shareType = WechatMoments.SHARE_WEBPAGE;
params.title = title;
params.text = text;
params.imagePath = imgPath;
params.url = pageUrl;
share(params);
}
示例14: onError
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的package包/类
@Override
public void onError(Platform platform, int action, Throwable e) {
L.e(EditActy.class, "[onError]platform:" + platform.getName());
//parseAction(action);
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)) {
//
}
}
}
示例15: onComplete
import cn.sharesdk.wechat.moments.WechatMoments; //导入依赖的package包/类
@Override
public void onComplete(Platform platform, int action, HashMap<String, Object> map) {
L.d(EditActy.class, "[onComplete]platform:" + platform.getName());
//parseAction(action);
mShareComplete = true;
if (action == Platform.ACTION_SHARE) {
if (platform.getName().equals(SinaWeibo.NAME)) {
//Platform.isSSODisable()与是否跳客户端没关系
L.e(EditActy.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.setVisibility(View.VISIBLE);
resetState();
}
} else if (platform.getName().equals(QZone.NAME)) {
//正常跳页且正确回调,但统一放到onStart()
//mOkQzone.setVisibility(View.VISIBLE);
} else if (platform.getName().equals(WechatMoments.NAME)) {
//不跳页,且不会回调,但是会弹窗,因此会收到onPause()
L.e(EditActy.class, "complete---------------WechatMoments");
//mOkWechatMoments.setVisibility(View.VISIBLE);
} else if (platform.getName().equals(Wechat.NAME)) {
//跳页,但不会正确回调,返回即视为发布成功
//mOkWechat.setVisibility(View.VISIBLE);
} else if (platform.getName().equals(QQ.NAME)) {
//会跳页,会正确回调,但是在跳页之前回调,这里等待跳页回来调用onStart()
//mOkQQ.setVisibility(View.VISIBLE);
}
}
}