From 352ff3a2d1ab8b544150f714b31c8e474e95a76e Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Fri, 3 Jan 2020 20:22:16 +0100 Subject: [PATCH] give media previews a rounded outline (#1617) * give media previews a rounded outline * give media previews a rounded outline in ReportActivity --- .../keylesspalace/tusky/adapter/StatusBaseViewHolder.java | 2 ++ .../tusky/components/report/adapter/StatusViewHolder.kt | 1 + app/src/main/res/drawable/media_preview_outline.xml | 4 ++++ app/src/main/res/layout/item_conversation.xml | 8 ++++++-- app/src/main/res/layout/item_report_status.xml | 1 + app/src/main/res/layout/item_status.xml | 1 + app/src/main/res/layout/item_status_detailed.xml | 6 +++++- 7 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/drawable/media_preview_outline.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java index 1012317dc..6c4ed2b37 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java @@ -111,6 +111,8 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder { bookmarkButton = itemView.findViewById(R.id.status_bookmark); moreButton = itemView.findViewById(R.id.status_more); + itemView.findViewById(R.id.status_media_preview_container).setClipToOutline(true); + mediaPreviews = new MediaPreviewImageView[]{ itemView.findViewById(R.id.status_media_preview_0), itemView.findViewById(R.id.status_media_preview_1), diff --git a/app/src/main/java/com/keylesspalace/tusky/components/report/adapter/StatusViewHolder.kt b/app/src/main/java/com/keylesspalace/tusky/components/report/adapter/StatusViewHolder.kt index 40d5093f4..2007c2acc 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/report/adapter/StatusViewHolder.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/report/adapter/StatusViewHolder.kt @@ -61,6 +61,7 @@ class StatusViewHolder( adapterHandler.setStatusChecked(status, isChecked) } } + itemView.status_media_preview_container.clipToOutline = true } fun bind(status: Status) { diff --git a/app/src/main/res/drawable/media_preview_outline.xml b/app/src/main/res/drawable/media_preview_outline.xml new file mode 100644 index 000000000..a15ba5c86 --- /dev/null +++ b/app/src/main/res/drawable/media_preview_outline.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_conversation.xml b/app/src/main/res/layout/item_conversation.xml index 55b0dd0da..49fcd65e0 100644 --- a/app/src/main/res/layout/item_conversation.xml +++ b/app/src/main/res/layout/item_conversation.xml @@ -243,6 +243,7 @@ android:layout_height="@dimen/status_media_preview_height" android:layout_marginStart="4dp" android:layout_marginTop="4dp" + android:background="@drawable/media_preview_outline" android:scaleType="centerCrop" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/status_media_preview_2" @@ -314,11 +315,14 @@ android:id="@+id/status_sensitive_media_warning" android:layout_width="0dp" android:layout_height="0dp" - android:background="?attr/sensitive_media_warning_background_color" + android:background="@drawable/media_warning_bg" android:gravity="center" android:lineSpacingMultiplier="1.2" android:orientation="vertical" - android:padding="8dp" + android:paddingLeft="12dp" + android:paddingTop="8dp" + android:paddingRight="12dp" + android:paddingBottom="8dp" android:textAlignment="center" android:textColor="@android:color/white" android:textSize="?attr/status_text_medium" diff --git a/app/src/main/res/layout/item_report_status.xml b/app/src/main/res/layout/item_report_status.xml index 7b4c4bd17..a84a3257b 100644 --- a/app/src/main/res/layout/item_report_status.xml +++ b/app/src/main/res/layout/item_report_status.xml @@ -90,6 +90,7 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/status_media_preview_margin_top" android:layout_marginEnd="8dp" + android:background="@drawable/media_preview_outline" app:layout_constraintEnd_toStartOf="@id/barrierEnd" app:layout_constraintStart_toStartOf="@id/guideBegin" app:layout_constraintTop_toBottomOf="@id/buttonToggleContent" diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index 3ee561fcd..bbed3e039 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -184,6 +184,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="@dimen/status_media_preview_margin_top" + android:background="@drawable/media_preview_outline" android:importantForAccessibility="noHideDescendants" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@id/status_display_name" diff --git a/app/src/main/res/layout/item_status_detailed.xml b/app/src/main/res/layout/item_status_detailed.xml index 23e6f8ae2..b2accd484 100644 --- a/app/src/main/res/layout/item_status_detailed.xml +++ b/app/src/main/res/layout/item_status_detailed.xml @@ -203,6 +203,7 @@ android:layout_height="wrap_content" android:layout_marginTop="12dp" android:layout_marginBottom="4dp" + android:background="@drawable/media_preview_outline" android:importantForAccessibility="noHideDescendants" app:layout_constraintTop_toBottomOf="@id/card_view"> @@ -319,7 +320,10 @@ android:gravity="center" android:lineSpacingMultiplier="1.2" android:orientation="vertical" - android:padding="8dp" + android:paddingLeft="12dp" + android:paddingTop="8dp" + android:paddingRight="12dp" + android:paddingBottom="8dp" android:textAlignment="center" android:textColor="@android:color/white" android:textSize="?attr/status_text_medium"