Status Update
Comments
st...@google.com <st...@google.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
fe...@gmail.com <fe...@gmail.com> #3
st...@google.com <st...@google.com>
st...@google.com <st...@google.com>
ss...@google.com <ss...@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
fe...@gmail.com <fe...@gmail.com> #5
st...@google.com <st...@google.com> #6
I'll have a look in this sprint, sorry for the slow response.
st...@google.com <st...@google.com> #7
I wrote a simple repro of this:
A couple of observations:
- it occurs with Pager + LazyColumn as well as Pager + ScalingLazyColumn (so isn't Wear specific)
- if you delay clicking/scrolling, then the UI does respond to the clicks first time. Could be that there's a Pager animation running on the main thread that's blocking the gestures.
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun PagerWithIndicator(swipeState: SwipeToDismissBoxState) {
val pagesCount = 3
val pagerState = rememberPagerState { pagesCount }
var background by remember { mutableStateOf(Color.Black) }
var selectedPage by remember { mutableIntStateOf(0) }
val animatedSelectedPage by animateFloatAsState(
targetValue = pagerState.targetPage.toFloat(), label = "page-indicator",
) {
selectedPage = it.toInt()
}
val pageIndicatorState: PageIndicatorState = remember {
object : PageIndicatorState {
override val pageOffset: Float
get() = animatedSelectedPage - selectedPage
override val selectedPage: Int
get() = selectedPage
override val pageCount: Int
get() = pagesCount
}
}
Box(modifier = Modifier.background(background)) {
HorizontalPager(
modifier = Modifier.fillMaxSize().edgeSwipeToDismiss(swipeState),
state = pagerState,
) {page ->
val scrollState = rememberScalingLazyListState()
ScalingLazyColumn(
// val scrollState = rememberLazyListState()
// LazyColumn(
state = scrollState,
modifier = Modifier.fillMaxWidth()
) {
item {
ListHeader { Text("Page $page") }
}
items(4) {
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) {
Chip(
onClick = {
background =
if (background == Color.Black) Color.DarkGray else Color.Black
},
label = {
Text(text = "Click", color = Color.Black)
}
)
}
}
}
}
HorizontalPageIndicator(
pageIndicatorState = pageIndicatorState,
)
}
}
st...@google.com <st...@google.com> #8
As a workaround, it's possible to use pagerState.isScrollInProgress to determine whether the UI is ready to receive clicks. In my repro, I disabled the buttons until the scroll was complete:
Alternatively, you could experiment with the fling behavior, as the defaults do seem to take longer to settle that I'd expect -
For example, I've just tried setting HorizontalPager(state = pagerState, flingBehavior = PagerDefaults.flingBehavior(pagerState, snapAnimationSpec = tween(150, 0)))
and that eliminates the wait in my demo between the scroll visibly finishing and the buttons being re-enabled.
You could also try Horologists HorizontalPagerDefaults.flingBehavior, but I think that still takes a little too long for the scroll to finish.
st...@google.com <st...@google.com> #9
From discussions,
Meanwhile, please try the workaround to reduce the duration of the fling animation spec suggested in
st...@google.com <st...@google.com> #10
This is a screencast with PagerDefaults.flingBehavior(pagerState, snapAnimationSpec = tween(150, 0))
ys...@google.com <ys...@google.com> #11
Does this have some noticeable impact in some edge cases? Does it look jarring if you cross the snap threshold but the page is in the middle?
Basically, what's the down side?
Overall, this looks great to me.
st...@google.com <st...@google.com> #12
Thanks Yuri - here's a screencast of edge-case snapping, still looks ok IMO:
pe...@google.com <pe...@google.com> #13
would be great to test this on device, do we have an apk?
ap...@google.com <ap...@google.com> #14
Branch: androidx-main
commit f7ffa0cda0ccd10700ab00ac30ef57003077173a
Author: stevebower <stevebower@google.com>
Date: Tue Dec 12 12:33:58 2023
Update HorizontalPager demo to show ScalingLazyColumn with custom animation spec
Test: N/A
Bug: 303807950
Relnote: N/A
Change-Id: I9dc060b0cc5120dbff11b4d68f94375ed5430a35
M wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/HorizontalPageIndicatorDemo.kt
M wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/MaterialDemos.kt
pe...@google.com <pe...@google.com> #15
Tested on device and looks good from UX side
st...@google.com <st...@google.com> #16
Made an update to horologist to recommend PagerDefaults.flingBehavior(pagerState, snapAnimationSpec = tween(150, 0))
in
fe...@gmail.com <fe...@gmail.com> #17
fe...@gmail.com <fe...@gmail.com> #18
ref:
st...@google.com <st...@google.com> #19
Nothing seems obviously wrong. This is our demo, which definitely allows the user to tap first time:
@Composable
fun PagerWithIndicator(swipeState: SwipeToDismissBoxState) {
val pagesCount = 3
val pagerState = rememberPagerState { pagesCount }
var background by remember { mutableStateOf(Color.Black) }
var selectedPage by remember { mutableIntStateOf(0) }
val animatedSelectedPage by animateFloatAsState(
targetValue = pagerState.targetPage.toFloat(), label = "page-indicator",
) {
selectedPage = it.toInt()
}
val pageIndicatorState: PageIndicatorState = remember {
object : PageIndicatorState {
override val pageOffset: Float
get() = animatedSelectedPage - selectedPage
override val selectedPage: Int
get() = selectedPage
override val pageCount: Int
get() = pagesCount
}
}
Box(modifier = Modifier.background(background)) {
HorizontalPager(
modifier = Modifier.fillMaxSize().edgeSwipeToDismiss(swipeState),
state = pagerState,
flingBehavior =
PagerDefaults.flingBehavior(
pagerState,
snapAnimationSpec = tween(150, 0),
)
) { page ->
val scrollState = rememberScalingLazyListState()
ScalingLazyColumn(
state = scrollState,
modifier = Modifier.fillMaxWidth()
) {
item {
ListHeader { Text("Page $page") }
}
items(4) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.Center
) {
Chip(
onClick = {
background =
if (background == Color.Black) Color.DarkGray else Color.Black
},
label = {
Text(text = "Click", color = Color.Black)
},
enabled = !pagerState.isScrollInProgress
)
}
}
}
}
HorizontalPageIndicator(
pageIndicatorState = pageIndicatorState,
)
}
}
fe...@gmail.com <fe...@gmail.com> #20
I tried your code, but it keeps crashing after a swipe (to change page).
FATAL EXCEPTION: main
Process: com.feduss.horizontalpagerbug, PID: 6215
java.lang.IllegalStateException: The offset was read before being initialized. Did you access the offset in a phase before layout, like effects or composition?
at androidx.wear.compose.foundation.SwipeableV2State.requireOffset(SwipeableV2.kt:299)
at androidx.wear.compose.foundation.SwipeableV2State.settle(SwipeableV2.kt:457)
at androidx.wear.compose.foundation.SwipeToDismissBoxState$Companion$edgeNestedScrollConnection$1.onPostFling-RZ2iAVY(BasicSwipeToDismissBox.kt:380)
at androidx.compose.ui.input.nestedscroll.NestedScrollNode.onPostFling-RZ2iAVY(NestedScrollNode.kt:105)
at androidx.compose.ui.input.nestedscroll.NestedScrollDispatcher.dispatchPostFling-RZ2iAVY(NestedScrollModifier.kt:221)
at androidx.compose.foundation.gestures.ScrollingLogic$onDragStopped$performFling$1.invokeSuspend(Scrollable.kt:810)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.UndispatchedCoroutine.afterResume(CoroutineContext.kt:270)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:57)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@133984, androidx.compose.runtime.BroadcastFrameClock@3cde56d, StandaloneCoroutine{Cancelling}@9e015a2, AndroidUiDispatcher@84cc233]
---------------------------------
implementation ("androidx.wear.compose:compose-ui-tooling:1.3.0-beta02")
implementation("androidx.wear.compose:compose-foundation:1.3.0-beta02")
implementation("androidx.wear.compose:compose-material:1.3.0-beta02")
implementation("androidx.wear.compose:compose-navigation:1.3.0-beta02")
I also tested with latest stable version 1.2.1, and i got the same error.
st...@google.com <st...@google.com>
ag...@google.com <ag...@google.com>
st...@google.com <st...@google.com>
le...@google.com <le...@google.com> #21
Project: platform/frameworks/support Branch: androidx-main
commit 418f3a6588d2384e49d996cebcb2d5678ceeb3ea
Author: Levi Albuquerque
Click on moving list initial issue
Due to an early fix we were prioritizing continuing the scroll of nested lists in any direction when taping on a parent list. The actual intended behavior was to consider nested children that scroll -on the same direction- if the click happened on the said child. In this CL I'm reverting those changes as we will revisit the nested scrolling UX and there will be more benefits to having the original behavior without the issues the fix introduced.
Test: Added test to check behavior.
Relnote: N/A
Fixes: 293777304
Fixes: 289685606
Fixes: 296064317
Bug: 175010956
Bug: 179417109
Change-Id: Ia71ed02e06603c6c27ad4648cfc8e32587397d63
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/ScrollableTest.kt M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
le...@google.com <le...@google.com> #22
Hey @stevebower @pedrobatista could you verify if this fixes the issue for wear foundation? Thanks!
st...@google.com <st...@google.com> #23
Ok, I'll take a look at this.
st...@google.com <st...@google.com> #24
Still not fixed, if we remove our custom animation override, the pager takes a while to settle:
(edited to upload a gif for ease of reference)
st...@google.com <st...@google.com>
le...@google.com <le...@google.com> #25
Hi @stevebower just bringing the chat conversation we've had to this bug for visibility. In order to update the behavior in Foundation Pager with some good default spring animation (that also works for wear devices) we need wear compose to provide a good visibility threshold to be used here.
st...@google.com <st...@google.com>
ap...@google.com <ap...@google.com> #26
Branch: androidx-main
commit 1f395a390184dad8164957e44bfc1483ffe3f53e
Author: Levi Albuquerque <levima@google.com>
Date: Thu May 09 09:28:40 2024
Improve Pager default snapping animation.
Specifying a visibility threshold for Pager improves the alignment of the visual representation of the end of a snapping operation with the actual PagerState interpretation of a scrolling Pager. It takes now twice less time between the time the Pager "looks settled" with the indication that it stopped scrolling "isScrollInProgress=false" which should signal to the user that they can interact with the screen.
Test: Previous tests should pass.
Fixes: 338710348
Bug: 303807950
Relnote: N/A
Change-Id: I9627a48d53604a0919951fa4dbb74717ba30bd28
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/Pager.kt
ak...@google.com <ak...@google.com>
ap...@google.com <ap...@google.com> #27
Project: platform/frameworks/support
Branch: androidx-main
Author: Aman Khosa <
Link:
Change Wear Compose foundation pager snapAnimationSpec
Expand for full commit details
Change Wear Compose foundation pager snapAnimationSpec
Currently the snapAnimationSpec is set to a tween with a duration
of 150ms. This was set to ensure the Pager settles quickly so that
contents are focused and clickable, see b/345191109.
However a tween animation causes an ugly double jump when flinging
fast to the top or bottom of a SLC inside of a VerticalPager, see
b/349781047.
Changing to a Spring animation with no bounciness and high
stiffness achieves the same behaviour of settling quickly, and
avoids the double jump. Added a test to ensure this is the case.
Bug: 303807950
Bug: 345191109
Bug: 350466286
Bug: 349781047
Test: Added test case to PagerTest.kt
Change-Id: I9bfefca9998e856279d63d2595f3bed0d67639bb
Files:
- M
wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/PagerTest.kt
- M
wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/pager/Pager.kt
Hash: 335faecba455a29d7a21c5e369b7c95ee4a5c1ce
Date: Thu Oct 24 12:42:02 2024
ak...@google.com <ak...@google.com> #28
Please use the Wear HorizontalPager component which settles with a faster animation than the default Compose Foundation HorizontalPager.
gr...@google.com <gr...@google.com> #29
ap...@google.com <ap...@google.com> #30
Project: platform/frameworks/support
Branch: androidx-main
Author: Aman Khosa <
Link:
Change Wear foundation pager snapAnimationSpec
Expand for full commit details
Change Wear foundation pager snapAnimationSpec
Currently the snapAnimationSpec is set to a tween with a duration
of 150ms. This was set to ensure the Pager settles quickly so that
contents are focused and clickable, see b/345191109.
However a tween animation causes an ugly double jump when flinging
fast to the top or bottom of a SLC inside of a VerticalPager, see
b/349781047.
Changing to a Spring animation with no bounciness and high
stiffness achieves the same behaviour of settling quickly, and
avoids the double jump. Added a test to ensure this is the case.
Test to ensure the Pager settles quickly can be ran locally.
Bug: 303807950
Bug: 345191109
Bug: 350466286
Bug: 349781047
Test: Added test case to PagerTest.kt
Relnote: "Change pager snapAnimationSpec from Tween to Spring"
Change-Id: I10d0275b7f3b957af279893d2ed52d63e42b8115
Files:
- M
wear/compose/compose-foundation/api/current.txt
- M
wear/compose/compose-foundation/api/restricted_current.txt
- M
wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/PagerTest.kt
- M
wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/pager/Pager.kt
Hash: 2850a0327fe61851a8f53f70add7b5a0e3b11228
Date: Thu Oct 24 12:42:02 2024
gr...@google.com <gr...@google.com> #31
na...@google.com <na...@google.com> #32
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.wear.compose:compose-foundation:1.5.0-alpha06
Description
Version used: horologist 0.5.7 (Wear Compose 1.3 alpha)...the bug is compose 1.2 stable (horologist v.0.4.x)
Devices/Android versions reproduced on: wear os emulator (sdk 26, 30 and 33)
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue. -->
- A screenrecord or screenshots showing the issue (if UI related). --> See the attachment
Description:
I have a pagerscreen with 4 pages, 3 of those have a scaling lazy column.
I manually implemented 3 differents column state to maintain the scroll state, but i have a focus problem.
In particular, when i switch page with an horizontal swipe, the elements in the page are tappable only after a vertical scroll instead of with the first tap on screen.