mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Add page to details about people (#119)
Adds a page to show details about people (actors, directors, etc) when clicking on the person card <img width="1280" height="771" alt="wholphin_person" src="https://github.com/user-attachments/assets/ceba6c77-2943-4faf-a2c2-81471fb3acff" />
This commit is contained in:
parent
90f4ca7306
commit
982506555f
10 changed files with 635 additions and 20 deletions
|
|
@ -13,6 +13,7 @@ import com.github.damontecres.wholphin.ui.isNotNullOrBlank
|
|||
import org.jellyfin.sdk.model.api.BaseItemDto
|
||||
import org.jellyfin.sdk.model.api.MediaStream
|
||||
import org.jellyfin.sdk.model.api.MediaStreamType
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.Locale
|
||||
|
|
@ -32,6 +33,18 @@ fun formatDateTime(dateTime: LocalDateTime): String =
|
|||
dateTime.toString()
|
||||
}
|
||||
|
||||
fun formatDate(dateTime: LocalDate): String =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// TODO server returns in UTC, but sdk converts to local time
|
||||
// eg 2020-02-14T00:00:00.0000000Z => 2020-02-13T17:00:00 PT => Feb 13, 2020
|
||||
val formatter = DateTimeFormatter.ofPattern("MMM d, yyyy")
|
||||
formatter.format(dateTime)
|
||||
} else if (dateTime.toString().length >= 10) {
|
||||
dateTime.toString().substring(0, 10)
|
||||
} else {
|
||||
dateTime.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* If the item has season & episode info, format as `S# E#`
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
package com.github.damontecres.wholphin.util
|
||||
|
||||
import com.github.damontecres.wholphin.data.model.BaseItem
|
||||
|
||||
/**
|
||||
* Generic state for loading something from the API
|
||||
*/
|
||||
sealed interface LoadingState {
|
||||
object Pending : LoadingState
|
||||
data object Pending : LoadingState
|
||||
|
||||
object Loading : LoadingState
|
||||
data object Loading : LoadingState
|
||||
|
||||
object Success : LoadingState
|
||||
data object Success : LoadingState
|
||||
|
||||
data class Error(
|
||||
val message: String? = null,
|
||||
|
|
@ -20,3 +22,23 @@ sealed interface LoadingState {
|
|||
listOfNotNull(message, exception?.localizedMessage).joinToString(" - ")
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface RowLoadingState {
|
||||
data object Pending : RowLoadingState
|
||||
|
||||
data object Loading : RowLoadingState
|
||||
|
||||
data class Success(
|
||||
val items: List<BaseItem?>,
|
||||
) : RowLoadingState
|
||||
|
||||
data class Error(
|
||||
val message: String? = null,
|
||||
val exception: Throwable? = null,
|
||||
) : RowLoadingState {
|
||||
constructor(exception: Throwable) : this(null, exception)
|
||||
|
||||
val localizedMessage: String =
|
||||
listOfNotNull(message, exception?.localizedMessage).joinToString(" - ")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue