From 77733cebe55fb85850a6f5fb31e853bb9d2119ea Mon Sep 17 00:00:00 2001 From: David Sandquist Date: Mon, 31 Aug 2026 17:26:54 +0200 Subject: [PATCH] Keep grid item badges and labels attached to the cell In grid view the file feature badges (shared, favorite, video, live photo, synced) were positioned against the whole grid cell rather than against the thumbnail image. The thumbnail is a 1:1 SquareImageView whose resolved size is bounded by the cell height, so when a cell is wider than it is tall the drawn image is narrower than the cell. Because the badge cluster used layout_constraintStart_toStartOf="parent" layout_constraintEnd_toEndOf="parent" layout_constraintHorizontal_bias="0.85" the 0.85 bias was applied across the full cell width instead of across the image, which pushed the badges into the empty space to the right of the thumbnail. Anchor them to the thumbnail so they stay on the image at any cell width. The file name had the matching problem from the other direction: it was given 75% of the cell and centred, with the overflow button placed in the leftover gap, so on a wide cell the button drifted away from the label it belongs to. Let the name take the width the overflow button does not need, which both keeps the two together and leaves more room for the name itself. This is only noticeable when cells are wide, which is why it shows up on tablets and in landscape on phones while looking correct in portrait on a phone, where the cell width is close to the image width. Signed-off-by: David Sandquist --- app/src/main/res/layout/grid_item.xml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/layout/grid_item.xml b/app/src/main/res/layout/grid_item.xml index 97e1084bdbd6..f459a733efd1 100644 --- a/app/src/main/res/layout/grid_item.xml +++ b/app/src/main/res/layout/grid_item.xml @@ -53,11 +53,11 @@ android:orientation="horizontal" android:padding="@dimen/standard_quarter_padding" android:translationZ="4dp" - app:layout_constraintBottom_toBottomOf="@+id/thumbnail" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toBottomOf="@id/thumbnail" + app:layout_constraintEnd_toEndOf="@id/thumbnail" app:layout_constraintHorizontal_bias="0.85" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="@id/thumbnail" + app:layout_constraintTop_toTopOf="@id/thumbnail" app:layout_constraintVertical_bias="0.85">