diff options
author | Angus Kong <shkong@google.com> | 2013-05-30 15:18:50 -0700 |
---|---|---|
committer | Angus Kong <shkong@google.com> | 2013-05-30 15:18:50 -0700 |
commit | c31569ce211414f6db2447cc84ca71115f916b6f (patch) | |
tree | 64aa47c203f8ce0801cb3b72d79a63a8776d8caa /src/com/android/camera | |
parent | 9d6561494d28e8e8c6f1add50ab7724df722525b (diff) | |
download | android_packages_apps_Snap-c31569ce211414f6db2447cc84ca71115f916b6f.tar.gz android_packages_apps_Snap-c31569ce211414f6db2447cc84ca71115f916b6f.tar.bz2 android_packages_apps_Snap-c31569ce211414f6db2447cc84ca71115f916b6f.zip |
Adjust data id even if it's not currently used.
FilmStripView should adjust the internal info of data id after removal
regardless of the existence of the removed data in the buffer.
Change-Id: I78202997525a96a88f7bba8e0d55b7f6aad2c9cf
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/ui/FilmStripView.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java index f9a4ec038..76eccfa03 100644 --- a/src/com/android/camera/ui/FilmStripView.java +++ b/src/com/android/camera/ui/FilmStripView.java @@ -536,13 +536,21 @@ public class FilmStripView extends ViewGroup { .start(); } - private void updateRemoval(int removedInfo, final ImageData data) { + private void updateRemoval(int dataID, final ImageData data) { + int removedInfo = findInfoByDataID(dataID); + + // adjust the data id to be consistent + for (int i = 0; i < BUFFER_SIZE; i++) { + if (mViewInfo[i] == null || mViewInfo[i].getID() <= dataID) continue; + mViewInfo[i].setID(mViewInfo[i].getID() - 1); + } + if (removedInfo == -1) return; + final View removedView = mViewInfo[removedInfo].getView(); final int offsetX = (int) (removedView.getMeasuredWidth() + mViewGap); for (int i = removedInfo + 1; i < BUFFER_SIZE; i++) { if (mViewInfo[i] != null) { - mViewInfo[i].setID(mViewInfo[i].getID() - 1); mViewInfo[i].setLeftPosition(mViewInfo[i].getLeftPosition() - offsetX); } } @@ -732,9 +740,7 @@ public class FilmStripView extends ViewGroup { @Override public void onDataRemoved(int dataID, ImageData data) { - int info = findInfoByDataID(dataID); - if (info == -1) return; - updateRemoval(info, data); + updateRemoval(dataID, data); } }); } |