private void onUp(boolean followedByLongPress) {
   if (followedByLongPress) {
     // Avoid showing press-up animations for long-press.
     mAlbumView.setPressedIndex(-1);
   } else {
     mAlbumView.setPressedUp();
   }
 }
  private void onSingleTapUp(int slotIndex) {
    if (!mIsActive) return;

    if (mSelectionManager.inSelectionMode()) {
      MediaItem item = mAlbumDataAdapter.get(slotIndex);
      if (item == null) return; // Item not ready yet, ignore the click
      mSelectionManager.toggle(item.getPath());
      mSlotView.invalidate();
    } else {
      // Render transition in pressed state
      mAlbumView.setPressedIndex(slotIndex);
      mAlbumView.setPressedUp();
      mHandler.sendMessageDelayed(
          mHandler.obtainMessage(MSG_PICK_PHOTO, slotIndex, 0), FadeTexture.DURATION);
    }
  }
 private void initializeData(Bundle data) {
   mMediaSetPath = Path.fromString(data.getString(KEY_MEDIA_PATH));
   mParentMediaSetString = data.getString(KEY_PARENT_MEDIA_PATH);
   mMediaSet = mActivity.getDataManager().getMediaSet(mMediaSetPath);
   if (mMediaSet == null) {
     Utils.fail("MediaSet is null. Path = %s", mMediaSetPath);
   }
   mSelectionManager.setSourceMediaSet(mMediaSet);
   mAlbumDataAdapter = new AlbumDataLoader(mActivity, mMediaSet);
   mAlbumDataAdapter.setLoadingListener(new MyLoadingListener());
   mAlbumView.setModel(mAlbumDataAdapter);
 }
  @Override
  protected void onPause() {
    super.onPause();
    mIsActive = false;

    if (mSelectionManager.inSelectionMode()) {
      mSelectionManager.leaveSelectionMode();
    }
    mAlbumView.setSlotFilter(null);
    mActionModeHandler.pause();
    mAlbumDataAdapter.pause();
    mAlbumView.pause();
    DetailsHelper.pause();
    if (!mGetContent) {
      mActivity.getGalleryActionBar().disableAlbumModeMenu(true);
    }

    if (mSyncTask != null) {
      mSyncTask.cancel();
      mSyncTask = null;
      clearLoadingBit(BIT_LOADING_SYNC);
    }
  }
  @Override
  protected void onResume() {
    super.onResume();
    mIsActive = true;

    mResumeEffect = mActivity.getTransitionStore().get(KEY_RESUME_ANIMATION);
    if (mResumeEffect != null) {
      mAlbumView.setSlotFilter(mResumeEffect);
      mResumeEffect.setPositionProvider(mPositionProvider);
      mResumeEffect.start();
    }

    setContentPane(mRootPane);

    boolean enableHomeButton =
        (mActivity.getStateManager().getStateCount() > 1) | mParentMediaSetString != null;
    GalleryActionBar actionBar = mActivity.getGalleryActionBar();
    actionBar.setDisplayOptions(enableHomeButton, false);
    if (!mGetContent) {
      actionBar.enableAlbumModeMenu(GalleryActionBar.ALBUM_GRID_MODE_SELECTED, this);
    }

    // Set the reload bit here to prevent it exit this page in clearLoadingBit().
    setLoadingBit(BIT_LOADING_RELOAD);
    mLoadingFailed = false;
    mAlbumDataAdapter.resume();

    mAlbumView.resume();
    mAlbumView.setPressedIndex(-1);
    mActionModeHandler.resume();
    if (!mInitialSynced) {
      setLoadingBit(BIT_LOADING_SYNC);
      mSyncTask = mMediaSet.requestSync(this);
    }
    mInCameraAndWantQuitOnPause = mInCameraApp;
  }
        @Override
        protected void render(GLCanvas canvas) {
          canvas.save(GLCanvas.SAVE_FLAG_MATRIX);
          canvas.multiplyMatrix(mMatrix, 0);
          super.render(canvas);

          if (mResumeEffect != null) {
            boolean more = mResumeEffect.draw(canvas);
            if (!more) {
              mResumeEffect = null;
              mAlbumView.setSlotFilter(null);
            }
            // We want to render one more time even when no more effect
            // required. So that the animated thumbnails could be draw
            // with declarations in super.render().
            invalidate();
          }
          canvas.restore();
        }
        @Override
        protected void onLayout(boolean changed, int left, int top, int right, int bottom) {

          int slotViewTop = mActivity.getGalleryActionBar().getHeight() + mConfig.paddingTop;
          int slotViewBottom = bottom - top - mConfig.paddingBottom;
          int slotViewRight = right - left - mConfig.paddingRight;

          if (mShowDetails) {
            mDetailsHelper.layout(left, slotViewTop, right, bottom);
          } else {
            mAlbumView.setHighlightItemPath(null);
          }

          // Set the mSlotView as a reference point to the open animation
          mOpenCenter.setReferencePosition(mConfig.paddingLeft, slotViewTop);
          mSlotView.layout(mConfig.paddingLeft, slotViewTop, slotViewRight, slotViewBottom);
          GalleryUtils.setViewPointMatrix(
              mMatrix, (right - left) / 2, (bottom - top) / 2, -mUserDistance);
        }
 private void hideDetails() {
   mShowDetails = false;
   mDetailsHelper.hide();
   mAlbumView.setHighlightItemPath(null);
   mSlotView.invalidate();
 }
 private void onDown(int index) {
   mAlbumView.setPressedIndex(index);
 }