Skip to content

Commit

Permalink
Bump compose dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
vfsfitvnm committed Oct 5, 2022
1 parent 6abe789 commit 400b47f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ import androidx.compose.foundation.lazy.LazyMeasuredItem
import androidx.compose.foundation.lazy.LazyMeasuredItemProvider
import androidx.compose.foundation.lazy.layout.LazyLayout
import androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScope
import androidx.compose.foundation.lazy.layout.lazyLayoutSemantics
import androidx.compose.foundation.lazy.lazyListBeyondBoundsModifier
import androidx.compose.foundation.lazy.lazyListPinningModifier
import androidx.compose.foundation.lazy.lazyListSemantics
import androidx.compose.foundation.lazy.measureLazyList
import androidx.compose.foundation.lazy.rememberLazyListItemProvider
import androidx.compose.foundation.lazy.rememberLazyListSemanticState
import androidx.compose.foundation.overscroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -83,17 +84,22 @@ internal fun ReorderingLazyList(
placementAnimator
)

val semanticState = rememberLazyListSemanticState(
reorderingState.lazyListState,
itemProvider,
reverseLayout,
isVertical
)

val orientation = if (isVertical) Orientation.Vertical else Orientation.Horizontal
LazyLayout(
modifier = modifier
.then(reorderingState.lazyListState.remeasurementModifier)
.then(reorderingState.lazyListState.awaitLayoutModifier)
.lazyListSemantics(
.lazyLayoutSemantics(
itemProvider = itemProvider,
state = reorderingState.lazyListState,
coroutineScope = reorderingState.coroutineScope,
isVertical = isVertical,
reverseScrolling = reverseLayout,
state = semanticState,
orientation = orientation,
userScrollEnabled = userScrollEnabled
)
.clipScrollableContainer(orientation)
Expand Down Expand Up @@ -191,12 +197,16 @@ private fun rememberLazyListMeasurePolicy(
val contentConstraints =
containerConstraints.offset(-totalHorizontalPadding, -totalVerticalPadding)

state.updateScrollPositionIfTheFirstItemWasMoved(itemProvider)

// Update the state's cached Density
state.density = this

// this will update the scope used by the item composables
itemProvider.itemScope.maxWidth = contentConstraints.maxWidth.toDp()
itemProvider.itemScope.maxHeight = contentConstraints.maxHeight.toDp()
itemProvider.itemScope.setMaxSize(
width = contentConstraints.maxWidth,
height = contentConstraints.maxHeight
)

val spaceBetweenItemsDp = if (isVertical) {
requireNotNull(verticalArrangement).spacing
Expand Down Expand Up @@ -265,6 +275,7 @@ private fun rememberLazyListMeasurePolicy(
mainAxisAvailableSize = mainAxisAvailableSize,
beforeContentPadding = beforeContentPadding,
afterContentPadding = afterContentPadding,
spaceBetweenItems = spaceBetweenItems,
firstVisibleItemIndex = firstVisibleItemIndex,
firstVisibleItemScrollOffset = firstVisibleScrollOffset,
scrollToBeConsumed = state.scrollToBeConsumed,
Expand Down
6 changes: 3 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ dependencyResolutionManagement {

versionCatalogs {
create("libs") {
version("kotlin", "1.7.10")
version("kotlin", "1.7.20")
plugin("kotlin-serialization","org.jetbrains.kotlin.plugin.serialization").versionRef("kotlin")

library("kotlin-coroutines","org.jetbrains.kotlinx", "kotlinx-coroutines-core").version("1.6.4")

version("compose-compiler", "1.3.0")
version("compose-compiler", "1.3.2")

version("compose", "1.3.0-alpha03")
version("compose", "1.3.0-rc01")
library("compose-foundation", "androidx.compose.foundation", "foundation").versionRef("compose")
library("compose-ui", "androidx.compose.ui", "ui").versionRef("compose")
library("compose-ui-util", "androidx.compose.ui", "ui-util").versionRef("compose")
Expand Down

0 comments on commit 400b47f

Please sign in to comment.