summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/GridViewSpecial.java9
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 {