mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Add long clicking context menus everywhere (#202)
Adds long click context menus to just about every card throughout the app. Previously only a few pages had this. Closes #196
This commit is contained in:
parent
5e2c75bb70
commit
2e3e4e3f5f
29 changed files with 766 additions and 289 deletions
|
|
@ -11,6 +11,7 @@ import org.jellyfin.sdk.model.api.BaseItemDto
|
|||
import org.jellyfin.sdk.model.api.BaseItemKind
|
||||
import org.jellyfin.sdk.model.api.ImageType
|
||||
import org.jellyfin.sdk.model.extensions.ticks
|
||||
import kotlin.time.Duration
|
||||
|
||||
@Serializable
|
||||
data class BaseItem(
|
||||
|
|
@ -18,29 +19,29 @@ data class BaseItem(
|
|||
val imageUrl: String?,
|
||||
val backdropImageUrl: String? = null,
|
||||
) {
|
||||
@Transient val id = data.id
|
||||
val id get() = data.id
|
||||
|
||||
@Transient val type = data.type
|
||||
val type get() = data.type
|
||||
|
||||
@Transient val name = data.name
|
||||
val name get() = data.name
|
||||
|
||||
@Transient
|
||||
val title = if (type == BaseItemKind.EPISODE) data.seriesName else name
|
||||
val title get() = if (type == BaseItemKind.EPISODE) data.seriesName else name
|
||||
|
||||
@Transient
|
||||
val subtitle =
|
||||
if (type == BaseItemKind.EPISODE) data.seasonEpisode + " - " + name else data.productionYear?.toString()
|
||||
|
||||
@Transient
|
||||
val resumeMs =
|
||||
data.userData
|
||||
?.playbackPositionTicks
|
||||
?.ticks
|
||||
?.inWholeMilliseconds
|
||||
val subtitle
|
||||
get() =
|
||||
if (type == BaseItemKind.EPISODE) data.seasonEpisode + " - " + name else data.productionYear?.toString()
|
||||
|
||||
@Transient
|
||||
val indexNumber = data.indexNumber ?: dateAsIndex()
|
||||
|
||||
val playbackPosition get() = data.userData?.playbackPositionTicks?.ticks ?: Duration.ZERO
|
||||
|
||||
val resumeMs get() = playbackPosition.inWholeMilliseconds
|
||||
|
||||
val played get() = data.userData?.played ?: false
|
||||
|
||||
val favorite get() = data.userData?.isFavorite ?: false
|
||||
|
||||
private fun dateAsIndex(): Int? =
|
||||
data.premiereDate
|
||||
?.let {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue