mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
watch progress for playlists
This commit is contained in:
parent
0fc0f78de5
commit
3cf1c1c9cb
@ -16,6 +16,7 @@ import com.github.libretube.preferences.PreferenceHelper
|
||||
import com.github.libretube.util.ConnectionHelper
|
||||
import com.github.libretube.util.NavigationHelper
|
||||
import com.github.libretube.util.RetrofitInstance
|
||||
import com.github.libretube.util.setWatchProgressLength
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@ -51,13 +52,13 @@ class PlaylistAdapter(
|
||||
holder.binding.apply {
|
||||
playlistTitle.text = streamItem.title
|
||||
playlistDescription.text = streamItem.uploaderName
|
||||
playlistDuration.text = DateUtils.formatElapsedTime(streamItem.duration!!)
|
||||
thumbnailDuration.text = DateUtils.formatElapsedTime(streamItem.duration!!)
|
||||
ConnectionHelper.loadImage(streamItem.thumbnail, playlistThumbnail)
|
||||
root.setOnClickListener {
|
||||
NavigationHelper.navigateVideo(root.context, streamItem.url, playlistId)
|
||||
}
|
||||
val videoId = streamItem.url!!.replace("/watch?v=", "")
|
||||
root.setOnLongClickListener {
|
||||
val videoId = streamItem.url!!.replace("/watch?v=", "")
|
||||
VideoOptionsDialog(videoId, root.context)
|
||||
.show(childFragmentManager, "VideoOptionsDialog")
|
||||
true
|
||||
@ -70,6 +71,7 @@ class PlaylistAdapter(
|
||||
removeFromPlaylist(token, position)
|
||||
}
|
||||
}
|
||||
watchProgress.setWatchProgressLength(videoId, streamItem.duration!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,27 +36,43 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="5dp"
|
||||
app:cardBackgroundColor="@color/duration_background_color"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="0dp">
|
||||
android:layout_gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/playlist_duration"
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/duration_text_color"
|
||||
tools:text="05:36" />
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
app:cardBackgroundColor="@color/duration_background_color"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/thumbnail_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:paddingVertical="2dp"
|
||||
android:textColor="@color/duration_text_color"
|
||||
android:textSize="11sp"
|
||||
tools:text="05:36" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<View
|
||||
android:id="@+id/watch_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@android:color/holo_red_dark" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<TextView
|
||||
|
Loading…
Reference in New Issue
Block a user