summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-08-16 16:46:48 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-16 16:46:48 -0700
commit751b85e8c3b5ff07eaaa6bdbd32517dcdc8f27aa (patch)
tree862b6cc3f4d063deed42dec9c62c29f66e62a755 /core/java
parentd140605fb4214ecc7477ae9bd58773b9beeafabd (diff)
parentee78b173aae7ecb35b065c7499ac4f89b9c2f06e (diff)
Merge "Fix bug 5048082 - Conversation doesn't scroll after you send a message"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/AbsListView.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index db4df40a43b5..dae118e29f24 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -637,6 +637,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
private boolean mIsAttached;
/**
+ * Track the item count from the last time we handled a data change.
+ */
+ private int mLastHandledItemCount;
+
+ /**
* Interface definition for a callback to be invoked when the list or grid
* has been scrolled.
*/
@@ -1829,10 +1834,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
// Check if our previous measured size was at a point where we should scroll later.
if (mTranscriptMode == TRANSCRIPT_MODE_NORMAL) {
final int childCount = getChildCount();
- final int listBottom = getBottom() - getPaddingBottom();
+ final int listBottom = getHeight() - getPaddingBottom();
final View lastChild = getChildAt(childCount - 1);
final int lastBottom = lastChild != null ? lastChild.getBottom() : listBottom;
- mForceTranscriptScroll = mFirstPosition + childCount >= mOldItemCount &&
+ mForceTranscriptScroll = mFirstPosition + childCount >= mLastHandledItemCount &&
lastBottom <= listBottom;
}
}
@@ -4744,6 +4749,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
@Override
protected void handleDataChanged() {
int count = mItemCount;
+ int lastHandledItemCount = mLastHandledItemCount;
+ mLastHandledItemCount = mItemCount;
if (count > 0) {
int newPos;
@@ -4765,10 +4772,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
return;
}
final int childCount = getChildCount();
- final int listBottom = getBottom() - getPaddingBottom();
+ final int listBottom = getHeight() - getPaddingBottom();
final View lastChild = getChildAt(childCount - 1);
final int lastBottom = lastChild != null ? lastChild.getBottom() : listBottom;
- if (mFirstPosition + childCount >= mOldItemCount && lastBottom <= listBottom) {
+ if (mFirstPosition + childCount >= lastHandledItemCount &&
+ lastBottom <= listBottom) {
mLayoutMode = LAYOUT_FORCE_BOTTOM;
return;
}