private synchronized void savePic() {
    if (mSavePhotoTask != null) {
      return;
    }

    final String url = mPreviewImages.get(mContentHvp.getCurrentItem());
    File file;
    if (url.startsWith("file")) {
      file = new File(url.replace("file://", ""));
      if (file.exists()) {
        MQUtils.showSafe(
            MQPhotoPreviewActivity.this,
            getString(
                MQResUtils.getResStringID("mq_save_img_success_folder"),
                file.getParentFile().getAbsolutePath()));
        return;
      }
    }

    // 通过MD5加密url生成文件名,避免多次保存同一张图片
    file = new File(mSaveImgDir, MQUtils.stringToMD5(url) + ".png");
    if (file.exists()) {
      MQUtils.showSafe(
          this,
          getString(
              MQResUtils.getResStringID("mq_save_img_success_folder"),
              mSaveImgDir.getAbsolutePath()));
      return;
    }

    mSavePhotoTask = new MQSavePhotoTask(this, this, file);
    MQImage.downloadImage(
        this,
        url,
        new MQImageLoader.MQDownloadImageListener() {
          @Override
          public void onSuccess(String url, Bitmap bitmap) {
            mSavePhotoTask.setBitmapAndPerform(bitmap);
          }

          @Override
          public void onFailed(String url) {
            mSavePhotoTask = null;
            MQUtils.showSafe(
                MQPhotoPreviewActivity.this, MQResUtils.getResStringID("mq_save_img_failure"));
          }
        });
  }
    @Override
    public View instantiateItem(ViewGroup container, int position) {
      final MQImageView imageView = new MQImageView(container.getContext());
      container.addView(
          imageView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
      final MQBrowserPhotoViewAttacher photoViewAttacher =
          new MQBrowserPhotoViewAttacher(imageView);
      photoViewAttacher.setOnViewTapListener(MQPhotoPreviewActivity.this);

      imageView.setDrawableChangedCallback(
          new MQImageView.OnDrawableChangedCallback() {
            @Override
            public void onDrawableChanged(Drawable drawable) {
              if (drawable != null
                  && drawable.getIntrinsicHeight() > drawable.getIntrinsicWidth()
                  && drawable.getIntrinsicHeight()
                      > MQUtils.getScreenHeight(imageView.getContext())) {
                photoViewAttacher.setIsSetTopCrop(true);
                photoViewAttacher.setUpdateBaseMatrix();
              } else {
                photoViewAttacher.update();
              }
            }
          });

      MQImage.displayImage(
          MQPhotoPreviewActivity.this,
          imageView,
          mPreviewImages.get(position),
          MQResUtils.getResDrawableID("mq_ic_holder_dark"),
          MQResUtils.getResDrawableID("mq_ic_holder_dark"),
          MQUtils.getScreenWidth(MQPhotoPreviewActivity.this),
          MQUtils.getScreenHeight(MQPhotoPreviewActivity.this),
          null);

      return imageView;
    }