1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package eu.kanade.presentation.library.components
- import androidx.compose.foundation.combinedClickable
- import androidx.compose.foundation.lazy.grid.items
- import androidx.compose.runtime.Composable
- import androidx.compose.ui.Modifier
- import eu.kanade.tachiyomi.data.database.models.LibraryManga
- import eu.kanade.tachiyomi.ui.library.LibraryItem
- @Composable
- fun LibraryCoverOnlyGrid(
- items: List<LibraryItem>,
- columns: Int,
- selection: List<LibraryManga>,
- onClick: (LibraryManga) -> Unit,
- onLongClick: (LibraryManga) -> Unit,
- ) {
- LazyLibraryGrid(
- columns = columns,
- ) {
- items(
- items = items,
- key = {
- it.manga.id!!
- },
- ) { libraryItem ->
- LibraryCoverOnlyGridItem(
- item = libraryItem,
- isSelected = libraryItem.manga in selection,
- onClick = onClick,
- onLongClick = onLongClick,
- )
- }
- }
- }
- @Composable
- fun LibraryCoverOnlyGridItem(
- item: LibraryItem,
- isSelected: Boolean,
- onClick: (LibraryManga) -> Unit,
- onLongClick: (LibraryManga) -> Unit,
- ) {
- val manga = item.manga
- LibraryGridCover(
- modifier = Modifier
- .selectedOutline(isSelected)
- .combinedClickable(
- onClick = {
- onClick(manga)
- },
- onLongClick = {
- onLongClick(manga)
- },
- ),
- mangaCover = eu.kanade.domain.manga.model.MangaCover(
- manga.id!!,
- manga.source,
- manga.favorite,
- manga.thumbnail_url,
- manga.cover_last_modified,
- ),
- downloadCount = item.downloadCount,
- unreadCount = item.unreadCount,
- isLocal = item.isLocal,
- language = item.sourceLanguage,
- )
- }
|