Added progress bar to playlist items.

This commit is contained in:
Koen J 2025-05-07 13:08:13 +02:00
commit 879aab0d99
2 changed files with 23 additions and 3 deletions

View file

@ -17,9 +17,11 @@ import com.futo.platformplayer.api.media.models.video.IPlatformVideo
import com.futo.platformplayer.constructs.Event1
import com.futo.platformplayer.images.GlideHelper.Companion.crossfade
import com.futo.platformplayer.states.StateDownloads
import com.futo.platformplayer.states.StateHistory
import com.futo.platformplayer.toHumanNowDiffString
import com.futo.platformplayer.toHumanNumber
import com.futo.platformplayer.toHumanTime
import com.futo.platformplayer.views.others.ProgressBar
import com.futo.platformplayer.views.platform.PlatformIndicator
class VideoListEditorViewHolder : ViewHolder {
@ -36,6 +38,7 @@ class VideoListEditorViewHolder : ViewHolder {
private val _imageDragDrop: ImageButton;
private val _platformIndicator: PlatformIndicator;
private val _layoutDownloaded: FrameLayout;
private val _timeBar: ProgressBar
var video: IPlatformVideo? = null
private set;
@ -59,6 +62,7 @@ class VideoListEditorViewHolder : ViewHolder {
_imageOptions = view.findViewById(R.id.image_settings);
_imageDragDrop = view.findViewById<ImageButton>(R.id.image_drag_drop);
_platformIndicator = view.findViewById(R.id.thumbnail_platform);
_timeBar = view.findViewById(R.id.time_bar);
_layoutDownloaded = view.findViewById(R.id.layout_downloaded);
_imageDragDrop.setOnTouchListener { _, event ->
@ -93,6 +97,9 @@ class VideoListEditorViewHolder : ViewHolder {
_textAuthor.text = v.author.name;
_textVideoDuration.text = v.duration.toHumanTime(false);
val historyPosition = StateHistory.instance.getHistoryPosition(v.url)
_timeBar.progress = historyPosition.toFloat() / v.duration.toFloat();
if(v.isLive) {
_containerDuration.visibility = View.GONE;
_containerLive.visibility = View.VISIBLE;

View file

@ -41,6 +41,19 @@
app:srcCompat="@drawable/placeholder_video_thumbnail"
android:background="@drawable/video_thumbnail_outline" />
<com.futo.platformplayer.views.others.ProgressBar
android:id="@+id/time_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="bottom"
app:progress="60%"
app:inactiveColor="#55EEEEEE"
android:layout_marginBottom="0dp"
app:radiusBottomLeft="4dp"
app:radiusBottomRight="4dp"
app:radiusTopLeft="0dp"
app:radiusTopRight="0dp" />
<LinearLayout
android:id="@+id/thumbnail_live_container"
android:layout_width="wrap_content"
@ -49,7 +62,7 @@
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="4dp"
android:layout_marginBottom="6dp"
android:paddingTop="0dp"
android:gravity="center_vertical"
android:orientation="horizontal"
@ -77,7 +90,7 @@
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="4dp"
android:layout_marginBottom="6dp"
android:paddingTop="0dp"
android:gravity="center_vertical"
android:orientation="horizontal"
@ -103,7 +116,7 @@
android:layout_height="20dp"
android:layout_gravity="bottom|start"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp" />
android:layout_marginBottom="6dp" />
<FrameLayout android:id="@+id/layout_downloaded"
android:layout_width="16dp"