diff --git a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt index 02bafed72..228c60478 100644 --- a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt @@ -32,9 +32,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import androidx.compose.ui.input.nestedscroll.nestedScroll -import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.platform.rememberNestedScrollInteropConnection import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow @@ -62,13 +60,12 @@ import java.util.Date @Composable fun HistoryScreen( - composeView: ComposeView, + nestedScrollInterop: NestedScrollConnection, presenter: HistoryPresenter, onClickItem: (HistoryWithRelations) -> Unit, onClickResume: (HistoryWithRelations) -> Unit, onClickDelete: (HistoryWithRelations, Boolean) -> Unit, ) { - val nestedScrollInterop = rememberNestedScrollInteropConnection(composeView) val state by presenter.state.collectAsState() val history = state.list?.collectAsLazyPagingItems() when { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ComposeController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ComposeController.kt index 9f24590eb..8e2c9ed2e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ComposeController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ComposeController.kt @@ -3,6 +3,8 @@ package eu.kanade.tachiyomi.ui.base.controller import android.view.LayoutInflater import android.view.View import androidx.compose.runtime.Composable +import androidx.compose.ui.input.nestedscroll.NestedScrollConnection +import androidx.compose.ui.platform.rememberNestedScrollInteropConnection import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.databinding.ComposeControllerBinding import nucleus.presenter.Presenter @@ -19,13 +21,14 @@ abstract class ComposeController

> : NucleusController super.onViewCreated(view) binding.root.setContent { + val nestedScrollInterop = rememberNestedScrollInteropConnection(binding.root) TachiyomiTheme { - ComposeContent() + ComposeContent(nestedScrollInterop) } } } - @Composable abstract fun ComposeContent() + @Composable abstract fun ComposeContent(nestedScrollInterop: NestedScrollConnection) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/LicensesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/LicensesController.kt index cf1661d6a..9f8c9ef0f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/LicensesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/LicensesController.kt @@ -5,8 +5,8 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.contentColorFor import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import androidx.compose.ui.input.nestedscroll.nestedScroll -import androidx.compose.ui.platform.rememberNestedScrollInteropConnection import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults.libraryColors import eu.kanade.tachiyomi.R @@ -17,9 +17,7 @@ class LicensesController : BasicComposeController() { override fun getTitle() = resources?.getString(R.string.licenses) @Composable - override fun ComposeContent() { - val nestedScrollInterop = rememberNestedScrollInteropConnection(binding.root) - + override fun ComposeContent(nestedScrollInterop: NestedScrollConnection) { LibrariesContainer( modifier = Modifier .fillMaxSize() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt index f6877b1fc..d2a04a131 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt @@ -5,6 +5,7 @@ import android.view.MenuInflater import android.view.MenuItem import androidx.appcompat.widget.SearchView import androidx.compose.runtime.Composable +import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import eu.kanade.domain.chapter.model.Chapter import eu.kanade.presentation.history.HistoryScreen import eu.kanade.tachiyomi.R @@ -28,9 +29,9 @@ class HistoryController : ComposeController(), RootController override fun createPresenter() = HistoryPresenter() @Composable - override fun ComposeContent() { + override fun ComposeContent(nestedScrollInterop: NestedScrollConnection) { HistoryScreen( - composeView = binding.root, + nestedScrollInterop = nestedScrollInterop, presenter = presenter, onClickItem = { history -> router.pushController(MangaController(history).withFadeTransaction())