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

Commit 28db07e9 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed the heads up layout of conversations

Previously the expand button layout was always at 80dp which
made the collapsed size increase. we now measure it at
match_parent instead and just internally use another layout
to position it properly.

Fixes: 153204251
Test: add heads up notification, observe normal padding
Change-Id: I76df6529c1a24808bce54ed0d04230cddf7a0c8c
parent dcfa46c5
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -121,6 +121,7 @@ public class ConversationLayout extends FrameLayout
    private CachingIconView mConversationIconBadgeBg;
    private CachingIconView mConversationIconBadgeBg;
    private Icon mLargeIcon;
    private Icon mLargeIcon;
    private View mExpandButtonContainer;
    private View mExpandButtonContainer;
    private View mExpandButtonInnerContainer;
    private ViewGroup mExpandButtonAndContentContainer;
    private ViewGroup mExpandButtonAndContentContainer;
    private NotificationExpandButton mExpandButton;
    private NotificationExpandButton mExpandButton;
    private MessagingLinearLayout mImageMessageContainer;
    private MessagingLinearLayout mImageMessageContainer;
@@ -242,6 +243,7 @@ public class ConversationLayout extends FrameLayout
        mConversationHeader = findViewById(R.id.conversation_header);
        mConversationHeader = findViewById(R.id.conversation_header);
        mContentContainer = findViewById(R.id.notification_action_list_margin_target);
        mContentContainer = findViewById(R.id.notification_action_list_margin_target);
        mExpandButtonAndContentContainer = findViewById(R.id.expand_button_and_content_container);
        mExpandButtonAndContentContainer = findViewById(R.id.expand_button_and_content_container);
        mExpandButtonInnerContainer = findViewById(R.id.expand_button_inner_container);
        mExpandButton = findViewById(R.id.expand_button);
        mExpandButton = findViewById(R.id.expand_button);
        mExpandButtonExpandedTopMargin = getResources().getDimensionPixelSize(
        mExpandButtonExpandedTopMargin = getResources().getDimensionPixelSize(
                R.dimen.conversation_expand_button_top_margin_expanded);
                R.dimen.conversation_expand_button_top_margin_expanded);
@@ -1169,7 +1171,7 @@ public class ConversationLayout extends FrameLayout
        layoutParams.topMargin = topMargin;
        layoutParams.topMargin = topMargin;
        mExpandButton.setLayoutParams(layoutParams);
        mExpandButton.setLayoutParams(layoutParams);


        mExpandButtonContainer.setContentDescription(mContext.getText(contentDescriptionId));
        mExpandButtonInnerContainer.setContentDescription(mContext.getText(contentDescriptionId));
    }
    }


    private void updateContentEndPaddings() {
    private void updateContentEndPaddings() {
@@ -1213,7 +1215,7 @@ public class ConversationLayout extends FrameLayout
        mExpandable = expandable;
        mExpandable = expandable;
        if (expandable) {
        if (expandable) {
            mExpandButtonContainer.setVisibility(VISIBLE);
            mExpandButtonContainer.setVisibility(VISIBLE);
            mExpandButtonContainer.setOnClickListener(onClickListener);
            mExpandButtonInnerContainer.setOnClickListener(onClickListener);
        } else {
        } else {
            // TODO: handle content paddings to end of layout
            // TODO: handle content paddings to end of layout
            mExpandButtonContainer.setVisibility(GONE);
            mExpandButtonContainer.setVisibility(GONE);
+56 −43
Original line number Original line Diff line number Diff line
@@ -245,6 +245,7 @@
                    android:id="@+id/notification_messaging"
                    android:id="@+id/notification_messaging"
                    android:layout_width="match_parent"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_height="wrap_content"
                    android:minHeight="@dimen/notification_text_size"
                    android:spacing="@dimen/notification_messaging_spacing"
                    android:spacing="@dimen/notification_messaging_spacing"
                    android:clipToPadding="false"
                    android:clipToPadding="false"
                    android:clipChildren="false"
                    android:clipChildren="false"
@@ -263,14 +264,25 @@
        <include layout="@layout/notification_material_action_list" />
        <include layout="@layout/notification_material_action_list" />
    </com.android.internal.widget.RemeasuringLinearLayout>
    </com.android.internal.widget.RemeasuringLinearLayout>


    <!--This is dynamically placed between here and at the end of the layout-->
    <!--This is dynamically placed between here and at the end of the layout. It starts here since
    <LinearLayout
        only FrameLayout layout params have gravity-->
    <FrameLayout
        android:id="@+id/expand_button_container"
        android:id="@+id/expand_button_container"
        android:layout_width="wrap_content"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/conversation_expand_button_size"
        android:layout_height="match_parent"
        android:layout_gravity="end|top"
        android:layout_gravity="end|top"
        android:clipChildren="false"
        android:clipToPadding="false">
        <!--This layout makes sure that we can nicely center the expand content in the
            collapsed layout while the parent makes sure that we're never laid out bigger
            than the messaging content.-->
        <LinearLayout
            android:id="@+id/expand_button_inner_container"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/conversation_expand_button_size"
            android:paddingStart="16dp"
            android:paddingStart="16dp"
            android:orientation="horizontal"
            android:orientation="horizontal"
            android:layout_gravity="end|top"
            android:paddingEnd="@dimen/notification_content_margin_end"
            android:paddingEnd="@dimen/notification_content_margin_end"
            android:clipToPadding="false"
            android:clipToPadding="false"
            android:clipChildren="false"
            android:clipChildren="false"
@@ -312,4 +324,5 @@
                android:importantForAccessibility="no"
                android:importantForAccessibility="no"
                />
                />
        </LinearLayout>
        </LinearLayout>
    </FrameLayout>
</com.android.internal.widget.ConversationLayout>
</com.android.internal.widget.ConversationLayout>
+1 −0
Original line number Original line Diff line number Diff line
@@ -3865,6 +3865,7 @@
  <java-symbol type="id" name="conversation_icon_badge_ring" />
  <java-symbol type="id" name="conversation_icon_badge_ring" />
  <java-symbol type="id" name="conversation_icon_badge_bg" />
  <java-symbol type="id" name="conversation_icon_badge_bg" />
  <java-symbol type="id" name="expand_button_container" />
  <java-symbol type="id" name="expand_button_container" />
  <java-symbol type="id" name="expand_button_inner_container" />
  <java-symbol type="id" name="messaging_group_content_container" />
  <java-symbol type="id" name="messaging_group_content_container" />
  <java-symbol type="id" name="expand_button_and_content_container" />
  <java-symbol type="id" name="expand_button_and_content_container" />
  <java-symbol type="id" name="conversation_header" />
  <java-symbol type="id" name="conversation_header" />