private void getCommentCounts(final ArrayList<Picture> pictures) {

    StringBuilder sb = new StringBuilder();
    for (Picture joke : pictures) {
      sb.append("comment-" + joke.getComment_ID() + ",");
    }

    RequestHandle requestHandle =
        HttpClientProxy.get(
            mActivity,
            CommentNumber.getCommentCountsURL(sb.toString()),
            new Handler4CommentNumber(
                new OnHttpResponseCallBackImpl<ArrayList<CommentNumber>>() {
                  @Override
                  public void onSuccess(int statusCode, ArrayList<CommentNumber> commentNumbers) {
                    mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
                    mLoadFinisCallBack.loadFinish(null);

                    for (int i = 0; i < pictures.size(); i++) {
                      pictures.get(i).setComment_counts(commentNumbers.get(i).getComments() + "");
                    }
                    if (page == 1) {
                      PictureAdapter.this.pictures.clear();
                      PictureCache.getInstance(mActivity).clearAllCache();
                    }
                    PictureAdapter.this.pictures.addAll(pictures);
                    notifyDataSetChanged();
                    // 加载完毕后缓存
                    PictureCache.getInstance(mActivity)
                        .addResultCache(JSONParser.toString(pictures), page);
                  }

                  @Override
                  public void onFailure(int statusCode, Throwable throwable) {
                    mLoadFinisCallBack.loadFinish(null);
                    mLoadResultCallBack.onError(
                        LoadResultCallBack.ERROR_NET, throwable.getMessage());
                  }
                }));

    mRequestHandles.add(requestHandle);
  }
  private void loadData() {

    RequestHandle requestHandle =
        HttpClientProxy.get(
            mActivity,
            Picture.getRequestUrl(mType, page),
            new Handler4Picture(
                new OnHttpResponseCallBackImpl<ArrayList<Picture>>() {
                  @Override
                  public void onSuccess(int statusCode, ArrayList<Picture> pictures) {
                    getCommentCounts(pictures);
                  }

                  @Override
                  public void onFailure(int statusCode, Throwable throwable) {
                    mLoadResultCallBack.onError(
                        LoadResultCallBack.ERROR_NET, throwable.getMessage());
                    mLoadFinisCallBack.loadFinish(null);
                  }
                }));
    mRequestHandles.add(requestHandle);
  }
  @Override
  public void onBindViewHolder(final PictureViewHolder holder, final int position) {

    final Picture picture = pictures.get(position);

    String picUrl = picture.getPics()[0];

    if (picUrl.endsWith(".gif")) {
      holder.img_gif.setVisibility(View.VISIBLE);
      // 非WIFI网络情况下,GIF图只加载缩略图,详情页才加载真实图片
      if (!isWifiConnected) {
        picUrl =
            picUrl.replace("mw600", "small").replace("mw1200", "small").replace("large", "small");
      }
    } else {
      holder.img_gif.setVisibility(View.GONE);
    }

    holder.progress.setProgress(0);
    holder.progress.setVisibility(View.VISIBLE);

    ImageLoadProxy.displayImageList(
        picUrl,
        holder.img,
        R.drawable.ic_loading_large,
        new SimpleImageLoadingListener() {
          @Override
          public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            super.onLoadingComplete(imageUri, view, loadedImage);
            holder.progress.setVisibility(View.GONE);
          }
        },
        new ImageLoadingProgressListener() {
          @Override
          public void onProgressUpdate(String imageUri, View view, int current, int total) {
            holder.progress.setProgress((int) (current * 100f / total));
          }
        });

    if (TextUtil.isNull(picture.getText_content().trim())) {
      holder.tv_content.setVisibility(View.GONE);
    } else {
      holder.tv_content.setVisibility(View.VISIBLE);
      holder.tv_content.setText(picture.getText_content().trim());
    }

    holder.img.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(mActivity, ImageDetailActivity.class);

            intent.putExtra(BaseActivity.DATA_IMAGE_AUTHOR, picture.getComment_author());
            intent.putExtra(BaseActivity.DATA_IMAGE_URL, picture.getPics());
            intent.putExtra(BaseActivity.DATA_IMAGE_ID, picture.getComment_ID());
            intent.putExtra(BaseActivity.DATA_THREAD_KEY, "comment-" + picture.getComment_ID());

            if (picture.getPics()[0].endsWith(".gif")) {
              intent.putExtra(BaseActivity.DATA_IS_NEED_WEBVIEW, true);
            }

            mActivity.startActivity(intent);
          }
        });

    holder.tv_author.setText(picture.getComment_author());
    holder.tv_time.setText(
        String2TimeUtil.dateString2GoodExperienceFormat(picture.getComment_date()));
    holder.tv_like.setText(picture.getVote_positive());
    holder.tv_comment_count.setText(picture.getComment_counts());

    // 用于恢复默认的文字
    holder.tv_like.setTypeface(Typeface.DEFAULT);
    holder.tv_like.setTextColor(
        mActivity.getResources().getColor(R.color.secondary_text_default_material_light));
    holder.tv_support_des.setTextColor(
        mActivity.getResources().getColor(R.color.secondary_text_default_material_light));

    holder.tv_unlike.setText(picture.getVote_negative());
    holder.tv_unlike.setTypeface(Typeface.DEFAULT);
    holder.tv_unlike.setTextColor(
        mActivity.getResources().getColor(R.color.secondary_text_default_material_light));
    holder.tv_un_support_des.setTextColor(
        mActivity.getResources().getColor(R.color.secondary_text_default_material_light));

    holder.img_share.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            new MaterialDialog.Builder(mActivity)
                .items(R.array.picture_dialog)
                .backgroundColor(mActivity.getResources().getColor(JDApplication.COLOR_OF_DIALOG))
                .contentColor(JDApplication.COLOR_OF_DIALOG_CONTENT)
                .itemsCallback(
                    new MaterialDialog.ListCallback() {
                      @Override
                      public void onSelection(
                          MaterialDialog dialog, View view, int which, CharSequence text) {

                        switch (which) {
                            // 分享
                          case 0:
                            ShareUtil.sharePicture(mActivity, picture.getPics()[0]);
                            break;
                            // 保存
                          case 1:
                            FileUtil.savePicture(
                                mActivity, picture.getPics()[0], mSaveFileCallBack);
                            break;
                        }
                      }
                    })
                .show();
          }
        });

    holder.ll_comment.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(mActivity, CommentListActivity.class);
            intent.putExtra(BaseActivity.DATA_THREAD_KEY, "comment-" + picture.getComment_ID());
            mActivity.startActivity(intent);
          }
        });

    setAnimation(holder.card, position);
  }