Render images in a conversation true-to-size.

Previously, we were always rendering images as squares. Instead of doing
that, we now render them as close to true-to-size as possible (within
reasonable min/max width/height boundaries).
This commit is contained in:
Greyson Parrelli
2018-03-20 11:27:11 -07:00
committed by Moxie Marlinspike
parent 9f8b4cf892
commit ea374735e1
25 changed files with 376 additions and 55 deletions

View File

@@ -27,7 +27,11 @@
android:layout_gravity="center_horizontal"
android:visibility="gone"
android:contentDescription="@string/conversation_activity__attachment_thumbnail"
app:backgroundColorHint="?conversation_background" />
app:backgroundColorHint="?conversation_background"
app:minWidth="100dp"
app:maxWidth="300dp"
app:minHeight="100dp"
app:maxHeight="300dp" />
<org.thoughtcrime.securesms.components.AudioView
android:id="@+id/attachment_audio"

View File

@@ -78,8 +78,8 @@
<ViewStub
android:id="@+id/image_view_stub"
android:layout="@layout/conversation_item_received_thumbnail"
android:layout_width="@dimen/media_bubble_height"
android:layout_height="@dimen/media_bubble_height"/>
android:layout_width="@dimen/media_bubble_default_dimens"
android:layout_height="@dimen/media_bubble_default_dimens"/>
<ViewStub
android:id="@+id/audio_view_stub"

View File

@@ -2,12 +2,17 @@
<org.thoughtcrime.securesms.components.ThumbnailView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/image_view"
android:layout_width="@dimen/media_bubble_height"
android:layout_height="@dimen/media_bubble_height"
android:layout_width="@dimen/media_bubble_default_dimens"
android:layout_height="@dimen/media_bubble_default_dimens"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:contentDescription="@string/conversation_item__mms_image_description"
android:visibility="gone"
app:minWidth="@dimen/media_bubble_min_width"
app:maxWidth="@dimen/media_bubble_max_width"
app:minHeight="@dimen/media_bubble_min_height"
app:maxHeight="@dimen/media_bubble_max_height"
tools:src="@drawable/ic_video_light"
tools:visibility="gone" />

View File

@@ -40,9 +40,9 @@
<ViewStub
android:id="@+id/image_view_stub"
android:layout_width="@dimen/media_bubble_height"
android:layout_height="@dimen/media_bubble_height"
android:layout="@layout/conversation_item_sent_thumbnail"/>
android:layout_width="@dimen/media_bubble_default_dimens"
android:layout_height="@dimen/media_bubble_default_dimens"
android:layout="@layout/conversation_item_sent_thumbnail" />
<ViewStub
android:id="@+id/audio_view_stub"

View File

@@ -2,14 +2,19 @@
<org.thoughtcrime.securesms.components.ThumbnailView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/image_view"
android:layout_width="@dimen/media_bubble_height"
android:layout_height="@dimen/media_bubble_height"
android:layout_width="@dimen/media_bubble_default_dimens"
android:layout_height="@dimen/media_bubble_default_dimens"
android:layout_marginBottom="5dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:contentDescription="@string/conversation_item__mms_image_description"
android:visibility="gone"
app:minWidth="@dimen/media_bubble_min_width"
app:maxWidth="@dimen/media_bubble_max_width"
app:minHeight="@dimen/media_bubble_min_height"
app:maxHeight="@dimen/media_bubble_max_height"
tools:src="@drawable/ic_video_light"
tools:visibility="visible" />

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="media_bubble_max_width">220dp</dimen>
<dimen name="media_bubble_max_height">300dp</dimen>
</resources>

View File

@@ -147,6 +147,10 @@
<declare-styleable name="ThumbnailView">
<attr name="backgroundColorHint" format="color" />
<attr name="minWidth" format="dimension" />
<attr name="maxWidth" format="dimension" />
<attr name="minHeight" format="dimension" />
<attr name="maxHeight" format="dimension" />
</declare-styleable>
<declare-styleable name="DeliveryStatusView">

View File

@@ -18,9 +18,13 @@
<dimen name="message_bubble_corner_radius">4dp</dimen>
<dimen name="message_bubble_shadow_distance">1.5dp</dimen>
<dimen name="media_bubble_height">210dp</dimen>
<dimen name="media_bubble_remove_button_size">24dp</dimen>
<dimen name="media_bubble_edit_button_size">24dp</dimen>
<dimen name="media_bubble_default_dimens">210dp</dimen>
<dimen name="media_bubble_min_width">150dp</dimen>
<dimen name="media_bubble_max_width">250dp</dimen>
<dimen name="media_bubble_min_height">100dp</dimen>
<dimen name="media_bubble_max_height">320dp</dimen>
<integer name="media_overview_cols">3</integer>
<dimen name="message_details_table_row_pad">10dp</dimen>