summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/FilmStripView.java
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2013-10-12 18:52:33 -0700
committerAngus Kong <shkong@google.com>2013-10-12 18:52:33 -0700
commitf1582c9c075e9cd5790b4bbe1101c94a45ac15d2 (patch)
tree48ab184f79aea2e0d6fc01f3d19b18ebde2980d1 /src/com/android/camera/ui/FilmStripView.java
parenta500241084f9e267e5f154b55e7a76a09623e6d8 (diff)
downloadandroid_packages_apps_Snap-f1582c9c075e9cd5790b4bbe1101c94a45ac15d2.tar.gz
android_packages_apps_Snap-f1582c9c075e9cd5790b4bbe1101c94a45ac15d2.tar.bz2
android_packages_apps_Snap-f1582c9c075e9cd5790b4bbe1101c94a45ac15d2.zip
Adjust the position after layout change.
bug:10993660 Change-Id: Ia07b8238a09e761a02fe11577b738776ab965b30
Diffstat (limited to 'src/com/android/camera/ui/FilmStripView.java')
-rw-r--r--src/com/android/camera/ui/FilmStripView.java40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java
index f41f08114..19ff4d2ad 100644
--- a/src/com/android/camera/ui/FilmStripView.java
+++ b/src/com/android/camera/ui/FilmStripView.java
@@ -89,13 +89,6 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
private PanoramaViewHelper mPanoramaViewHelper;
private long mLastItemId = -1;
- // This is used to resolve the misalignment problem when the device
- // orientation is changed. If the current item is in fullscreen, it might
- // be shifted because mCenterX is not adjusted with the orientation.
- // Set this to true when onSizeChanged is called to make sure we adjust
- // mCenterX accordingly.
- private boolean mConfigurationChanged;
-
// This is true if and only if the user is scrolling,
private boolean mIsUserScrolling;
private int mDataIdOnUserScrolling;
@@ -564,8 +557,8 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
int l = mView.getLeft();
int t = mView.getTop();
mViewArea.set(l, t,
- l + mView.getWidth() * scale,
- t + mView.getHeight() * scale);
+ l + mView.getMeasuredWidth() * scale,
+ t + mView.getMeasuredHeight() * scale);
}
/** Returns true if the point is in the view. */
@@ -627,6 +620,17 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
mView.setTranslationX(0f);
mView.setTranslationY(0f);
}
+
+ @Override
+ public String toString() {
+ return "DataID = " + mDataId + "\n\t left = " + mLeftPosition
+ + "\n\t viewArea = " + mViewArea
+ + "\n\t centerX = " + getCenterX()
+ + "\n\t view MeasuredSize = "
+ + mView.getMeasuredWidth() + ',' + mView.getMeasuredHeight()
+ + "\n\t view Size = " + mView.getWidth() + ',' + mView.getHeight()
+ + "\n\t view scale = " + mView.getScaleX();
+ }
}
public FilmStripView(Context context) {
@@ -1179,17 +1183,18 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
currView.setVisibility(VISIBLE);
}
- private void layoutViewItems() {
+ private void layoutViewItems(boolean layoutChanged) {
if (mViewItem[mCurrentItem] == null ||
mDrawArea.width() == 0 ||
mDrawArea.height() == 0) {
return;
}
- if (mConfigurationChanged) {
+ // If the layout changed, we need to adjust the current position so
+ // that if an item is centered before the change, it's still centered.
+ if (layoutChanged) {
mViewItem[mCurrentItem].setLeftPosition(
mCenterX - mViewItem[mCurrentItem].getView().getMeasuredWidth() / 2);
- mConfigurationChanged = false;
}
if (mController.isZoomStarted()) {
@@ -1340,7 +1345,8 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
@Override
public void onDraw(Canvas c) {
- layoutViewItems();
+ // TODO: remove layoutViewItems() here.
+ layoutViewItems(false);
super.onDraw(c);
}
@@ -1355,16 +1361,10 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
// If in the middle of zooming, only re-layout when the layout has changed.
if (!mController.isZoomStarted() || changed) {
resetZoomView();
- layoutViewItems();
+ layoutViewItems(changed);
}
}
- @Override
- public void onConfigurationChanged(Configuration config) {
- super.onConfigurationChanged(config);
- mConfigurationChanged = true;
- }
-
/**
* Clears the translation and scale that has been set on the view, cancels any loading
* request for image partial decoding, and hides zoom view.