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

This commit is contained in:
Vavassor 2017-06-26 19:04:05 -04:00
parent 0a7eaadda1
commit 3f3ccfca55
3 changed files with 36 additions and 1 deletions

View File

@ -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);

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#FFF" android:pathData="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M10,16.5L16,12L10,7.5V16.5Z" />
</vector>

View File

@ -208,6 +208,22 @@
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/status_video_indicator"
app:srcCompat="@drawable/ic_play_48dp"
android:alpha="0.5"
android:layout_centerInParent="true"
android:contentDescription="@null"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout
android:id="@+id/status_sensitive_media_warning"
android:layout_width="match_parent"