diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt index ee7ab65c3..0243c9764 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionFilterScreen.kt @@ -1,20 +1,24 @@ package eu.kanade.presentation.browse +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.navigationBars +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.lazy.items import androidx.compose.material3.Switch import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier -import androidx.compose.ui.input.nestedscroll.NestedScrollConnection -import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.EmptyScreen import eu.kanade.presentation.components.LazyColumn import eu.kanade.presentation.components.LoadingScreen import eu.kanade.presentation.components.PreferenceRow +import eu.kanade.presentation.components.Scaffold +import eu.kanade.presentation.util.plus import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.browse.extension.ExtensionFilterPresenter import eu.kanade.tachiyomi.util.system.LocaleHelper @@ -23,21 +27,31 @@ import kotlinx.coroutines.flow.collectLatest @Composable fun ExtensionFilterScreen( - nestedScrollInterop: NestedScrollConnection, + navigateUp: () -> Unit, presenter: ExtensionFilterPresenter, ) { val context = LocalContext.current - when { - presenter.isLoading -> LoadingScreen() - presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen) - else -> { - SourceFilterContent( - nestedScrollInterop = nestedScrollInterop, - state = presenter, - onClickLang = { - presenter.toggleLanguage(it) - }, + Scaffold( + modifier = Modifier.statusBarsPadding(), + topBar = { + AppBar( + title = stringResource(R.string.label_extensions), + navigateUp = navigateUp, ) + }, + ) { paddingValues -> + when { + presenter.isLoading -> LoadingScreen() + presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen) + else -> { + SourceFilterContent( + paddingValues = paddingValues, + state = presenter, + onClickLang = { + presenter.toggleLanguage(it) + }, + ) + } } } LaunchedEffect(Unit) { @@ -53,13 +67,12 @@ fun ExtensionFilterScreen( @Composable fun SourceFilterContent( - nestedScrollInterop: NestedScrollConnection, + paddingValues: PaddingValues, state: ExtensionFilterState, onClickLang: (String) -> Unit, ) { LazyColumn( - modifier = Modifier.nestedScroll(nestedScrollInterop), - contentPadding = WindowInsets.navigationBars.asPaddingValues(), + contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(), ) { items( items = state.items, diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt index 1a64d7d9d..a2916dc7d 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt @@ -1,20 +1,23 @@ package eu.kanade.presentation.browse +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.navigationBars +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier -import androidx.compose.ui.input.nestedscroll.NestedScrollConnection -import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext import eu.kanade.domain.manga.model.Manga +import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.EmptyScreen import eu.kanade.presentation.components.LoadingScreen +import eu.kanade.presentation.components.Scaffold import eu.kanade.presentation.components.ScrollbarLazyColumn import eu.kanade.presentation.manga.components.BaseMangaListItem +import eu.kanade.presentation.util.plus import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaPresenter import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaPresenter.Event @@ -23,22 +26,33 @@ import kotlinx.coroutines.flow.collectLatest @Composable fun MigrateMangaScreen( - nestedScrollInterop: NestedScrollConnection, + navigateUp: () -> Unit, + title: String?, presenter: MigrateMangaPresenter, onClickItem: (Manga) -> Unit, onClickCover: (Manga) -> Unit, ) { val context = LocalContext.current - when { - presenter.isLoading -> LoadingScreen() - presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen) - else -> { - MigrateMangaContent( - nestedScrollInterop = nestedScrollInterop, - state = presenter, - onClickItem = onClickItem, - onClickCover = onClickCover, + Scaffold( + modifier = Modifier.statusBarsPadding(), + topBar = { + AppBar( + title = title, + navigateUp = navigateUp, ) + }, + ) { paddingValues -> + when { + presenter.isLoading -> LoadingScreen() + presenter.isEmpty -> EmptyScreen(textResource = R.string.empty_screen) + else -> { + MigrateMangaContent( + paddingValues = paddingValues, + state = presenter, + onClickItem = onClickItem, + onClickCover = onClickCover, + ) + } } } LaunchedEffect(Unit) { @@ -54,14 +68,13 @@ fun MigrateMangaScreen( @Composable fun MigrateMangaContent( - nestedScrollInterop: NestedScrollConnection, + paddingValues: PaddingValues, state: MigrateMangaState, onClickItem: (Manga) -> Unit, onClickCover: (Manga) -> Unit, ) { ScrollbarLazyColumn( - modifier = Modifier.nestedScroll(nestedScrollInterop), - contentPadding = WindowInsets.navigationBars.asPaddingValues(), + contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(), ) { items(state.items) { manga -> MigrateMangaItem( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionFilterController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionFilterController.kt index deee79081..fab410d76 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionFilterController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionFilterController.kt @@ -1,21 +1,17 @@ package eu.kanade.tachiyomi.ui.browse.extension import androidx.compose.runtime.Composable -import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import eu.kanade.presentation.browse.ExtensionFilterScreen -import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.ui.base.controller.ComposeController +import eu.kanade.tachiyomi.ui.base.controller.FullComposeController -class ExtensionFilterController : ComposeController() { +class ExtensionFilterController : FullComposeController() { - override fun getTitle() = resources?.getString(R.string.label_extensions) - - override fun createPresenter(): ExtensionFilterPresenter = ExtensionFilterPresenter() + override fun createPresenter() = ExtensionFilterPresenter() @Composable - override fun ComposeContent(nestedScrollInterop: NestedScrollConnection) { + override fun ComposeContent() { ExtensionFilterScreen( - nestedScrollInterop = nestedScrollInterop, + navigateUp = router::popCurrentController, presenter = presenter, ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaController.kt index 29e30ea15..d441c1ac0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaController.kt @@ -2,15 +2,14 @@ package eu.kanade.tachiyomi.ui.browse.migration.manga import android.os.Bundle import androidx.compose.runtime.Composable -import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import androidx.core.os.bundleOf import eu.kanade.presentation.browse.MigrateMangaScreen -import eu.kanade.tachiyomi.ui.base.controller.ComposeController +import eu.kanade.tachiyomi.ui.base.controller.FullComposeController import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.migration.search.SearchController import eu.kanade.tachiyomi.ui.manga.MangaController -class MigrationMangaController : ComposeController { +class MigrationMangaController : FullComposeController { constructor(sourceId: Long, sourceName: String?) : super( bundleOf( @@ -28,14 +27,13 @@ class MigrationMangaController : ComposeController { private val sourceId: Long = args.getLong(SOURCE_ID_EXTRA) private val sourceName: String? = args.getString(SOURCE_NAME_EXTRA) - override fun getTitle(): String? = sourceName - - override fun createPresenter(): MigrateMangaPresenter = MigrateMangaPresenter(sourceId) + override fun createPresenter() = MigrateMangaPresenter(sourceId) @Composable - override fun ComposeContent(nestedScrollInterop: NestedScrollConnection) { + override fun ComposeContent() { MigrateMangaScreen( - nestedScrollInterop = nestedScrollInterop, + navigateUp = router::popCurrentController, + title = sourceName, presenter = presenter, onClickItem = { router.pushController(SearchController(it.id))