From 88e2f0cb7c52f3c78ee7165de2528f34f578969d Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 3 Nov 2022 17:07:47 +0100 Subject: [PATCH] Fix issue #391 - Add an icon when a media description is available. --- .../app/fedilab/android/ui/drawer/StatusAdapter.java | 11 ++++++++++- app/src/main/res/layout/layout_media.xml | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java index 09304dd40..4f87dbed4 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java @@ -1255,7 +1255,11 @@ public class StatusAdapter extends RecyclerView.Adapter focusX = statusToDeal.media_attachments.get(0).meta.focus.x; focusY = statusToDeal.media_attachments.get(0).meta.focus.y; } - + if (statusToDeal.media_attachments.get(0).description != null && !statusToDeal.media_attachments.get(0).description.isEmpty()) { + layoutMediaBinding.viewDescription.setVisibility(View.VISIBLE); + } else { + layoutMediaBinding.viewDescription.setVisibility(View.GONE); + } if (!mediaObfuscated(statusToDeal) || expand_media) { layoutMediaBinding.viewHide.setImageResource(R.drawable.ic_baseline_visibility_24); RequestBuilder requestBuilder = Glide.with(layoutMediaBinding.media.getContext()) @@ -1329,6 +1333,11 @@ public class StatusAdapter extends RecyclerView.Adapter } else { layoutMediaBinding.playMusic.setVisibility(View.GONE); } + if (attachment.description != null && !attachment.description.isEmpty()) { + layoutMediaBinding.viewDescription.setVisibility(View.VISIBLE); + } else { + layoutMediaBinding.viewDescription.setVisibility(View.GONE); + } lp.setMargins(0, 0, (int) Helper.convertDpToPixel(5, context), 0); if (!mediaObfuscated(statusToDeal) || expand_media) { layoutMediaBinding.viewHide.setImageResource(R.drawable.ic_baseline_visibility_24); diff --git a/app/src/main/res/layout/layout_media.xml b/app/src/main/res/layout/layout_media.xml index 3633dd8e0..86ca4d3ba 100644 --- a/app/src/main/res/layout/layout_media.xml +++ b/app/src/main/res/layout/layout_media.xml @@ -38,5 +38,14 @@ android:contentDescription="@string/visibility" android:src="@drawable/ic_baseline_visibility_24" /> - + \ No newline at end of file