diff options
author | Angus Kong <shkong@google.com> | 2013-10-08 20:58:33 -0700 |
---|---|---|
committer | Angus Kong <shkong@google.com> | 2013-10-09 08:39:12 -0700 |
commit | da568b23002859e9672271bb135808303c2e07cb (patch) | |
tree | 522a91b0dd0253f05068e8daec44118105ea236d /src/com | |
parent | f5aa51e6e8da349c8f1a604b431af243cc0802c0 (diff) | |
download | android_packages_apps_Snap-da568b23002859e9672271bb135808303c2e07cb.tar.gz android_packages_apps_Snap-da568b23002859e9672271bb135808303c2e07cb.tar.bz2 android_packages_apps_Snap-da568b23002859e9672271bb135808303c2e07cb.zip |
Make the transition animation identical.
The animation of transition between camera preview and filmstrip should be a
special case to prevent jank.
bug:11011577
Change-Id: If611599203e845d098cd6e4acb56d5631d085ffe
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/ui/FilmStripView.java | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java index 21f2fc864..444090115 100644 --- a/src/com/android/camera/ui/FilmStripView.java +++ b/src/com/android/camera/ui/FilmStripView.java @@ -1191,21 +1191,36 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { } // Right items. for (int itemID = mCurrentItem + 1; itemID < BUFFER_SIZE; itemID++) { - ViewItem curr = mViewItem[itemID]; + final ViewItem curr = mViewItem[itemID]; if (curr == null) { break; } // First, layout relatively to the previous one. - ViewItem prev = mViewItem[itemID - 1]; - int currLeft = + final ViewItem prev = mViewItem[itemID - 1]; + final int currLeft = prev.getLeftPosition() + prev.getView().getMeasuredWidth() + mViewGap; curr.setLeftPosition(currLeft); } + // Special case for the one immediately on the right of the camera + // preview. + boolean immediateRight = + (mViewItem[mCurrentItem].getId() == 1 && + mDataAdapter.getImageData(0).getViewType() == ImageData.VIEW_TYPE_STICKY); + // Layout the current ViewItem first. - if (scaleFraction == 1f) { + if (immediateRight) { + // Just do a simple layout without any special translation or + // fading. The implementation in Gallery does not push the first + // photo to the bottom of the camera preview. Simply place the + // photo on the right of the preview. + final ViewItem currItem = mViewItem[mCurrentItem]; + currItem.layoutIn(mDrawArea, mCenterX, mScale); + currItem.setTranslationX(0f, mScale); + currItem.getView().setAlpha(1f); + } else if (scaleFraction == 1f) { final ViewItem currItem = mViewItem[mCurrentItem]; final int currCenterX = currItem.getCenterX(); if (mCenterX < currCenterX) { @@ -1254,13 +1269,19 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { // Items on the right for (int itemID = mCurrentItem + 1; itemID < BUFFER_SIZE; itemID++) { - ViewItem curr = mViewItem[itemID]; + final ViewItem curr = mViewItem[itemID]; if (curr == null) { break; } curr.layoutIn(mDrawArea, mCenterX, mScale); - View currView = curr.getView(); + if (curr.getId() == 1 && getCurrentViewType() == ImageData.VIEW_TYPE_STICKY) { + // Special case for the one next to the camera preview. + curr.getView().setAlpha(1f); + continue; + } + + final View currView = curr.getView(); if (scaleFraction == 1) { // It's in full-screen mode. fadeAndScaleRightViewItem(itemID); |