- Added duration to video list
This commit is contained in:
parent
d0d3f6c634
commit
a397822c23
@ -85,9 +85,12 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
||||
.into(holder.avatar);
|
||||
}
|
||||
|
||||
|
||||
// set Name
|
||||
holder.name.setText(videoList.get(position).getName());
|
||||
|
||||
// set duration
|
||||
holder.videoDuration.setText( MetaDataHelper.getDuration(videoList.get(position).getDuration().longValue()));
|
||||
|
||||
// set age and view count
|
||||
holder.videoMeta.setText(
|
||||
MetaDataHelper.getMetaString(videoList.get(position).getCreatedAt(),
|
||||
@ -153,7 +156,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
||||
|
||||
class VideoViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView name, videoMeta, videoOwner, moreButton;
|
||||
TextView name, videoMeta, videoOwner, moreButton, videoDuration;
|
||||
ImageView thumb, avatar;
|
||||
View mView;
|
||||
|
||||
@ -165,6 +168,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
||||
videoMeta = itemView.findViewById(R.id.videoMeta);
|
||||
videoOwner = itemView.findViewById(R.id.videoOwner);
|
||||
moreButton = itemView.findViewById(R.id.moreButton);
|
||||
videoDuration = itemView.findViewById(R.id.video_duration);
|
||||
mView = itemView;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,9 @@ package net.schueller.peertube.helper;
|
||||
import android.content.Context;
|
||||
import android.text.format.DateUtils;
|
||||
import net.schueller.peertube.R;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Period;
|
||||
import java.util.Date;
|
||||
|
||||
public class MetaDataHelper {
|
||||
@ -37,4 +40,7 @@ public class MetaDataHelper {
|
||||
serverHost;
|
||||
}
|
||||
|
||||
public static String getDuration(Long duration) {
|
||||
return DateUtils.formatElapsedTime(duration);
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,19 @@
|
||||
android:maxHeight="300dp"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<TextView
|
||||
android:paddingStart="4dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:layout_margin="2dp"
|
||||
android:text=""
|
||||
android:layout_above="@+id/avatar"
|
||||
android:gravity="bottom|end"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:id="@+id/video_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#000000"/>
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="72dp"
|
||||
|
Loading…
Reference in New Issue
Block a user