mirror of
https://github.com/null2264/yokai.git
synced 2025-06-20 18:24:42 +00:00
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:
parent
9cf1fbb118
commit
c9a90f6847
2 changed files with 10 additions and 4 deletions
|
@ -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,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue