Status Update
Comments
lp...@google.com <lp...@google.com>
le...@google.com <le...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
Author: Louis Pullen-Freilich <
Link:
Adds OverscrollEffect#withoutDrawing and OverscrollEffect#withoutEventHandling
Expand for full commit details
Adds OverscrollEffect#withoutDrawing and OverscrollEffect#withoutEventHandling
These APIs allow overscroll to have events dispatched to it by one component, and rendered in a separate component.
Fixes: b/266550551
Fixes: b/204650733
Fixes: b/255554340
Fixes: b/229537244
Test: OverscrollTest
Relnote: "Adds OverscrollEffect#withoutDrawing and OverscrollEffect#withoutEventHandling APIs - these APIs create a wrapped instance of the provided overscroll effect that doesn't draw / handle events respectively, which allows for rendering overscroll in a separate component from the component that is dispatching events. For example, disabling drawing the overscroll inside a lazy list, and then drawing the overscroll separately on top / elsewhere."
Change-Id: Idbb3d91546b49c1987a041f959bce4b2b09a9f61
Files:
- M
compose/foundation/foundation/api/current.txt
- M
compose/foundation/foundation/api/restricted_current.txt
- M
compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/OverscrollDemo.kt
- M
compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/OverscrollSample.kt
- M
compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/OverscrollTest.kt
- M
compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Overscroll.kt
Hash: f64e25b7a473c757d080521e7dd97b3f6670f60d
Date: Fri Nov 01 18:43:56 2024
ad...@decathlon.com <ad...@decathlon.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.8.0-alpha06
androidx.compose.foundation:foundation-android:1.8.0-alpha06
androidx.compose.foundation:foundation-jvmstubs:1.8.0-alpha06
androidx.compose.foundation:foundation-linuxx64stubs:1.8.0-alpha06
le...@google.com <le...@google.com> #4
Hey, thanks for reporting. Yeah, I agree that the documentation for beyondBoundsPageCount is a bit confusing and it doesn't make it clear that some pages may be composed due to another mechanism (the prefetcher), we'll update that.
You can think of beyondBoundsPageCount as a guarantee that the given number of pages will be composed on both sides of the active page no matter if the pager is scrolling or stopped. In the meantime, the prefetching mechanism will do prefetching only on scroll (either gesture or animated) on the direction of the scroll.
Unfortunately there isn't an API yet for changing the way the prefetcher works, but we'll consider your use case and maybe we can improve how we're doing it right now. The first issue you reported is expected and it's similar to how ViewPager2 works, if you're at page 0 and start scrolling towards page 1, you'll see page 2 being composed; the second issue however is not.
ad...@decathlon.com <ad...@decathlon.com> #5
You're right for the first issue behavior, it works like ViewPager2, and I hopped that Compose will fixed this 😅 ..
le...@google.com <le...@google.com>
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit 8c5fbba1fe78ac9d1e7752eae7839d4e661be075
Author: Shahd AbuDaghash <shahddaghash@google.com>
Date: Fri Jul 14 16:14:07 2023
Update behavior of prefetcher.
Changed the behavior of the prefetcher not to perform prefetching as the page bounces back when the scrolling operation does not exceed the threshold to move to the next or previous screens. The condition is if the animator scrolling direction is the same as the direction of the pointer gesture, only then prefetching is performed.
Bug: 289088847
Test: Added test to verify behavior.
Change-Id: Ic742d3276d443948b76874ae04671b9b024609ad
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerGestureTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerPrefetcherTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit 62b37f3a7b291b9fe74d72f025788671a2dbadb6
Author: Shahd AbuDaghash <shahddaghash@google.com>
Date: Fri Jul 28 17:30:44 2023
Update Pager prefetching behavior to match ViewPager2
The number of pages retained when using ViewPager2 was different from Pager in Compose. Therefore, the number of prefetched pages in Pager was updated to match the behavior in Views. Also, the documentation was fixed to make it clear that there will be pages automatically pre-fetched more than specified in beyondBoundsPageCount.
Fixes: 289088847
Test: Fixed previous tests that were affected by the change.
Relnote: Fixed an issue where the prefetching in Pager did not match the behavior in Views.
Change-Id: I93352e6de29fa8bc23b3af7516872d3e2da7ce0e
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/BasePagerTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PageSizeTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerAccessibilityTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerOffscreenPageLimitPlacingTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerPrefetcherTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutPager.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/Pager.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerLayoutInfo.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasure.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasureResult.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt
na...@google.com <na...@google.com> #8
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.6.0-alpha03
androidx.compose.foundation:foundation-android:1.6.0-alpha03
Description
Jetpack Compose version: androidx.compose:compose-bom:2023.06.01
Jetpack Compose component(s) used: HorizontalPager
Android Studio Build: Build #AI-222.4459.24.2221.10121639, built on May 12, 2023
Kotlin version: 1.8.21
Steps to Reproduce or Code Sample to Reproduce:
Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { // Display 10 items val pagerState = rememberPagerState() HorizontalPager( state = pagerState, pageCount = 5, beyondBoundsPageCount = 0 ) { page -> // Our page content Column(Modifier.fillMaxSize()) { Log.d("TOTO", "Page load :${page + 1}") Text( text = "Page: $page", modifier = Modifier.fillMaxWidth() ) } } }
On load, only first page is displayed -> OK.
first wrong behavior :
second wrong behavior