Fix QC title translation near bottom of screen
When part of a TextView is clipped outside its parent, its View#getHeight()
values changes even though the text size appears the same. Therefore,
calculations that expect TextView#getHeight() to represent the full
height of the TextView, both inside and outside its parent ViewGroup,
will be incorrect.
Bug: 16992872
Change-Id: I7c011f25f0b5222c6544ee1d653cc333d4c81369
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java
index ff84b2f..faa7e41 100644
--- a/src/com/android/contacts/widget/MultiShrinkScroller.java
+++ b/src/com/android/contacts/widget/MultiShrinkScroller.java
@@ -954,10 +954,14 @@
// How offset the title should be from the bottom of the toolbar
final int pretendBottomMargin = (int) (mCollapsedTitleBottomMargin * (1 - x)
+ mMaximumTitleMargin * x) ;
- // Calculate how offset the title should be from the top of the screen.
+ // Calculate how offset the title should be from the top of the screen. Instead of
+ // calling mLargeTextView.getHeight() use the mMaximumHeaderTextSize for this calculation.
+ // The getHeight() value acts unexpectedly when mLargeTextView is partially clipped by
+ // its parent.
titleLayoutParams.topMargin = getTransparentViewHeight()
+ toolbarLayoutParams.height - pretendBottomMargin
- - mLargeTextView.getHeight();
+ - mMaximumHeaderTextSize;
+ titleLayoutParams.bottomMargin = 0;
mLargeTextView.setLayoutParams(titleLayoutParams);
}