center image preview if bubble is wider

Daniel Gultsch created

Change summary

src/main/res/layout/item_message_content.xml | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

Detailed changes

src/main/res/layout/item_message_content.xml 🔗

@@ -14,14 +14,21 @@
             android:longClickable="false"
             android:textAppearance="?textAppearanceBodyMedium" />
 
-        <ImageView
-            android:id="@+id/message_image"
+        <LinearLayout
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:adjustViewBounds="true"
-            android:background="@color/gray_800"
-            android:longClickable="true"
-            android:scaleType="centerCrop" />
+            android:layout_gravity="center_horizontal"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:id="@+id/message_image"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:adjustViewBounds="true"
+                android:background="@color/gray_800"
+                android:longClickable="true"
+                android:scaleType="centerCrop" />
+        </LinearLayout>
 
         <com.google.android.material.button.MaterialButton
             android:id="@+id/download_button"