Beispiel #1
1
 public void move(final View photo, float dx, float dy, boolean drop) {
   if (photo != null) {
     final float x = photo.getX() + dx;
     final float y = photo.getY() + dy;
     photo.setX(x);
     photo.setY(y);
     Log.d(TAG, "[" + photo.getX() + ", " + photo.getY() + "] + (" + dx + "," + dy + ")");
     if (drop && photoOffTable(photo)) {
       fadeAway(photo, true);
     }
   }
 }
Beispiel #2
0
  /** On deck is to the left or right of the selected photo. */
  private void placeOnDeck(final View photo, final int slot) {
    if (slot < mOnDeck.length) {
      if (mOnDeck[slot] != null && mOnDeck[slot] != photo) {
        fadeAway(mOnDeck[slot], false);
      }
      mOnDeck[slot] = photo;
      float photoWidth = photo.getWidth();
      float photoHeight = photo.getHeight();
      float scale = Math.min(getHeight() / photoHeight, getWidth() / photoWidth);

      float x = (getWidth() - photoWidth) / 2f;
      float y = (getHeight() - photoHeight) / 2f;

      float offset = (((float) mWidth + scale * (photoWidth - 2f * mInset)) / 2f);
      x += (slot == NEXT ? 1f : -1f) * offset;

      photo
          .animate()
          .withLayer()
          .rotation(0f)
          .rotationY(0f)
          .scaleX(scale)
          .scaleY(scale)
          .x(x)
          .y(y)
          .setDuration(mPickUpDuration)
          .setInterpolator(new DecelerateInterpolator(2f));
    }
  }
Beispiel #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;
     }
   }
 }