Esempio n. 1
0
 /**
  * 分享文本至QQ
  *
  * @param content
  * @param platform
  * @param tencent
  */
 public void shareTextToTencent(
     CommonShareTextOnly shareBaseBean, final Tencent tencent, IUiListener uiListener) {
   Bundle mParams = new Bundle();
   CommonSharePlatform platform = shareBaseBean.getSharePlatform();
   mParams.putString(QQShare.SHARE_TO_QQ_SUMMARY, shareBaseBean.getContent());
   if (platform == CommonSharePlatform.QQ_Friend) {
     mQQ.shareToQQ(mParams, tencent, uiListener);
   } else if (platform == CommonSharePlatform.QQ_Zone) {
     mQQ.shareToQQZone(mParams, tencent, uiListener);
   } else if (platform == CommonSharePlatform.QQ_Weibo) {
     mQQ.shareToQQWeibo(mParams, tencent, uiListener);
   }
 }
Esempio n. 2
0
  /**
   * 2,分享图片
   *
   * @param imgUrl 图片Url
   * @param imgDescription 图片描述
   * @param sharePlatform 分享的平台:微信好友,微信朋友圈,QQ等
   * @param object 目标分享平台的对象,eg:IWXAPI
   */
  public void sharePicOnly(CommonShareBaseBean sharePicBean, Object object) {

    CommonSharePlatform sharePlatform = sharePicBean.getSharePlatform();
    boolean isInstalled = CommonShareUtils.isSupport(mContext, sharePlatform, object);
    try {
      if (sharePlatform == CommonSharePlatform.WeixinFriend
          || sharePlatform == CommonSharePlatform.WeixinFriendCircle) {
        if (!isInstalled) {
          Toast.makeText(
                  mContext,
                  mContext.getResources().getString(R.string.share_not_supported),
                  Toast.LENGTH_SHORT)
              .show();
          return;
        }
        // 分享至微信好友
        mWeixin.sharePicToWeixin(
            sharePicBean.getImgUrl(),
            sharePicBean.getDescription(),
            sharePlatform,
            (IWXAPI) object);
      } else if (sharePlatform == CommonSharePlatform.QQ_Weibo
          || sharePlatform == CommonSharePlatform.QQ_Zone
          || sharePlatform == CommonSharePlatform.QQ_Friend) {
        mQQ.sharePicJust(
            sharePicBean.getAppName(),
            sharePicBean.getImgUrl(),
            (Tencent) object,
            sharePicBean.getUiListener());
      }
    } catch (ClassCastException e) {
      throw new IllegalArgumentException(
          "object必须传分享目标对象,eg:微信(IWXAPI),QQ(Tencent),微博(IWeiboShareAPI)");
    }
  }
Esempio n. 3
0
 /** 分享应用至QQ好友 应用分享后,发送方和接收方在聊天窗口中点击消息气泡即可进入应用的详情页。 */
 private void shareAppToQQ(
     CommonShareBaseBean shareBaseBean, Tencent tencent, IUiListener uiListener) {
   mQQ.shareApp(
       shareBaseBean.getTitle(),
       shareBaseBean.getDescription(),
       shareBaseBean.getAppName(),
       shareBaseBean.getImgUrl(),
       shareBaseBean.getTargetUrl(),
       shareBaseBean.getSharePlatform(),
       tencent,
       uiListener);
 }
Esempio n. 4
0
 /** 分享图文信息至QQ好友 */
 private void sharePicTextToTencent(
     CommonSharePicText sharePicText, Tencent tencent, IUiListener uiListener) {
   mQQ.sharePicText(
       sharePicText.getTitle(),
       sharePicText.getDescription(),
       sharePicText.getAppName(),
       sharePicText.getImgUrls(),
       sharePicText.getTargetUrl(),
       sharePicText.getSharePlatform(),
       tencent,
       uiListener);
 }
Esempio n. 5
0
 /** 分享音乐至QQ好友 音乐分享后,发送方和接收方在聊天窗口中点击消息气泡即可开始播放音乐。 */
 private void shareMusicToQQ(
     CommonShareMusic shareMusic, Tencent tencent, IUiListener uiListener) {
   mQQ.shareMusic(
       shareMusic.getTitle(),
       shareMusic.getDescription(),
       shareMusic.getAppName(),
       shareMusic.getImgUrl(),
       shareMusic.getTargetUrl(),
       shareMusic.getMusicUrl(),
       shareMusic.getSharePlatform(),
       tencent,
       uiListener);
 }