当前位置: 首页>>代码示例>>Java>>正文


Java Wechat类代码示例

本文整理汇总了Java中cn.sharesdk.wechat.friends.Wechat的典型用法代码示例。如果您正苦于以下问题:Java Wechat类的具体用法?Java Wechat怎么用?Java Wechat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Wechat类属于cn.sharesdk.wechat.friends包,在下文中一共展示了Wechat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onResume

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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();
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:19,代码来源:ShareLinkViewHolder.java

示例2: onError

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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)) {
			//
		}
	}
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:27,代码来源:ShareLinkViewHolder.java

示例3: onCancel

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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)) {
			//
		}
	}
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:19,代码来源:ShareLinkViewHolder.java

示例4: onResume

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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();
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:18,代码来源:EditActy.java

示例5: onCancel

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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)) {
			//
		}
	}
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:20,代码来源:EditActy.java

示例6: getThirdPartyPlatfromInfo

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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;
		}
	}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:30,代码来源:LoginAty.java

示例7: AuthAdapter

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的package包/类
public AuthAdapter(Context context) {
	this.context = context;
	// 获取平台列表
	Platform[] tmp = ShareSDK.getPlatformList();
	platforms = new ArrayList<Platform>();
	if (tmp == null) {
		return;
	}

	for (Platform p : tmp) {
		String name = p.getName();
		if ((p instanceof CustomPlatform)
				|| !ShareCore.canAuthorize(p.getContext(), name)) {
			continue;
		}
		if (p.getName().equals(Wechat.NAME)){
			continue;
		}
		platforms.add(p);
	}
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:22,代码来源:AuthPageAty.java

示例8: updateUserInfoFromLocal

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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();
}
 
开发者ID:6ag,项目名称:LiuAGeAndroid,代码行数:21,代码来源:UserBean.java

示例9: a

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的package包/类
public static void a(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(Wechat.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."));
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:a.java

示例10: onClick

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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;
        }
    }
 
开发者ID:BigAppOS,项目名称:BigApp_WordPress_Android,代码行数:38,代码来源:FragmentLogin.java

示例11: onComplete

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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);
	}

}
 
开发者ID:ChenAt,项目名称:Translation,代码行数:19,代码来源:QuestionDetailActivity.java

示例12: onClick

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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;
    }
}
 
开发者ID:elffy,项目名称:AbroadEasy,代码行数:27,代码来源:UserInfoFragment.java

示例13: onClick

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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;
		}
	}
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:36,代码来源:ShareLinkViewHolder.java

示例14: onComplete

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的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()
		}
	}
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:32,代码来源:ShareLinkViewHolder.java

示例15: shareImage

import cn.sharesdk.wechat.friends.Wechat; //导入依赖的package包/类
/**并不能带标题和文本,只能在分享链接的时候或分享给好友的时候**/
public void shareImage(String imgPath) {
	checkImage(imgPath);
	cn.sharesdk.wechat.friends.Wechat.ShareParams params = new cn.sharesdk.wechat.friends.Wechat.ShareParams();
	params.shareType = Wechat.SHARE_IMAGE;
	params.imagePath = imgPath;
	share(params);
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:9,代码来源:ShareSdk.java


注:本文中的cn.sharesdk.wechat.friends.Wechat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。