mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 08:01:20 +02:00
Small optimizations to home page & nav drawer (#743)
## Description This PR has several micro optimizations to the home page & nav drawer. Basically it computes text off of the main thread and removes redundant calculations.
This commit is contained in:
parent
0639a7a1da
commit
fc0de2144d
7 changed files with 191 additions and 243 deletions
|
|
@ -6,6 +6,7 @@ import androidx.compose.runtime.Stable
|
|||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import com.github.damontecres.wholphin.ui.DateFormatter
|
||||
import com.github.damontecres.wholphin.ui.abbreviateNumber
|
||||
import com.github.damontecres.wholphin.ui.detail.CardGridItem
|
||||
import com.github.damontecres.wholphin.ui.detail.series.SeasonEpisodeIds
|
||||
import com.github.damontecres.wholphin.ui.dot
|
||||
|
|
@ -88,6 +89,15 @@ data class BaseItem(
|
|||
@Transient
|
||||
val ui =
|
||||
BaseItemUi(
|
||||
episodeCornerText =
|
||||
data.indexNumber?.let { "E$it" }
|
||||
?: data.premiereDate?.let(::formatDateTime),
|
||||
episdodeUnplayedCornerText =
|
||||
data.indexNumber?.let { "E$it" }
|
||||
?: data.userData
|
||||
?.unplayedItemCount
|
||||
?.takeIf { it > 0 }
|
||||
?.let { abbreviateNumber(it) },
|
||||
quickDetails =
|
||||
buildAnnotatedString {
|
||||
val details =
|
||||
|
|
@ -191,5 +201,7 @@ val BaseItemDto.aspectRatioFloat: Float? get() = width?.let { w -> height?.let {
|
|||
|
||||
@Immutable
|
||||
data class BaseItemUi(
|
||||
val episodeCornerText: String?,
|
||||
val episdodeUnplayedCornerText: String?,
|
||||
val quickDetails: AnnotatedString,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue