Esempio n. 1
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. 2
0
  /**
   * 3.分享网页
   *
   * @param webUrl
   * @param title
   * @param description
   * @param bm
   * @param sharePlatform
   * @param object
   */
  public void shareWebPage(CommonShareWebpage webPageBean, Object object) {
    CommonSharePlatform sharePlatform = webPageBean.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.shareWebPageToWeixin(
            webPageBean.getWebpageUrl(),
            webPageBean.getTitle(),
            webPageBean.getDescription(),
            webPageBean.getBm(),
            sharePlatform,
            (IWXAPI) object);
      } else if (sharePlatform == CommonSharePlatform.QQ_Friend
          || sharePlatform == CommonSharePlatform.QQ_Zone
          || sharePlatform == CommonSharePlatform.QQ_Weibo) {
        mQQ.sharePicText(
            webPageBean.getTitle(),
            webPageBean.getDescription(),
            webPageBean.getAppName(),
            new String[] {webPageBean.getImgUrl()},
            webPageBean.getWebpageUrl(),
            sharePlatform,
            (Tencent) object,
            webPageBean.getUiListener());
      }

    } catch (ClassCastException e) {
      throw new IllegalArgumentException(
          "object必须传分享目标对象,eg:微信(IWXAPI),QQ(Tencent),微博(IWeiboShareAPI)");
    }
  }