fix attachment remove button alignment
fixes #3597 Closes #4077 // FREEBIE
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 499 B After Width: | Height: | Size: 586 B |
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 588 B |
@ -1,11 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<size android:height="24dp" android:width="24dp"/>
|
||||
<solid android:color="@color/white"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<size android:height="21dp" android:width="21dp"/>
|
||||
|
@ -6,8 +6,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:contentDescription="@string/conversation_item__mms_image_description"
|
||||
android:layout_margin="@dimen/media_bubble_border_width" />
|
||||
android:contentDescription="@string/conversation_item__mms_image_description" />
|
||||
|
||||
<ViewStub android:id="@+id/transfer_controls_stub"
|
||||
android:layout_width="70dp"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/remove_image_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/media_bubble_remove_button_size"
|
||||
android:layout_height="@dimen/media_bubble_remove_button_size"
|
||||
android:src="@drawable/conversation_attachment_close_circle" />
|
||||
|
@ -24,6 +24,7 @@
|
||||
<dimen name="message_bubble_shadow_distance">1.5dp</dimen>
|
||||
<dimen name="media_bubble_height">210dp</dimen>
|
||||
<dimen name="media_bubble_border_width">3dp</dimen>
|
||||
<dimen name="media_bubble_remove_button_size">24dp</dimen>
|
||||
|
||||
<integer name="media_overview_cols">3</integer>
|
||||
<dimen name="message_details_table_row_pad">10dp</dimen>
|
||||
|
@ -155,6 +155,8 @@ public class ThumbnailView extends FrameLayout {
|
||||
|
||||
public void setRemoveClickListener(OnClickListener listener) {
|
||||
getRemoveButton().setOnClickListener(listener);
|
||||
final int pad = getResources().getDimensionPixelSize(R.dimen.media_bubble_remove_button_size);
|
||||
image.setPadding(pad, pad, pad, 0);
|
||||
}
|
||||
|
||||
public void setDownloadClickListener(ThumbnailClickListener listener) {
|
||||
@ -324,11 +326,15 @@ public class ThumbnailView extends FrameLayout {
|
||||
Log.w(TAG, "onResourceReady() for a Bitmap. Saving.");
|
||||
part.setThumbnail(((GlideBitmapDrawable)resource).getBitmap());
|
||||
}
|
||||
if (resource.getIntrinsicWidth() < resource.getIntrinsicHeight()) {
|
||||
getRemoveButton().setPadding(0, 0, (getWidth() - resource.getIntrinsicWidth()) / 2, 0);
|
||||
LayoutParams layoutParams = (LayoutParams) getRemoveButton().getLayoutParams();
|
||||
if (resource.getIntrinsicWidth() < getWidth()) {
|
||||
layoutParams.topMargin = 0;
|
||||
layoutParams.rightMargin = Math.max(0, (getWidth() - image.getPaddingRight() - resource.getIntrinsicWidth()) / 2);
|
||||
} else {
|
||||
getRemoveButton().setPadding(0, (getHeight() - resource.getIntrinsicHeight()) / 2, 0, 0);
|
||||
layoutParams.topMargin = Math.max(0, (getHeight() - image.getPaddingTop() - resource.getIntrinsicHeight()) / 2);
|
||||
layoutParams.rightMargin = 0;
|
||||
}
|
||||
getRemoveButton().setLayoutParams(layoutParams);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|