mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-17 15:32:01 +00:00
add bookmark badge to poster component
This commit is contained in:
parent
71400d1654
commit
219210fd64
2 changed files with 26 additions and 0 deletions
|
|
@ -107,6 +107,7 @@ fun NuvioPosterCard(
|
||||||
bottomLeftLogoUrl: String? = null,
|
bottomLeftLogoUrl: String? = null,
|
||||||
bottomLeftText: String? = null,
|
bottomLeftText: String? = null,
|
||||||
isWatched: Boolean = false,
|
isWatched: Boolean = false,
|
||||||
|
isSaved: Boolean = false,
|
||||||
onClick: (() -> Unit)? = null,
|
onClick: (() -> Unit)? = null,
|
||||||
onLongClick: (() -> Unit)? = null,
|
onLongClick: (() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
|
|
@ -185,6 +186,13 @@ fun NuvioPosterCard(
|
||||||
.align(Alignment.TopEnd)
|
.align(Alignment.TopEnd)
|
||||||
.padding(6.dp),
|
.padding(6.dp),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
NuvioAnimatedBookmarkedBadge(
|
||||||
|
isVisible = isSaved,
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.TopStart)
|
||||||
|
.padding(6.dp),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if (shouldShowTitleBelow) {
|
if (shouldShowTitleBelow) {
|
||||||
Text(
|
Text(
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
package com.nuvio.app.features.home.components
|
package com.nuvio.app.features.home.components
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.nuvio.app.core.format.formatReleaseDateForDisplay
|
import com.nuvio.app.core.format.formatReleaseDateForDisplay
|
||||||
import com.nuvio.app.core.ui.NuvioPosterCard
|
import com.nuvio.app.core.ui.NuvioPosterCard
|
||||||
import com.nuvio.app.core.ui.NuvioPosterShape
|
import com.nuvio.app.core.ui.NuvioPosterShape
|
||||||
import com.nuvio.app.core.ui.rememberPosterCardStyleUiState
|
import com.nuvio.app.core.ui.rememberPosterCardStyleUiState
|
||||||
import com.nuvio.app.features.home.MetaPreview
|
import com.nuvio.app.features.home.MetaPreview
|
||||||
import com.nuvio.app.features.home.PosterShape
|
import com.nuvio.app.features.home.PosterShape
|
||||||
|
import com.nuvio.app.features.library.LibraryRepository
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HomePosterCard(
|
fun HomePosterCard(
|
||||||
|
|
@ -18,6 +22,19 @@ fun HomePosterCard(
|
||||||
onClick: (() -> Unit)? = null,
|
onClick: (() -> Unit)? = null,
|
||||||
onLongClick: (() -> Unit)? = null,
|
onLongClick: (() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
|
val libraryUiState by remember {
|
||||||
|
LibraryRepository.ensureLoaded()
|
||||||
|
LibraryRepository.uiState
|
||||||
|
}.collectAsStateWithLifecycle()
|
||||||
|
val isSaved = remember(
|
||||||
|
libraryUiState.items,
|
||||||
|
libraryUiState.sections,
|
||||||
|
libraryUiState.sourceMode,
|
||||||
|
item.id,
|
||||||
|
item.type,
|
||||||
|
) {
|
||||||
|
LibraryRepository.isSaved(item.id, item.type)
|
||||||
|
}
|
||||||
val posterCardStyle = rememberPosterCardStyleUiState()
|
val posterCardStyle = rememberPosterCardStyleUiState()
|
||||||
val isLandscapeMode = useLandscapeBackdropMode || posterCardStyle.catalogLandscapeModeEnabled
|
val isLandscapeMode = useLandscapeBackdropMode || posterCardStyle.catalogLandscapeModeEnabled
|
||||||
|
|
||||||
|
|
@ -31,6 +48,7 @@ fun HomePosterCard(
|
||||||
bottomLeftLogoUrl = if (isLandscapeMode) item.logo else null,
|
bottomLeftLogoUrl = if (isLandscapeMode) item.logo else null,
|
||||||
bottomLeftText = if (isLandscapeMode && item.logo.isNullOrBlank() && !posterCardStyle.hideLabelsEnabled) item.name else null,
|
bottomLeftText = if (isLandscapeMode && item.logo.isNullOrBlank() && !posterCardStyle.hideLabelsEnabled) item.name else null,
|
||||||
isWatched = isWatched,
|
isWatched = isWatched,
|
||||||
|
isSaved = isSaved,
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue