mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-20 06:18:26 +00:00
Fix for inconsistent thumbnail aspect ratio
Problems arose from any app that targets below API 19 and uses views that rely on RelativeLayouts giving correct measurement specs to their onMeasure(). Resolves #2676 Closes #2712 // FREEBIE
This commit is contained in:
parent
7a023b9fdc
commit
761ccf4b3f
@ -12,28 +12,34 @@
|
|||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentStart="true" />
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.ForegroundImageView
|
<LinearLayout android:id="@+id/thumbnail_container"
|
||||||
android:id="@+id/image_view"
|
android:layout_toRightOf="@id/triangle_tick"
|
||||||
android:layout_width="wrap_content"
|
android:layout_toEndOf="@id/triangle_tick"
|
||||||
android:layout_height="@dimen/media_bubble_height"
|
android:layout_gravity="center"
|
||||||
android:layout_marginRight="@dimen/message_bubble_end_padding"
|
android:layout_width="wrap_content"
|
||||||
android:visibility="gone"
|
android:layout_height="wrap_content">
|
||||||
android:layout_toRightOf="@id/triangle_tick"
|
|
||||||
android:layout_toEndOf="@id/triangle_tick"
|
<org.thoughtcrime.securesms.components.ForegroundImageView
|
||||||
android:layout_gravity="center"
|
android:id="@+id/image_view"
|
||||||
android:scaleType="centerCrop"
|
android:layout_width="wrap_content"
|
||||||
android:adjustViewBounds="true"
|
android:layout_height="@dimen/media_bubble_height"
|
||||||
android:contentDescription="@string/conversation_item__mms_image_description"
|
android:layout_marginRight="@dimen/message_bubble_end_padding"
|
||||||
app:riv_corner_radius="@dimen/message_bubble_corner_radius"
|
android:visibility="gone"
|
||||||
app:riv_border_width="@dimen/media_bubble_border_width"
|
android:layout_gravity="center"
|
||||||
tools:src="@drawable/ic_video_light" />
|
android:scaleType="centerCrop"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:contentDescription="@string/conversation_item__mms_image_description"
|
||||||
|
app:riv_corner_radius="@dimen/message_bubble_corner_radius"
|
||||||
|
app:riv_border_width="@dimen/media_bubble_border_width"
|
||||||
|
tools:src="@drawable/ic_video_light" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/body_bubble"
|
<LinearLayout android:id="@+id/body_bubble"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toRightOf="@id/triangle_tick"
|
android:layout_toRightOf="@id/triangle_tick"
|
||||||
android:layout_toEndOf="@id/triangle_tick"
|
android:layout_toEndOf="@id/triangle_tick"
|
||||||
android:layout_below="@id/image_view"
|
android:layout_below="@id/thumbnail_container"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView android:id="@+id/conversation_item_body"
|
<TextView android:id="@+id/conversation_item_body"
|
||||||
|
@ -11,12 +11,17 @@
|
|||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginTop="12dp" />
|
android:layout_marginTop="12dp" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.ForegroundImageView
|
<LinearLayout android:id="@+id/thumbnail_container"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_toLeftOf="@id/triangle_tick"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.ForegroundImageView
|
||||||
android:id="@+id/image_view"
|
android:id="@+id/image_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/media_bubble_height"
|
android:layout_height="@dimen/media_bubble_height"
|
||||||
android:layout_marginLeft="@dimen/message_bubble_end_padding"
|
android:layout_marginLeft="@dimen/message_bubble_end_padding"
|
||||||
android:layout_toLeftOf="@id/triangle_tick"
|
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
@ -26,13 +31,13 @@
|
|||||||
app:riv_border_width="@dimen/media_bubble_border_width"
|
app:riv_border_width="@dimen/media_bubble_border_width"
|
||||||
tools:src="@drawable/ic_video_light"
|
tools:src="@drawable/ic_video_light"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/body_bubble"
|
<LinearLayout android:id="@+id/body_bubble"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/image_view"
|
android:layout_below="@id/thumbnail_container"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignBottom="@id/image_view"
|
|
||||||
android:paddingRight="10dip"
|
android:paddingRight="10dip"
|
||||||
android:paddingLeft="10dip"
|
android:paddingLeft="10dip"
|
||||||
android:layout_marginLeft="50dp"
|
android:layout_marginLeft="50dp"
|
||||||
|
22
res/layout/thumbnail_view.xml
Normal file
22
res/layout/thumbnail_view.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="210dp">
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.ForegroundImageView
|
||||||
|
android:id="@+id/image_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:contentDescription="@string/conversation_item__mms_image_description"
|
||||||
|
app:riv_corner_radius="@dimen/message_bubble_corner_radius"
|
||||||
|
app:riv_border_width="@dimen/media_bubble_border_width"
|
||||||
|
tools:src="@drawable/ic_video_light"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -148,11 +148,14 @@ public abstract class BubbleContainer extends RelativeLayout {
|
|||||||
|
|
||||||
private void setAlignment(@MediaState int mediaState) {
|
private void setAlignment(@MediaState int mediaState) {
|
||||||
RelativeLayout.LayoutParams parentParams = (RelativeLayout.LayoutParams) bodyBubble.getLayoutParams();
|
RelativeLayout.LayoutParams parentParams = (RelativeLayout.LayoutParams) bodyBubble.getLayoutParams();
|
||||||
if (mediaState != MEDIA_STATE_CAPTIONED) {
|
if (mediaState == MEDIA_STATE_CAPTIONLESS) {
|
||||||
parentParams.addRule(RelativeLayout.BELOW, 0);
|
parentParams.addRule(RelativeLayout.BELOW, 0);
|
||||||
parentParams.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.image_view);
|
parentParams.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.thumbnail_container);
|
||||||
|
} else if (mediaState == MEDIA_STATE_CAPTIONED) {
|
||||||
|
parentParams.addRule(RelativeLayout.BELOW, R.id.thumbnail_container);
|
||||||
|
parentParams.addRule(RelativeLayout.ALIGN_BOTTOM, 0);
|
||||||
} else {
|
} else {
|
||||||
parentParams.addRule(RelativeLayout.BELOW, R.id.image_view);
|
parentParams.addRule(RelativeLayout.BELOW, 0);
|
||||||
parentParams.addRule(RelativeLayout.ALIGN_BOTTOM, 0);
|
parentParams.addRule(RelativeLayout.ALIGN_BOTTOM, 0);
|
||||||
}
|
}
|
||||||
bodyBubble.setLayoutParams(parentParams);
|
bodyBubble.setLayoutParams(parentParams);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user