summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Powell <adamp@google.com> 2010-12-14 17:34:27 -0800
committer Adam Powell <adamp@google.com> 2010-12-14 17:34:27 -0800
commitbdccc2d3db85d6489ddf332871ebf082386bae53 (patch)
tree6a09cdd0d2f108127a8bc9d95e24b293a315560a
parent185097f56caf047f93fc2f842385d73d8680ed26 (diff)
Fix bug 3274422 - Prevent pop-in of items in certain lists
Change-Id: Ia4f253b1cb49fbed175d87f8d85fae838a99a614
-rw-r--r--core/java/android/widget/AbsListView.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 0b4e6c3766da..cbd98b93bc71 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -4126,9 +4126,19 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
final Rect listPadding = mListPadding;
+ // "effective padding" In this case is the amount of padding that affects
+ // how much space should not be filled by items. If we don't clip to padding
+ // there is no effective padding.
+ int effectivePaddingTop = 0;
+ int effectivePaddingBottom = 0;
+ if ((mGroupFlags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK) {
+ effectivePaddingTop = listPadding.top;
+ effectivePaddingBottom = listPadding.bottom;
+ }
+
// FIXME account for grid vertical spacing too?
- final int spaceAbove = listPadding.top - firstTop;
- final int end = getHeight() - listPadding.bottom;
+ final int spaceAbove = effectivePaddingTop - firstTop;
+ final int end = getHeight() - effectivePaddingBottom;
final int spaceBelow = lastBottom - end;
final int height = getHeight() - mPaddingBottom - mPaddingTop;
@@ -4148,12 +4158,12 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
// Update our guesses for where the first and last views are
if (firstPosition == 0) {
- mFirstPositionDistanceGuess = firstTop - mListPadding.top;
+ mFirstPositionDistanceGuess = firstTop - listPadding.top;
} else {
mFirstPositionDistanceGuess += incrementalDeltaY;
}
if (firstPosition + childCount == mItemCount) {
- mLastPositionDistanceGuess = lastBottom + mListPadding.bottom;
+ mLastPositionDistanceGuess = lastBottom + listPadding.bottom;
} else {
mLastPositionDistanceGuess += incrementalDeltaY;
}