예제 #1
0
    @Override
    public void contentChanged(Content content) {
      Log.d(TAG, "Wrapper ContentChanged");
      if (content instanceof Picture && content != null && imageView.getDrawable() == null) {
        final Picture picture = (Picture) content;
        PictureIOSession io = picture.getIOSession();
        try {
          pictureId = io.getId();
          picPosition = mPicturesIdList.indexOf(pictureId);
          loadImage(io.getImageUrl(mImageFormat), this, pictureId.equals(mOriginId));

        } finally {
          io.close();
        }
      }
    }
예제 #2
0
  @Override
  public Object instantiateItem(View view, int position) {
    final View parentLayout = mInflater.inflate(R.layout.gallery_fullscreen_imageview, null);
    final ImageView imageView = (ImageView) parentLayout.findViewById(R.id.galleryFullscreenImage);
    final ProgressBar progress =
        (ProgressBar) parentLayout.findViewById(R.id.galleryFullscreenProgress);
    Log.d(TAG, "instantiateItem " + position);
    ViewPicWrapper wrapper = new ViewPicWrapper();
    wrapper.imageView = imageView;
    wrapper.progress = progress;
    wrapper.pictureId = mPicturesIdList.get(position);
    wrapper.progress.setVisibility(View.VISIBLE);
    wrapper.picPosition = position;

    Picture pic = ReadPicture.requestPicture(wrapper.pictureId, wrapper);

    PictureIOSession io = pic.getIOSession();
    try {
      Log.d(TAG, "Is valid " + io.isValid());
      if (io.getImageUrl(mImageFormat) != null) {

        loadImage(io.getImageUrl(mImageFormat), wrapper, pic.getId().equals(mOriginId));
      }

    } catch (Exception e) {
      e.printStackTrace();

    } finally {

      io.close();
    }

    imageView.setOnClickListener(mTapListener);
    parentLayout.setTag(wrapper);
    mActiveRequesters.add(wrapper);

    ((ViewPager) view).addView(parentLayout, 0);

    return wrapper;
  }