2022-05-07 23:34:55 -04:00
|
|
|
package eu.kanade.presentation.browse
|
2022-04-30 09:37:10 -04:00
|
|
|
|
2022-07-16 21:00:01 -04:00
|
|
|
import androidx.compose.foundation.layout.PaddingValues
|
2022-10-09 15:52:56 -04:00
|
|
|
import androidx.compose.foundation.layout.padding
|
2022-04-30 09:37:10 -04:00
|
|
|
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
|
2022-04-30 09:37:10 -04:00
|
|
|
import eu.kanade.presentation.components.EmptyScreen
|
2022-10-27 17:27:04 -04:00
|
|
|
import eu.kanade.presentation.components.FastScrollLazyColumn
|
2022-07-16 21:00:01 -04:00
|
|
|
import eu.kanade.presentation.components.Scaffold
|
2022-04-30 09:37:10 -04:00
|
|
|
import eu.kanade.presentation.manga.components.BaseMangaListItem
|
|
|
|
import eu.kanade.tachiyomi.R
|
2022-11-24 22:25:36 -05:00
|
|
|
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaState
|
2022-04-30 09:37:10 -04:00
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun MigrateMangaScreen(
|
2022-07-16 21:00:01 -04:00
|
|
|
navigateUp: () -> Unit,
|
|
|
|
title: String?,
|
2022-11-24 22:25:36 -05:00
|
|
|
state: MigrateMangaState,
|
2022-04-30 09:37:10 -04:00
|
|
|
onClickItem: (Manga) -> Unit,
|
2022-05-10 17:54:52 -04:00
|
|
|
onClickCover: (Manga) -> Unit,
|
2022-04-30 09:37:10 -04:00
|
|
|
) {
|
2022-07-16 21:00:01 -04:00
|
|
|
Scaffold(
|
2022-08-31 16:31:08 -04:00
|
|
|
topBar = { scrollBehavior ->
|
2022-07-16 21:00:01 -04:00
|
|
|
AppBar(
|
|
|
|
title = title,
|
|
|
|
navigateUp = navigateUp,
|
2022-08-31 16:31:08 -04:00
|
|
|
scrollBehavior = scrollBehavior,
|
2022-04-30 09:37:10 -04:00
|
|
|
)
|
2022-07-16 21:00:01 -04:00
|
|
|
},
|
2022-09-18 18:38:22 -04:00
|
|
|
) { contentPadding ->
|
2022-11-24 22:25:36 -05:00
|
|
|
if (state.isEmpty) {
|
|
|
|
EmptyScreen(
|
2022-10-09 15:52:56 -04:00
|
|
|
textResource = R.string.empty_screen,
|
|
|
|
modifier = Modifier.padding(contentPadding),
|
|
|
|
)
|
2022-11-24 22:25:36 -05:00
|
|
|
return@Scaffold
|
2022-07-16 14:44:37 -04:00
|
|
|
}
|
2022-11-24 22:25:36 -05:00
|
|
|
|
|
|
|
MigrateMangaContent(
|
|
|
|
contentPadding = contentPadding,
|
|
|
|
state = state,
|
|
|
|
onClickItem = onClickItem,
|
|
|
|
onClickCover = onClickCover,
|
|
|
|
)
|
2022-07-16 14:44:37 -04:00
|
|
|
}
|
2022-04-30 09:37:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Composable
|
2022-09-18 22:38:44 -04:00
|
|
|
private fun MigrateMangaContent(
|
2022-09-18 18:38:22 -04:00
|
|
|
contentPadding: PaddingValues,
|
2022-07-16 14:44:37 -04:00
|
|
|
state: MigrateMangaState,
|
2022-04-30 09:37:10 -04:00
|
|
|
onClickItem: (Manga) -> Unit,
|
2022-05-10 17:54:52 -04:00
|
|
|
onClickCover: (Manga) -> Unit,
|
2022-04-30 09:37:10 -04:00
|
|
|
) {
|
2022-10-27 17:27:04 -04:00
|
|
|
FastScrollLazyColumn(
|
2022-09-18 18:38:22 -04:00
|
|
|
contentPadding = contentPadding,
|
2022-04-30 09:37:10 -04:00
|
|
|
) {
|
2022-11-24 22:25:36 -05:00
|
|
|
items(state.titles) { manga ->
|
2022-04-30 09:37:10 -04:00
|
|
|
MigrateMangaItem(
|
|
|
|
manga = manga,
|
|
|
|
onClickItem = onClickItem,
|
2022-05-10 17:54:52 -04:00
|
|
|
onClickCover = onClickCover,
|
2022-04-30 09:37:10 -04:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Composable
|
2022-09-18 22:38:44 -04:00
|
|
|
private fun MigrateMangaItem(
|
2022-04-30 09:37:10 -04:00
|
|
|
modifier: Modifier = Modifier,
|
|
|
|
manga: Manga,
|
|
|
|
onClickItem: (Manga) -> Unit,
|
2022-05-10 17:54:52 -04:00
|
|
|
onClickCover: (Manga) -> Unit,
|
2022-04-30 09:37:10 -04:00
|
|
|
) {
|
|
|
|
BaseMangaListItem(
|
|
|
|
modifier = modifier,
|
|
|
|
manga = manga,
|
|
|
|
onClickItem = { onClickItem(manga) },
|
2022-05-10 17:54:52 -04:00
|
|
|
onClickCover = { onClickCover(manga) },
|
2022-04-30 09:37:10 -04:00
|
|
|
)
|
|
|
|
}
|