diff options
author | Chih-Chung Chang <chihchung@google.com> | 2009-05-15 11:22:37 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2009-05-15 11:24:08 +0800 |
commit | f1474b0c449d0b6d7620d5e02fd46f78cf0cdc02 (patch) | |
tree | 6e4fb6551d7fad22b1f2b781d7396661cda22982 /src/com/android | |
parent | f6e6d2b5815106c406cdca52eaa75de7c5998be1 (diff) | |
download | LegacyCamera-f1474b0c449d0b6d7620d5e02fd46f78cf0cdc02.zip LegacyCamera-f1474b0c449d0b6d7620d5e02fd46f78cf0cdc02.tar.gz LegacyCamera-f1474b0c449d0b6d7620d5e02fd46f78cf0cdc02.tar.bz2 |
Fix 1851972. Handle the zero images case in GridViewSpecial.
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/camera/GridViewSpecial.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/com/android/camera/GridViewSpecial.java b/src/com/android/camera/GridViewSpecial.java index aa89388..0a8b6ef 100644 --- a/src/com/android/camera/GridViewSpecial.java +++ b/src/com/android/camera/GridViewSpecial.java @@ -274,12 +274,13 @@ class GridViewSpecial extends View { // Calculate visible region according to scroll position. int startRow = (mScrollY - mSpec.mCellSpacing) / mBlockHeight; int endRow = (mScrollY + getHeight() - mSpec.mCellSpacing - 1) - / mBlockHeight; + / mBlockHeight + 1; // Limit startRow and endRow to the valid range. - startRow = Math.min(Math.max(startRow, 0), mRows - 1); - endRow = Math.min(Math.max(endRow, 0), mRows - 1); - mImageBlockManager.setVisibleRows(startRow, endRow + 1); + // Make sure we handle the mRows == 0 case right. + startRow = Math.max(Math.min(startRow, mRows - 1), 0); + endRow = Math.max(Math.min(endRow, mRows), 0); + mImageBlockManager.setVisibleRows(startRow, endRow); } private class MyGestureDetector extends SimpleOnGestureListener { |