Status Update
Comments
an...@google.com <an...@google.com>
re...@gmail.com <re...@gmail.com> #2
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
mb...@gmail.com <mb...@gmail.com> #3
an...@google.com <an...@google.com> #4
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
re...@gmail.com <re...@gmail.com> #5
Thanks for the workaround.
I guess it's worth to override onPreFling
as well, otherwise any interaction with the list while the scroll is disabled will cause it to scroll when it is enabled again (if done fast by the user).
Example:
LazyColumn(
content = content,
state = state,
modifier = Modifier
.then(
if (!expanded) Modifier.disableVerticalPointerInputScroll() else Modifier
)
)
Fixed workaround:
private val VerticalScrollConsumer = object : NestedScrollConnection {
override fun onPreScroll(available: Offset, source: NestedScrollSource) = available.copy(x = 0f)
override suspend fun onPreFling(available: Velocity) = available.copy(x = 0f)
}
private val HorizontalScrollConsumer = object : NestedScrollConnection {
override fun onPreScroll(available: Offset, source: NestedScrollSource) = available.copy(y = 0f)
override suspend fun onPreFling(available: Velocity) = available.copy(y = 0f)
}
fun Modifier.disableVerticalPointerInputScroll() = this.nestedScroll(VerticalScrollConsumer)
fun Modifier.disableHorizontalPointerInputScroll() = this.nestedScroll(HorizontalScrollConsumer)
ma...@gmail.com <ma...@gmail.com> #6
This workaround still consumes the touches, so it is not available for some use cases (we have an overlay transparent LazyList that is moving over some other elements. We want this LazyList to not react to touches, but we also want touches to reach those element behind the list).
From what I see, there is no simple workaround for that.
What I would do is expose scrollEnabled
boolean on both LazyRow and LazyColumn that would be forwarded to the enabled
parameter of the Modifier.scrollable call inside LazyList method (which is currently always set to true). I can make a PR for that if Google accepts this.
an...@google.com <an...@google.com> #7
ap...@google.com <ap...@google.com> #8
Branch: androidx-main
commit f83773fff21e6a3c91bc665b06de2b3957d3339a
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Wed Dec 15 20:19:16 2021
Add userScrollEnabled param for LazyColumn, LazyRow and LazyVerticalGrid
Relnote: New parameter `userScrollEnabled` was added to LazyColumn, LazyRow and LazyVerticalGrid in order to allow temporary or permanently disable the user initiated scroll via touch gestures or accessibility actions. Doing scroll programmatically via the methods on the state will still be allowed.
Fixes: 201150093
Test: new tests for lazy lists and grids
Change-Id: I7eae94b090ffc56269faea51ce84fe36b0ba9ae5
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListTest.kt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyGrid.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/list/LazyList.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyDsl.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/list/LazySemantics.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/BaseLazyListTestWithOrientation.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyGridTest.kt
fr...@hotmail.com <fr...@hotmail.com> #9
as...@gmail.com <as...@gmail.com> #10
Just want to say that ScrollLayoutModifier
still calls constraints.assertNotNestingScrollableContainers(isVertical)
every time from what I see.
This means putting a LazyList
composable in a scrollable layout will still cause a crash.
an...@google.com <an...@google.com> #11
Nesting scrollable in the same direction containers is still not allowed, it can't work efficiently.
What was done as part of this bug is now you can disable the scroll triggered by the user gestures for LazyColumn. LazyColumn is still scrollable, you can scroll it programmatically via the methods on LazyListState
vi...@gmail.com <vi...@gmail.com> #12
an...@google.com <an...@google.com> #13
af...@gmail.com <af...@gmail.com> #14
Could we please also add support to ignore hardware arrow keys when userScrollEnabled
is set to false?
an...@google.com <an...@google.com> #15
Could you please file a separate feature request? Thanks
ma...@gmail.com <ma...@gmail.com> #16
userScrollEnabled
does not appear to work as described. It will still eat scroll events, preventing them from reaching composables behind it.
Here is a demo composable:
Box {
LazyRow() {
items(20) {
Box(
Modifier
.size(200.dp, 200.dp)
.padding(end = 32.dp)
.background(Color.Green))
}
}
LazyRow(modifier = Modifier.padding(top = 100.dp), userScrollEnabled = false) {
items(20) {
Box(
Modifier
.size(200.dp, 200.dp)
.padding(end = 32.dp)
.background(Color.Red.copy(alpha = 0.5f)))
}
}
}
With compose 1.2.0-alpha07
, you cannot scroll the top list by scrolling in the middle (where bottom list overlaps it), even though bottom list has scroll disabled.
Description
I need possibility to disable
LazyColumn
scrolling, and scroll it programmatically, like to sync it with some other scrollable view.scrollable
modifier hasenabled
parameter, and asLazyList
is using it underneath, it should be quite simple to add same parameter toLazyColumn
andLazyRow
.