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
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java
index 5f8bc14..ff84b2f 100644
--- a/src/com/android/contacts/widget/MultiShrinkScroller.java
+++ b/src/com/android/contacts/widget/MultiShrinkScroller.java
@@ -535,11 +535,23 @@
         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 float heightMinusHeader = getHeight() - mIntermediateHeaderHeight;
-            if (predictedScrollPastTop > heightMinusHeader) {
-                scrollOffBottom();
+            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;
         }