Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d13d9ce authored by Brian Attwell's avatar Brian Attwell
Browse files

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
parent 77aa4989
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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(),
        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);
    }

    /**