Exemplo n.º 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();
  }
Exemplo n.º 2
0
 public void selectPrevious() {
   if (mStoryModeEnabled) {
     log("selectPrevious");
     if (hasSelection() && mOnDeck[PREV] != null) {
       placeOnDeck(mSelection, NEXT);
       mSelection = mOnDeck[PREV];
       mOnDeck[PREV] = null;
       promoteSelection();
     }
   } else {
     clearSelection();
   }
 }
Exemplo n.º 3
0
 public void selectNext() {
   if (mStoryModeEnabled) {
     log("selectNext");
     if (hasSelection() && mOnDeck[NEXT] != null) {
       placeOnDeck(mSelection, PREV);
       mSelection = mOnDeck[NEXT];
       mOnDeck[NEXT] = null;
       promoteSelection();
     }
   } else {
     clearSelection();
   }
 }