mihon/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt

85 lines
2.3 KiB
Kotlin
Raw Normal View History

package eu.kanade.presentation.browse
2022-07-16 21:00:01 -04:00
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.items
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import eu.kanade.domain.manga.model.Manga
2022-07-16 21:00:01 -04:00
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.EmptyScreen
import eu.kanade.presentation.components.FastScrollLazyColumn
2022-07-16 21:00:01 -04:00
import eu.kanade.presentation.components.Scaffold
import eu.kanade.presentation.manga.components.BaseMangaListItem
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaState
@Composable
fun MigrateMangaScreen(
2022-07-16 21:00:01 -04:00
navigateUp: () -> Unit,
title: String?,
state: MigrateMangaState,
onClickItem: (Manga) -> Unit,
2022-05-10 17:54:52 -04:00
onClickCover: (Manga) -> Unit,
) {
2022-07-16 21:00:01 -04:00
Scaffold(
topBar = { scrollBehavior ->
2022-07-16 21:00:01 -04:00
AppBar(
title = title,
navigateUp = navigateUp,
scrollBehavior = scrollBehavior,
)
2022-07-16 21:00:01 -04:00
},
) { contentPadding ->
if (state.isEmpty) {
EmptyScreen(
textResource = R.string.empty_screen,
modifier = Modifier.padding(contentPadding),
)
return@Scaffold
}
MigrateMangaContent(
contentPadding = contentPadding,
state = state,
onClickItem = onClickItem,
onClickCover = onClickCover,
)
}
}
@Composable
private fun MigrateMangaContent(
contentPadding: PaddingValues,
state: MigrateMangaState,
onClickItem: (Manga) -> Unit,
2022-05-10 17:54:52 -04:00
onClickCover: (Manga) -> Unit,
) {
FastScrollLazyColumn(
contentPadding = contentPadding,
) {
items(state.titles) { manga ->
MigrateMangaItem(
manga = manga,
onClickItem = onClickItem,
2022-05-10 17:54:52 -04:00
onClickCover = onClickCover,
)
}
}
}
@Composable
private fun MigrateMangaItem(
modifier: Modifier = Modifier,
manga: Manga,
onClickItem: (Manga) -> Unit,
2022-05-10 17:54:52 -04:00
onClickCover: (Manga) -> Unit,
) {
BaseMangaListItem(
modifier = modifier,
manga = manga,
onClickItem = { onClickItem(manga) },
2022-05-10 17:54:52 -04:00
onClickCover = { onClickCover(manga) },
)
}