Example #1
1
  @Override
  public void onLayout(boolean changed, int left, int top, int right, int bottom) {
    super.onLayout(changed, left, top, right, bottom);
    log("onLayout (%d, %d, %d, %d)", left, top, right, bottom);

    mHeight = bottom - top;
    mWidth = right - left;

    mLongSide = (int) (mImageRatio * Math.max(mWidth, mHeight));
    mShortSide = (int) (mImageRatio * Math.min(mWidth, mHeight));

    boolean isLandscape = mWidth > mHeight;
    if (mIsLandscape != isLandscape) {
      for (View photo : mOnTable) {
        if (photo != getSelection()) {
          dropOnTable(photo);
        }
      }
      if (hasSelection()) {
        pickUp(getSelection());
        for (int slot = 0; slot < mOnDeck.length; slot++) {
          if (mOnDeck[slot] != null) {
            placeOnDeck(mOnDeck[slot], slot);
          }
        }
      }
      mIsLandscape = isLandscape;
    }
    start();
  }
Example #2
0
  /** Wind up off screen, so we can animate in. */
  private void throwOnTable(final View photo) {
    mOnTable.offer(photo);
    log("start offscreen");
    photo.setRotation(mThrowRotation);
    photo.setX(-mLongSide);
    photo.setY(-mLongSide);

    dropOnTable(photo, mThrowInterpolator);
  }
Example #3
0
 public void clearSelection() {
   if (hasSelection()) {
     dropOnTable(mSelection);
     mPhotoSource.donePaging(getBitmap(mSelection));
     if (mStoryModeEnabled) {
       fadeInBackground(mSelection);
     }
     mSelection = null;
   }
   for (int slot = 0; slot < mOnDeck.length; slot++) {
     if (mOnDeck[slot] != null) {
       fadeAway(mOnDeck[slot], false);
       mOnDeck[slot] = null;
     }
     if (mLoadOnDeckTasks[slot] != null
         && mLoadOnDeckTasks[slot].getStatus() != AsyncTask.Status.FINISHED) {
       mLoadOnDeckTasks[slot].cancel(true);
       mLoadOnDeckTasks[slot] = null;
     }
   }
 }
Example #4
0
 /** Animate to a random place and orientation, down on the table (visually small). */
 public void dropOnTable(final View photo) {
   dropOnTable(photo, mDropInterpolator);
 }