feat: Mark live videos in video lists

This commit is contained in:
Stefan Schueller 2021-02-07 14:39:59 +01:00
parent fdc430daeb
commit 8518b8060a
9 changed files with 35 additions and 8 deletions

View File

@ -88,8 +88,14 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
// set Name
holder.name.setText(videoList.get(position).getName());
// set duration
// set duration (if not live stream)
if (videoList.get(position).getLive()) {
holder.videoDuration.setText(R.string.video_list_live_marker);
holder.videoDuration.setBackgroundColor(context.getResources().getColor(R.color.durationLiveBackgroundColor));
} else {
holder.videoDuration.setText(MetaDataHelper.getDuration(videoList.get(position).getDuration().longValue()));
holder.videoDuration.setBackgroundColor(context.getResources().getColor(R.color.durationBackgroundColor));
}
// set age and view count
holder.videoMeta.setText(

View File

@ -18,6 +18,12 @@ package net.schueller.peertube.model;
public class State {
public static final int PUBLISHED = 1;
public static final int TO_TRANSCODE = 2;
public static final int TO_IMPORT = 3;
public static final int WAITING_FOR_LIVE = 4;
public static final int LIVE_ENDED = 5;
private Integer id;
private String label;

View File

@ -43,6 +43,7 @@ public class Video {
private Boolean nsfw;
private String description;
private Boolean isLocal;
private Boolean isLive;
private Integer duration;
private Integer views;
private Integer likes;
@ -149,6 +150,14 @@ public class Video {
isLocal = local;
}
public Boolean getLive() {
return isLive;
}
public void setLive(final Boolean live) {
isLive = live;
}
public Integer getDuration() {
return duration;
}

View File

@ -35,7 +35,8 @@
android:id="@+id/video_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"/>
android:textColor="@color/durationTextColor"
android:background="@color/durationBackgroundColor"/>
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/avatar"

View File

@ -35,7 +35,8 @@
android:id="@+id/video_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"/>
android:textColor="@color/durationTextColor"
android:background="@color/durationBackgroundColor"/>
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/avatar"

View File

@ -35,7 +35,8 @@
android:id="@+id/video_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"/>
android:textColor="@color/durationTextColor"
android:background="@color/durationBackgroundColor"/>
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/avatar"

View File

@ -42,8 +42,8 @@
android:id="@+id/video_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:background="#232323"/>
android:textColor="@color/durationTextColor"
android:background="@color/durationBackgroundColor"/>
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/avatar"

View File

@ -5,7 +5,9 @@
<color name="themeSelected">#e300aaff</color>
<color name="seperator">#7ca6a6a6</color>
<color name="videoBackgroundColor">#000000</color>
<color name="durationBackgroundColor">#232323</color>
<color name="durationLiveBackgroundColor">#ff0000</color>
<color name="durationTextColor">#ffffff</color>
<!-- RED Theme -->
<color name="primaryColorRed">#F44336</color>

View File

@ -361,4 +361,5 @@
<string name="pref_insecure_confirm_no">No</string>
<string name="pref_insecure_confirm_yes">Yes</string>
<string name="pref_insecure_confirm_message">You are about the disable all SSL Certification validation in Thorium. Disabling this can be very dangerous if the peertube server is not under your control, because a man-in-the-middle attack could direct traffic to another server without your knowledge. An attacker could record passwords and other personal data.</string>
<string name="video_list_live_marker">LIVE</string>
</resources>