@Result(FlickrApi.LOAD_IMAGES_EVENT)
  private void onPhotosLoaded(List<Photo> photos, boolean hasMore) {
    mPhotoCount = photos.size();
    mGridAdapter.setPhotos(photos, hasMore);
    mPagerAdapter.setPhotos(photos);
    mGridAdapter.onNextItemsLoaded();

    // Ensure listener called for 0 position
    mPagerListener.onPageSelected(mViews.pager.getCurrentItem());

    // Restoring saved state
    if (mPagerPhotoPosition != -1) {
      if (mPagerPhotoPosition < mPhotoCount) {
        mPagerAdapter.setActivated(true);
        mAnimator.enter(mPagerPhotoPosition, false);
      }
      mPagerPhotoPosition = -1;
    }

    if (mGridPosition != -1) {
      if (mGridPosition < mPhotoCount) {
        ((GridLayoutManager) mViews.grid.getLayoutManager())
            .scrollToPositionWithOffset(mGridPosition, mGridPositionFromTop);
      }
      mGridPosition = -1;
      mGridPositionFromTop = 0;
    }
  }
  @Override
  public void onPositionUpdate(float state, boolean isLeaving) {
    mViews.pagerBackground.setVisibility(state == 0f ? View.INVISIBLE : View.VISIBLE);
    mViews.pagerBackground.getBackground().setAlpha((int) (255 * state));

    mViews.toolbar.setVisibility(state == 1f ? View.INVISIBLE : View.VISIBLE);
    mViews.toolbar.setAlpha((float) Math.sqrt(1d - state)); // Slow down toolbar animation

    mViews.pagerToolbar.setVisibility(state == 0f ? View.INVISIBLE : View.VISIBLE);
    mViews.pagerToolbar.setAlpha(state);

    mViews.pagerTitle.setVisibility(state == 1f ? View.VISIBLE : View.INVISIBLE);

    if (isLeaving && state == 0f) mPagerAdapter.setActivated(false);
  }
 @Override
 public void onPhotoClick(Photo photo, int position, ImageView image) {
   mPagerAdapter.setActivated(true);
   mAnimator.enter(position, true);
 }