mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Merge pull request #6694 from Bnyro/master
fix: hide download buttons when current video is live
This commit is contained in:
commit
e25e68df87
@ -24,7 +24,7 @@ data class StreamItem(
|
|||||||
val shortDescription: String? = null,
|
val shortDescription: String? = null,
|
||||||
val isShort: Boolean = false
|
val isShort: Boolean = false
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
val isLive get() = (duration != null) && (duration <= 0L)
|
val isLive get() = (duration == null) || (duration <= 0L)
|
||||||
|
|
||||||
fun toLocalPlaylistItem(playlistId: String): LocalPlaylistItem {
|
fun toLocalPlaylistItem(playlistId: String): LocalPlaylistItem {
|
||||||
return LocalPlaylistItem(
|
return LocalPlaylistItem(
|
||||||
|
@ -21,6 +21,8 @@ data class WatchHistoryItem(
|
|||||||
@ColumnInfo val duration: Long? = null,
|
@ColumnInfo val duration: Long? = null,
|
||||||
@ColumnInfo val isShort: Boolean = false
|
@ColumnInfo val isShort: Boolean = false
|
||||||
) {
|
) {
|
||||||
|
val isLive get() = (duration == null) || (duration <= 0L)
|
||||||
|
|
||||||
fun toStreamItem() = StreamItem(
|
fun toStreamItem() = StreamItem(
|
||||||
url = videoId,
|
url = videoId,
|
||||||
type = StreamItem.TYPE_STREAM,
|
type = StreamItem.TYPE_STREAM,
|
||||||
|
@ -92,7 +92,10 @@ class WatchHistoryAdapter(
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video.duration != null) watchProgress.setWatchProgressLength(video.videoId, video.duration)
|
if (video.duration != null) watchProgress.setWatchProgressLength(
|
||||||
|
video.videoId,
|
||||||
|
video.duration
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1136,6 +1136,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
streams.uploaderSubscriberCount.formatShort()
|
streams.uploaderSubscriberCount.formatShort()
|
||||||
)
|
)
|
||||||
player.isLive = streams.livestream
|
player.isLive = streams.livestream
|
||||||
|
relPlayerDownload.isVisible = !streams.livestream
|
||||||
}
|
}
|
||||||
playerBinding.exoTitle.text = streams.title
|
playerBinding.exoTitle.text = streams.title
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ class VideoOptionsBottomSheet : BaseBottomSheet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
optionsList += listOf(R.string.addToPlaylist, R.string.download, R.string.share)
|
optionsList += listOf(R.string.addToPlaylist, R.string.download, R.string.share)
|
||||||
|
if (streamItem.isLive) optionsList.remove(R.string.download)
|
||||||
|
|
||||||
setSimpleItems(optionsList.map { getString(it) }) { which ->
|
setSimpleItems(optionsList.map { getString(it) }) { which ->
|
||||||
when (optionsList[which]) {
|
when (optionsList[which]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user