mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
Update LibraryScreen.kt
This commit is contained in:
parent
753f19d581
commit
31364ce401
1 changed files with 12 additions and 2 deletions
|
|
@ -53,7 +53,10 @@ fun LibraryScreen(
|
||||||
LibraryRepository.uiState
|
LibraryRepository.uiState
|
||||||
}.collectAsStateWithLifecycle()
|
}.collectAsStateWithLifecycle()
|
||||||
val networkStatusUiState by NetworkStatusRepository.uiState.collectAsStateWithLifecycle()
|
val networkStatusUiState by NetworkStatusRepository.uiState.collectAsStateWithLifecycle()
|
||||||
val watchedUiState by WatchedRepository.uiState.collectAsStateWithLifecycle()
|
val watchedUiState by remember {
|
||||||
|
WatchedRepository.ensureLoaded()
|
||||||
|
WatchedRepository.uiState
|
||||||
|
}.collectAsStateWithLifecycle()
|
||||||
var actionTarget by remember { mutableStateOf<LibraryActionTarget?>(null) }
|
var actionTarget by remember { mutableStateOf<LibraryActionTarget?>(null) }
|
||||||
var observedOfflineState by remember { mutableStateOf(false) }
|
var observedOfflineState by remember { mutableStateOf(false) }
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
|
|
@ -159,6 +162,7 @@ fun LibraryScreen(
|
||||||
else -> {
|
else -> {
|
||||||
librarySections(
|
librarySections(
|
||||||
sections = uiState.sections,
|
sections = uiState.sections,
|
||||||
|
watchedKeys = watchedUiState.watchedKeys,
|
||||||
onPosterClick = onPosterClick,
|
onPosterClick = onPosterClick,
|
||||||
onSectionViewAllClick = onSectionViewAllClick,
|
onSectionViewAllClick = onSectionViewAllClick,
|
||||||
onPosterLongClick = { item, section ->
|
onPosterLongClick = { item, section ->
|
||||||
|
|
@ -213,6 +217,7 @@ fun LibraryScreen(
|
||||||
|
|
||||||
private fun LazyListScope.librarySections(
|
private fun LazyListScope.librarySections(
|
||||||
sections: List<LibrarySection>,
|
sections: List<LibrarySection>,
|
||||||
|
watchedKeys: Set<String>,
|
||||||
onPosterClick: ((LibraryItem) -> Unit)?,
|
onPosterClick: ((LibraryItem) -> Unit)?,
|
||||||
onSectionViewAllClick: ((LibrarySection) -> Unit)?,
|
onSectionViewAllClick: ((LibrarySection) -> Unit)?,
|
||||||
onPosterLongClick: (LibraryItem, LibrarySection) -> Unit,
|
onPosterLongClick: (LibraryItem, LibrarySection) -> Unit,
|
||||||
|
|
@ -235,8 +240,13 @@ private fun LazyListScope.librarySections(
|
||||||
viewAllPillSize = NuvioViewAllPillSize.Compact,
|
viewAllPillSize = NuvioViewAllPillSize.Compact,
|
||||||
key = { item -> "${item.type}:${item.id}" },
|
key = { item -> "${item.type}:${item.id}" },
|
||||||
) { item ->
|
) { item ->
|
||||||
|
val preview = item.toMetaPreview()
|
||||||
HomePosterCard(
|
HomePosterCard(
|
||||||
item = item.toMetaPreview(),
|
item = preview,
|
||||||
|
isWatched = WatchingState.isPosterWatched(
|
||||||
|
watchedKeys = watchedKeys,
|
||||||
|
item = preview,
|
||||||
|
),
|
||||||
onClick = onPosterClick?.let { { it(item) } },
|
onClick = onPosterClick?.let { { it(item) } },
|
||||||
onLongClick = { onPosterLongClick(item, section) },
|
onLongClick = { onPosterLongClick(item, section) },
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue