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:
parent
0a7eaadda1
commit
3f3ccfca55
3 changed files with 36 additions and 1 deletions
|
@ -63,6 +63,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
|
||||||
private ImageView mediaPreview2;
|
private ImageView mediaPreview2;
|
||||||
private ImageView mediaPreview3;
|
private ImageView mediaPreview3;
|
||||||
private View sensitiveMediaWarning;
|
private View sensitiveMediaWarning;
|
||||||
|
private View videoIndicator;
|
||||||
private TextView mediaLabel;
|
private TextView mediaLabel;
|
||||||
private View contentWarningBar;
|
private View contentWarningBar;
|
||||||
private TextView contentWarningDescription;
|
private TextView contentWarningDescription;
|
||||||
|
@ -89,6 +90,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
|
||||||
mediaPreview2 = (ImageView) itemView.findViewById(R.id.status_media_preview_2);
|
mediaPreview2 = (ImageView) itemView.findViewById(R.id.status_media_preview_2);
|
||||||
mediaPreview3 = (ImageView) itemView.findViewById(R.id.status_media_preview_3);
|
mediaPreview3 = (ImageView) itemView.findViewById(R.id.status_media_preview_3);
|
||||||
sensitiveMediaWarning = itemView.findViewById(R.id.status_sensitive_media_warning);
|
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);
|
mediaLabel = (TextView) itemView.findViewById(R.id.status_media_label);
|
||||||
contentWarningBar = itemView.findViewById(R.id.status_content_warning_bar);
|
contentWarningBar = itemView.findViewById(R.id.status_content_warning_bar);
|
||||||
contentWarningDescription =
|
contentWarningDescription =
|
||||||
|
@ -228,11 +230,16 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
|
||||||
.into(previews[i]);
|
.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()) {
|
if (urls[i] == null || urls[i].isEmpty()) {
|
||||||
previews[i].setOnClickListener(null);
|
previews[i].setOnClickListener(null);
|
||||||
} else {
|
} else {
|
||||||
final int urlIndex = i;
|
final int urlIndex = i;
|
||||||
final Status.MediaAttachment.Type type = attachments[i].type;
|
|
||||||
previews[i].setOnClickListener(new View.OnClickListener() {
|
previews[i].setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -444,6 +451,9 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
|
||||||
if (!sensitive || attachments.length == 0) {
|
if (!sensitive || attachments.length == 0) {
|
||||||
hideSensitiveMediaWarning();
|
hideSensitiveMediaWarning();
|
||||||
}
|
}
|
||||||
|
if (attachments.length == 0) {
|
||||||
|
videoIndicator.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
// Hide the unused label.
|
// Hide the unused label.
|
||||||
mediaLabel.setVisibility(View.GONE);
|
mediaLabel.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -454,6 +464,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
|
||||||
mediaPreview2.setVisibility(View.GONE);
|
mediaPreview2.setVisibility(View.GONE);
|
||||||
mediaPreview3.setVisibility(View.GONE);
|
mediaPreview3.setVisibility(View.GONE);
|
||||||
hideSensitiveMediaWarning();
|
hideSensitiveMediaWarning();
|
||||||
|
videoIndicator.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
setupButtons(listener, realStatus.account.id);
|
setupButtons(listener, realStatus.account.id);
|
||||||
|
|
8
app/src/main/res/drawable/ic_play_48dp.xml
Normal file
8
app/src/main/res/drawable/ic_play_48dp.xml
Normal 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>
|
|
@ -208,6 +208,22 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</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
|
<LinearLayout
|
||||||
android:id="@+id/status_sensitive_media_warning"
|
android:id="@+id/status_sensitive_media_warning"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue