chore(library/compose): View<->Compose Interop

REF: https://developer.android.com/develop/ui/compose/touch-input/pointer-input/scroll#parent-view-child-compose
This commit is contained in:
Ahmad Ansori Palembani 2025-01-09 07:22:21 +07:00
parent 9cf1fbb118
commit c9a90f6847
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 10 additions and 4 deletions

View file

@ -6,6 +6,9 @@ import android.view.View
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
import androidx.core.view.isGone
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
@ -69,12 +72,12 @@ class LibraryComposeController(
@Composable
fun ScreenContent() {
val nestedScrollInterop = rememberNestedScrollInteropConnection()
val state by presenter.state.collectAsState()
LibraryContent(
items = listOf(
LibraryItem.Blank(69),
LibraryItem.Blank(420),
),
modifier = Modifier.nestedScroll(nestedScrollInterop),
items = (0..50).map { LibraryItem.Blank(it) },
columns = 3,
)
}

View file

@ -3,6 +3,7 @@ package yokai.presentation.library
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import eu.kanade.tachiyomi.ui.library.models.LibraryItem
import yokai.presentation.AppBarType
import yokai.presentation.YokaiScaffold
@ -10,6 +11,7 @@ import yokai.presentation.library.components.LazyLibraryGrid
@Composable
fun LibraryContent(
modifier: Modifier = Modifier,
items: List<LibraryItem>,
columns: Int,
) {
@ -18,6 +20,7 @@ fun LibraryContent(
appBarType = AppBarType.NONE,
) { contentPadding ->
LazyLibraryGrid(
modifier = modifier,
columns = columns,
contentPadding = contentPadding,
) {