From 3f3ccfca55c914163b0231049aeb60026028c32d Mon Sep 17 00:00:00 2001 From: Vavassor Date: Mon, 26 Jun 2017 19:04:05 -0400 Subject: [PATCH] Adds an icon to video and gifv media previews to indicate they can be played. The icon is a circled triangle (play button). Closes #319 --- .../tusky/adapter/StatusViewHolder.java | 13 ++++++++++++- app/src/main/res/drawable/ic_play_48dp.xml | 8 ++++++++ app/src/main/res/layout/item_status.xml | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_play_48dp.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java index 60900824..ec16f333 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java @@ -63,6 +63,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder { private ImageView mediaPreview2; private ImageView mediaPreview3; private View sensitiveMediaWarning; + private View videoIndicator; private TextView mediaLabel; private View contentWarningBar; private TextView contentWarningDescription; @@ -89,6 +90,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder { mediaPreview2 = (ImageView) itemView.findViewById(R.id.status_media_preview_2); mediaPreview3 = (ImageView) itemView.findViewById(R.id.status_media_preview_3); sensitiveMediaWarning = itemView.findViewById(R.id.status_sensitive_media_warning); + videoIndicator = itemView.findViewById(R.id.status_video_indicator); mediaLabel = (TextView) itemView.findViewById(R.id.status_media_label); contentWarningBar = itemView.findViewById(R.id.status_content_warning_bar); contentWarningDescription = @@ -228,11 +230,16 @@ class StatusViewHolder extends RecyclerView.ViewHolder { .into(previews[i]); } + final Status.MediaAttachment.Type type = attachments[i].type; + if (type == Status.MediaAttachment.Type.VIDEO + | type == Status.MediaAttachment.Type.GIFV) { + videoIndicator.setVisibility(View.VISIBLE); + } + if (urls[i] == null || urls[i].isEmpty()) { previews[i].setOnClickListener(null); } else { final int urlIndex = i; - final Status.MediaAttachment.Type type = attachments[i].type; previews[i].setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -444,6 +451,9 @@ class StatusViewHolder extends RecyclerView.ViewHolder { if (!sensitive || attachments.length == 0) { hideSensitiveMediaWarning(); } + if (attachments.length == 0) { + videoIndicator.setVisibility(View.GONE); + } // Hide the unused label. mediaLabel.setVisibility(View.GONE); } else { @@ -454,6 +464,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder { mediaPreview2.setVisibility(View.GONE); mediaPreview3.setVisibility(View.GONE); hideSensitiveMediaWarning(); + videoIndicator.setVisibility(View.GONE); } setupButtons(listener, realStatus.account.id); diff --git a/app/src/main/res/drawable/ic_play_48dp.xml b/app/src/main/res/drawable/ic_play_48dp.xml new file mode 100644 index 00000000..fd6fee0c --- /dev/null +++ b/app/src/main/res/drawable/ic_play_48dp.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index bf1e6664..f87ce8d5 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -208,6 +208,22 @@ + + + + + +