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

Commit 77b4a598 authored by Brian Attwell's avatar Brian Attwell
Browse files

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
parent f848c49c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -954,10 +954,14 @@ public class MultiShrinkScroller extends FrameLayout {
        // 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);
    }