summaryrefslogtreecommitdiffstats
path: root/src/com/android/contacts/widget
diff options
context:
space:
mode:
authorBrian Attwell <brianattwell@google.com>2014-09-08 18:25:58 -0700
committerBrian Attwell <brianattwell@google.com>2014-09-08 18:54:31 -0700
commit7d13d9cec5be388e1e938ca99107c0e863cb83f2 (patch)
tree3dc5d04cafe655dba7bba33ddce3ae7f6abc69ff /src/com/android/contacts/widget
parent77aa49895647202f6914e0d8b207f649ee015f0f (diff)
downloadpackages_apps_Contacts-7d13d9cec5be388e1e938ca99107c0e863cb83f2.tar.gz
packages_apps_Contacts-7d13d9cec5be388e1e938ca99107c0e863cb83f2.tar.bz2
packages_apps_Contacts-7d13d9cec5be388e1e938ca99107c0e863cb83f2.zip
Fix scroll offset calculation for collapsed header
When originally writing the logic that handled flinging and EdgeEffect it was impossible for contacts viewed inside the Contacts app to have a collapsed contact photo without the contact photo touching the top of the window. Now that we have added click-to-expand and click-to-collapse to the contact photo, we need to handle one more case. Bug: 17405547 Change-Id: I0fbad31b96ae7cf182708e9386b5327dfda8a226
Diffstat (limited to 'src/com/android/contacts/widget')
-rw-r--r--src/com/android/contacts/widget/MultiShrinkScroller.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java
index f5bd2a257..15dca5ce5 100644
--- a/src/com/android/contacts/widget/MultiShrinkScroller.java
+++ b/src/com/android/contacts/widget/MultiShrinkScroller.java
@@ -881,10 +881,17 @@ public class MultiShrinkScroller extends FrameLayout {
/**
* Returns the minimum size that we want to compress the header to, given that we don't want to
* allow the the ScrollView to scroll unless there is new content off of the edge of ScrollView.
+ * This value is never smaller than the current header height.
*/
private int getFullyCompressedHeaderHeight() {
- return Math.min(Math.max(mToolbar.getLayoutParams().height - getOverflowingChildViewSize(),
- mMinimumHeaderHeight), getMaximumScrollableHeaderHeight());
+ final int minimumScrollableHeaderHeight =
+ Math.min(Math.max(mToolbar.getLayoutParams().height - getOverflowingChildViewSize(),
+ mMinimumHeaderHeight), getMaximumScrollableHeaderHeight());
+ // It is possible that the current header height is smaller than the minimum height
+ // that can be obtained by scrolling since tapping on the contact photo collapses it.
+ // In this case, just return the current height or the minimum height.
+ return Math.max(Math.min(minimumScrollableHeaderHeight, mToolbar.getLayoutParams().height),
+ mMinimumHeaderHeight);
}
/**