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

Commit fff7ad26 authored by Brian Attwell's avatar Brian Attwell
Browse files

Fix bugs MultiShrinkScroller#snapToBottom()

* use distinct logic for deciding when to snapToBottom in landscape
* I was using the wrong constant in a calculation before. I was
  using mTransparentStartHeight instead of mIntermediateHeaderHeight.
  The result is subtle so I didn't notice until I looked at the code
  again.

Bug: 16875627
Change-Id: I6ede58afa3717540f01d8d59eaad80e11db7ac14
parent 96107e67
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -535,12 +535,24 @@ public class MultiShrinkScroller extends FrameLayout {
        if (mHasEverTouchedTheTop) {
            // If QuickContacts has touched the top of the screen previously, then we
            // will less aggressively snap to the bottom of the screen.
            final float predictedScrollPastTop = -getScroll() + mIntermediateHeaderHeight
            final float predictedScrollPastTop = -getScroll() + mTransparentStartHeight
                    - flingDelta;
            final boolean isLandscape = getResources().getConfiguration().orientation
                    == Configuration.ORIENTATION_LANDSCAPE;
            if (isLandscape) {
                // In landscape orientation, we dismiss the QC once it goes below the starting
                // starting offset that is used when QC starts in collapsed mode.
                if (predictedScrollPastTop > mTransparentStartHeight) {
                    scrollOffBottom();
                }
            } else {
                // In portrait orientation, we dismiss the QC once it goes below
                // mIntermediateHeaderHeight within the bottom of the screen.
                final float heightMinusHeader = getHeight() - mIntermediateHeaderHeight;
                if (predictedScrollPastTop > heightMinusHeader) {
                    scrollOffBottom();
                }
            }
            return;
        }
        if (-getScroll() - flingDelta > 0) {