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

Commit e027da23 authored by Selim Cinek's avatar Selim Cinek
Browse files

Indented the conversation action list

Previously the actions weren't aligned with the conversation content
start.

Bug: 150905003
Test: add conversations, observe normal layout
Change-Id: I0d79642db736c66419ae3e4a6982ebd17abf09e2
parent fa8b4186
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -142,6 +142,9 @@ public class ConversationLayout extends FrameLayout
    private int mContentMarginEnd;
    private Rect mMessagingClipRect;
    private ObservableTextView mAppName;
    private ViewGroup mActions;
    private int mConversationContentStart;
    private int mInternalButtonPadding;
    private boolean mAppNameGone;
    private int mFacePileAvatarSize;
    private int mFacePileAvatarSizeExpandedGroup;
@@ -171,6 +174,7 @@ public class ConversationLayout extends FrameLayout
    protected void onFinishInflate() {
        super.onFinishInflate();
        mMessagingLinearLayout = findViewById(R.id.notification_messaging);
        mActions = findViewById(R.id.actions);
        mMessagingLinearLayout.setMessagingLayout(this);
        mImageMessageContainer = findViewById(R.id.conversation_image_message_container);
        // We still want to clip, but only on the top, since views can temporarily out of bounds
@@ -273,6 +277,11 @@ public class ConversationLayout extends FrameLayout
        mAppName.setOnVisibilityChangedListener((visibility) -> {
            onAppNameVisibilityChanged();
        });
        mConversationContentStart = getResources().getDimensionPixelSize(
                R.dimen.conversation_content_start);
        mInternalButtonPadding
                = getResources().getDimensionPixelSize(R.dimen.button_padding_horizontal_material)
                + getResources().getDimensionPixelSize(R.dimen.button_inset_horizontal_material);
    }

    private void animateViewForceHidden(CachingIconView view, boolean forceHidden) {
@@ -425,7 +434,6 @@ public class ConversationLayout extends FrameLayout
    private void updateConversationLayout() {
        // Set avatar and name
        CharSequence conversationText = mConversationTitle;
        // TODO: display the secondary text somewhere
        if (mIsOneToOne) {
            // Let's resolve the icon / text from the last sender
            mConversationIcon.setVisibility(VISIBLE);
@@ -480,6 +488,27 @@ public class ConversationLayout extends FrameLayout
        updateIconPositionAndSize();
        updateImageMessages();
        updatePaddingsBasedOnContentAvailability();
        updateActionListPadding();
    }

    private void updateActionListPadding() {
        if (mActions == null) {
            return;
        }
        View firstAction = mActions.getChildAt(0);
        if (firstAction != null) {
            // Let's visually position the first action where the content starts
            int paddingStart = mConversationContentStart;

            MarginLayoutParams layoutParams = (MarginLayoutParams) firstAction.getLayoutParams();
            paddingStart -= layoutParams.getMarginStart();
            paddingStart -= mInternalButtonPadding;

            mActions.setPaddingRelative(paddingStart,
                    mActions.getPaddingTop(),
                    mActions.getPaddingEnd(),
                    mActions.getPaddingBottom());
        }
    }

    private void updateImageMessages() {
+2 −0
Original line number Diff line number Diff line
@@ -3894,6 +3894,8 @@
  <java-symbol type="dimen" name="conversation_icon_container_top_padding_small_avatar" />
  <java-symbol type="dimen" name="conversation_icon_container_top_padding_no_app_name" />
  <java-symbol type="layout" name="notification_template_material_conversation" />
  <java-symbol type="dimen" name="button_padding_horizontal_material" />
  <java-symbol type="dimen" name="button_inset_horizontal_material" />
  <java-symbol type="layout" name="conversation_face_pile_layout" />

  <!-- Intent resolver and share sheet -->