Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
am de3b06d: MMS doesn\'t scroll
Browse files Browse the repository at this point in the history
* commit 'de3b06d3102ef4e21c199e722592aaed73594643':
  MMS doesn't scroll
  • Loading branch information
Tom Taylor authored and Android Git Automerger committed Nov 8, 2012
2 parents 453c66a + de3b06d commit 3e48f96
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/com/android/mms/ui/ComposeMessageActivity.java
Expand Up @@ -3923,7 +3923,7 @@ public void onContentChanged(MessageListAdapter adapter) {
private void smoothScrollToEnd(boolean force, int listSizeChange) {
int last = mMsgListView.getLastVisiblePosition();
int newPosition = mMsgListAdapter.getCount() - 1;
if (last <= 0 || newPosition < 0) {
if (last < 0 || newPosition < 0) {
if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
Log.v(TAG, "smoothScrollToEnd: last=" + last + ", newPos=" + newPosition +
", mMsgListView not ready");
Expand Down Expand Up @@ -3959,11 +3959,15 @@ private void smoothScrollToEnd(boolean force, int listSizeChange) {
// like -524. The lastChild listitem's bottom value will be the old value before the
// keyboard became visible but the size of the list will have changed. The test below
// add listSizeChange to bottom to figure out if the old position was already scrolled
// to the bottom.
// to the bottom. We also scroll the list if the last item is taller than the size of the
// list. This happens when the keyboard is up and the last item is an mms with an
// attachment thumbnail, such as picture. In this situation, we want to scroll the list so
// the bottom of the thumbnail is visible and the top of the item is scroll off the screen.
int listHeight = mMsgListView.getHeight();
if (force || ((listSizeChange != 0 || newPosition != mLastSmoothScrollPosition) &&
bottom + listSizeChange <=
listHeight - mMsgListView.getPaddingBottom())) {
listHeight - mMsgListView.getPaddingBottom()) ||
height > listHeight) {
if (Math.abs(listSizeChange) > SMOOTH_SCROLL_THRESHOLD) {
// When the keyboard comes up, the window manager initiates a cross fade
// animation that conflicts with smooth scroll. Handle that case by jumping the
Expand All @@ -3989,7 +3993,15 @@ private void smoothScrollToEnd(boolean force, int listSizeChange) {
if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
Log.v(TAG, "smooth scroll to " + newPosition);
}
mMsgListView.smoothScrollToPosition(newPosition);
if (height > listHeight) {
// If the height of the last item is taller than the whole height of the list,
// we need to scroll that item so that its top is negative or above the top of
// the list. That way, the bottom of the last item will be exposed above the
// keyboard.
mMsgListView.setSelectionFromTop(newPosition, listHeight - height);
} else {
mMsgListView.smoothScrollToPosition(newPosition);
}
mLastSmoothScrollPosition = newPosition;
}
}
Expand Down

0 comments on commit 3e48f96

Please sign in to comment.