Exemplo n.º 1
0
    private boolean uploadFeedImages(List<ImageItem> imageItems) {
      if (!DeviceUtils.isNetworkAvailable(mContext)) {
        return false;
      }
      final List<String> imageUrls = getImagePathList(imageItems);
      if (imageUrls.size() == 0) {
        return true;
      }

      uploadedImageItems = mImageUploader.upload(imageUrls);
      // 要上传的数量与传递成功的数量是否相同,即所有图片是否全部上传成功
      return imageItems.size() == uploadedImageItems.size();
    }
Exemplo n.º 2
0
  public void postNewFeed(final FeedItem feedItem) {
    if (!DeviceUtils.isNetworkAvailable(mContext)) {
      ToastMsg.showShortMsgByResName("umeng_comm_not_network");
      mActivityView.canNotPostFeed();
      return;
    }

    if (isTitleTooLong(feedItem)) {
      ToastMsg.showShortMsgByResName("umeng_comm_title_too_long");
      mActivityView.canNotPostFeed();
      return;
    }

    //        if ((!isTextValid(feedItem))&&(feedItem.getImages().size()==0)) {
    //            ToastMsg.showShortMsgByResName("umeng_comm_content_short_tips");
    //            mActivityView.canNotPostFeed();
    //            return;
    //        }

    CommUser loginUser = CommConfig.getConfig().loginedUser;
    if (!isForwardFeed
        && loginUser.subPermissions.contains(SubPermission.BULLETIN)) { // 当前用户有公告权限,此时需要确认是否发送为公告
      String msg = ResFinder.getString("umeng_comm_bulletin_tips");
      DialogInterface.OnClickListener confirmListener =
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              executeRealPostFeed(feedItem, true);
            }
          };
      DialogInterface.OnClickListener cancelListener =
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              executeRealPostFeed(feedItem, false);
            }
          };

      ConfirmDialog.showDialog(mContext, msg, confirmListener, cancelListener);
    } else { // 普通feed
      executeRealPostFeed(feedItem, false);
    }
  }
Exemplo n.º 3
0
  /**
   * 转发feed
   *
   * @param feedItem 发布的新feed
   * @param forwardFeedItem 被转发的feed
   */
  public void forwardFeed(FeedItem feedItem, final FeedItem forwardFeedItem) {
    if (!DeviceUtils.isNetworkAvailable(mContext)) {
      ToastMsg.showShortMsgByResName("umeng_comm_not_network");
      return;
    }

    mActivityView.startPostFeed();
    feedItem.type = 0; // 转发的Feed都不能mark为公告,避免数据同步的影响
    mCommunitySDK.forward(
        feedItem,
        new SimpleFetchListener<FeedItemResponse>() {

          @Override
          public void onComplete(FeedItemResponse response) {
            if (NetworkUtils.handleResponseComm(response)) {
              Log.w("", "forward error . code = " + response.errCode);
              return;
            }
            // 被转发的原始feed被删除
            if (response.errCode == ErrorCode.ORIGIN_FEED_DELETE_ERR_CODE
                || response.errCode == ErrorCode.ERR_CODE_FEED_UNAVAILABLE) {
              ToastMsg.showShortMsgByResName("umeng_comm_origin_feed_delete");
              return;
            }
            FeedItem feedItem = response.result;
            // 原始feed不是当前被转发的feed,也就是被转发的feed也是转发feed类型的情况
            if (!feedItem.sourceFeedId.equals(feedItem.sourceFeed.id)) {
              // 原始feed 转发数量加1
              BroadcastUtils.sendFeedUpdateBroadcast(mContext, feedItem.sourceFeed);
              // 被转发的feed数量加1
              BroadcastUtils.sendFeedUpdateBroadcast(mContext, forwardFeedItem);
            }
            postFeedResponse(response, feedItem);
          }
        });
  }