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

Commit fb33675a authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Fix layout oscillation at the root of a few bugs.

Note: The CL which introduced this bug was Ic9cd89e899a03010a523bee4f1ef72fbfbd8b43f

Test: visual, manual
Test: Use TalkBack to validate that the size of the touch target is still >48dp tall.
Test: Use an app (e.g. LINE) which only posts the most recent message in an update to send 2+ messages to the device (to make the unread number visible), and validate that 1) the text is visible, and 2) there are not thousands of View errors spamming adb.
Fixes: 182474419
Change-Id: Ia23113f5903fe2c508fc2dbad99160471dcec5fd
parent 8cf06f75
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1082,15 +1082,18 @@ public class ConversationLayout extends FrameLayout

    private void updateExpandButton() {
        int buttonGravity;
        int containerHeight;
        ViewGroup newContainer;
        if (mIsCollapsed) {
            buttonGravity = Gravity.CENTER;
            containerHeight = ViewGroup.LayoutParams.WRAP_CONTENT;
            // NOTE(b/182474419): In order for the touch target of the expand button to be the full
            // height of the notification, we would want the mExpandButtonContainer's height to be
            // set to WRAP_CONTENT (or 88dp) when in the collapsed state.  Unfortunately, that
            // causes an unstable remeasuring infinite loop when the unread count is visible,
            // causing the layout to occasionally hide the messages.  As an aside, that naive
            // solution also causes an undesirably large gap between content and smart replies.
            newContainer = mExpandButtonAndContentContainer;
        } else {
            buttonGravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
            containerHeight = ViewGroup.LayoutParams.MATCH_PARENT;
            newContainer = this;
        }
        mExpandButton.setExpanded(!mIsCollapsed);
@@ -1099,7 +1102,6 @@ public class ConversationLayout extends FrameLayout
        // content when collapsed, but allows the content to flow under it when expanded.
        if (newContainer != mExpandButtonContainer.getParent()) {
            ((ViewGroup) mExpandButtonContainer.getParent()).removeView(mExpandButtonContainer);
            mExpandButtonContainer.getLayoutParams().height = containerHeight;
            newContainer.addView(mExpandButtonContainer);
        }