From 26862c304a8163016b1f8196c715769750ba1720 Mon Sep 17 00:00:00 2001 From: Erin Dahlgren Date: Wed, 9 Oct 2013 10:59:47 -0700 Subject: Update bottom controls and action bar with a tighter bounds on data change. Bug: 11087361 Change-Id: Ie319d1767eb671ca7ed4a129aa9b75c77d63b20d --- src/com/android/camera/CameraActivity.java | 2 +- src/com/android/camera/ui/FilmStripView.java | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/com/android') diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 3e5a7c044..35fcf42b3 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -733,7 +733,6 @@ public class CameraActivity extends Activity private void removeData(int dataID) { mDataAdapter.removeData(CameraActivity.this, dataID); - updateActionBarMenu(mFilmStripView.getCurrentId()); if (mDataAdapter.getTotalNumber() > 1) { showUndoDeletionBar(); } else { @@ -1339,6 +1338,7 @@ public class CameraActivity extends Activity } hideUndoDeletionBar(false); mDataAdapter.executeDeletion(CameraActivity.this); + updateActionBarMenu(mFilmStripView.getCurrentId()); } public void showUndoDeletionBar() { diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java index 56f5dfac8..7c9a5bab0 100644 --- a/src/com/android/camera/ui/FilmStripView.java +++ b/src/com/android/camera/ui/FilmStripView.java @@ -100,6 +100,8 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { private ValueAnimator.AnimatorUpdateListener mViewItemUpdateListener; private float mOverScaleFactor = 1f; + private int mLastTotalNumber = 0; + /** * Common interface for all images in the filmstrip. */ @@ -1022,12 +1024,15 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener { return; } - // If not a forced update, check if the item has changed since the last - // time we updated the visibility status. Only then check if the current - // image is a photo sphere. - if (!force && requestId == mLastItemId) { + // We cannot rely on the requestIds to check for data changes, + // because an item hands its id to its rightmost neighbor on + // deletion. To avoid loading the ImageData, we check if the DataAdapter + // has fewer total items. + int total = mDataAdapter.getTotalNumber(); + if (!force && mLastTotalNumber == total) { return; } + mLastTotalNumber = total; ImageData data = mDataAdapter.getImageData(requestId); -- cgit v1.2.3