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

Commit 02fde73d authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixes the collapsed view with images and different densities

Previously the collapsed view could contain a message even before
the messaging imaging image and the display would look very distored.
This now makes sure that any groups with isolated messages always
are the last ones displayed.

Test: add group with image, adjust display settings to large
Change-Id: If9e69f72ce117687898dcaea591e61c6fb49ef46
Fixes: 78490082
parent 645c8671
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -207,6 +207,8 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
                mAvatarView.setTranslationY(0.0f);
                mSenderName.setAlpha(1.0f);
                mSenderName.setTranslationY(0.0f);
                mIsolatedMessage = null;
                mMessages = null;
                sInstancePool.release(MessagingGroup.this);
            }
        };
@@ -267,6 +269,11 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou

    @Override
    public int getMeasuredType() {
        if (mIsolatedMessage != null) {
            // We only want to show one group if we have an inline image, so let's return shortened
            // to avoid displaying the other ones.
            return MEASURED_SHORTENED;
        }
        boolean hasNormal = false;
        for (int i = mMessageContainer.getChildCount() - 1; i >= 0; i--) {
            View child = mMessageContainer.getChildAt(i);
@@ -292,9 +299,6 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou
                }
            }
        }
        if (mMessageContainer.getChildCount() == 0 && mIsolatedMessage != null) {
            return mIsolatedMessage.getMeasuredType();
        }
        return MEASURED_NORMAL;
    }