Fixed
Status Update
Comments
jb...@google.com <jb...@google.com> #2
Nested scrolling works partially (as per http://b/122818889 ). Let's discuss if we need full support and if so make sure it works.
[Deleted User] <[Deleted User]> #3
Hi!
What is 'partially' exactly?
How do I see it?
Thanks!
What is 'partially' exactly?
How do I see it?
Thanks!
il...@google.com <il...@google.com>
jb...@google.com <jb...@google.com> #4
As of now:
- Nesting scroll views with a scroll direction perpendicular to the ViewPager2's orientation inside ViewPager2 works
- Nesting scroll views with a scroll direction parallel to the ViewPager2's orientation inside ViewPager2 does not work
- Nesting scroll views with a scroll direction perpendicular to the ViewPager2's orientation inside ViewPager2 works
- Nesting scroll views with a scroll direction parallel to the ViewPager2's orientation inside ViewPager2 does not work
ap...@google.com <ap...@google.com> #5
Horizontal ViewPager2 not correctly working into a vertical RecyclerView
Set a setNestedScrollingEnabled to the RecyclerView into the ViewPager2 (across reflection) resolves the problem
Set a setNestedScrollingEnabled to the RecyclerView into the ViewPager2 (across reflection) resolves the problem
il...@google.com <il...@google.com> #6
ageevvalentin@gmail.com, could you provide a sample app? I'd like to learn more about the circumstances that cause the problem; putting a clean ViewPager2 inside a clean RecyclerView seems to work fine, so there must be other factors involved.
pr...@google.com <pr...@google.com> #7
Added a patch for androidx-master-dev that demos a horizontal ViewPager2 inside a vertical RecyclerView.
Verified that it works correctly on a:
- Nexus 4 emulator with API 17
- Nexus 5X emulator with API 28
- Pixel 2 device with API 29
To reproduce:
- Check out the Android Jetpack source (at commit 256899f482ff85cddfb050f37550be7b5ec927ef) (see steps in [1])
- Apply the patch (`git apply 0001-Add-sample-where-a-horizontal-ViewPager2-is-nested-i.patch`)
- Build and install viewpager2's integration-tests app: `./gradlew viewpager2:integration-tests:testapp:installDebug`
- Run it
Closing the issue for now, but please reopen if you have a minimal reproduction app
[1]https://android.googlesource.com/platform/frameworks/support/+/256899f482ff85cddfb050f37550be7b5ec927ef
Verified that it works correctly on a:
- Nexus 4 emulator with API 17
- Nexus 5X emulator with API 28
- Pixel 2 device with API 29
To reproduce:
- Check out the Android Jetpack source (at commit 256899f482ff85cddfb050f37550be7b5ec927ef) (see steps in [1])
- Apply the patch (`git apply 0001-Add-sample-where-a-horizontal-ViewPager2-is-nested-i.patch`)
- Build and install viewpager2's integration-tests app: `./gradlew viewpager2:integration-tests:testapp:installDebug`
- Run it
Closing the issue for now, but please reopen if you have a minimal reproduction app
[1]
an...@daresay.co <an...@daresay.co> #8
Comment has been deleted.
li...@gmail.com <li...@gmail.com> #9
Any progress on this? (only talking about the "same scroll direction" issue)
I searched a lot for workarounds on Google and SO, but it seems no one really found a suitable solution yet.
The thing is that all other VerticalViewPagers out there have other problems that are similarly annoying. Most of them revolve around touch issues like "What's a click and what's a swipe" or "what's the fling threshold to snap to the next page".
So if someone knows of a working sample of VerticalViewPagers, I'd be happy to see a link :)
I searched a lot for workarounds on Google and SO, but it seems no one really found a suitable solution yet.
The thing is that all other VerticalViewPagers out there have other problems that are similarly annoying. Most of them revolve around touch issues like "What's a click and what's a swipe" or "what's the fling threshold to snap to the next page".
So if someone knows of a working sample of VerticalViewPagers, I'd be happy to see a link :)
ho...@gmail.com <ho...@gmail.com> #10
Comment has been deleted.
ho...@gmail.com <ho...@gmail.com> #11
Comment has been deleted.
ho...@gmail.com <ho...@gmail.com> #12
That'd be great, much appreciated!
gi...@gmail.com <gi...@gmail.com> #13
So...I was too stupid to understand the back and forth and up and down of NestedScrollingParent and NestedScrollingChild/NestedScrollingChild2 and NestedScrollingParentHelper and NestedScrollingChildHelper
But I figured out another way to achieve the same goal. I attached a demo project with the following setup:
1. A parent RecyclerView with PagerSnapHelper:
This vertical RecyclerView has two items/pages.
The upper page is just a simple TextView.
The lower page contains the nested RecyclerView.
Both pages are Fragments if that is of any concern.
2. A PagingLinearLayoutManager:
This is a LinearLayoutManager with the capability to enable/disable scrolling.
It is used for the parent RecyclerView.
3. A OnItemTouchListener:
This is also used for the parent RecyclerView.
It saved the initial y coordinate on ACTION_DOWN
During ACTION_MOVE event, it decides whether the PagingLinearLayoutManager is allowed to scroll (i.e. to switch between pages)
The important parts of the code are commented. Hope this helps someone else!
But I figured out another way to achieve the same goal. I attached a demo project with the following setup:
1. A parent RecyclerView with PagerSnapHelper:
This vertical RecyclerView has two items/pages.
The upper page is just a simple TextView.
The lower page contains the nested RecyclerView.
Both pages are Fragments if that is of any concern.
2. A PagingLinearLayoutManager:
This is a LinearLayoutManager with the capability to enable/disable scrolling.
It is used for the parent RecyclerView.
3. A OnItemTouchListener:
This is also used for the parent RecyclerView.
It saved the initial y coordinate on ACTION_DOWN
During ACTION_MOVE event, it decides whether the PagingLinearLayoutManager is allowed to scroll (i.e. to switch between pages)
The important parts of the code are commented. Hope this helps someone else!
va...@zedge.net <va...@zedge.net> #14
Same promble
ja...@gopuff.com <ja...@gopuff.com> #16
I'm a bit skeptical about the suggested solution from comment#15 that modifies the touch slop.
We're working on a solution that'll work reliably with ViewPager2 1.0. Seehttps://r.android.com/1131083 .
Not finalized at the time of writing, but might help some people already. Notice NestedScrollableHostLayout wrapping [1] a scrollable child.
[1]https://r.android.com/c/platform/frameworks/support/+/1131083/4/viewpager2/integration-tests/testapp/src/main/res/layout/item_horizontal_rvs.xml#55
We're working on a solution that'll work reliably with ViewPager2 1.0. See
Not finalized at the time of writing, but might help some people already. Notice NestedScrollableHostLayout wrapping [1] a scrollable child.
[1]
ja...@sense.com <ja...@sense.com> #17
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 1316417bc87741ea9f739a453eb9e792512c9651
Author: Jelle Fresen <jellefresen@google.com>
Date: Tue Oct 01 16:58:57 2019
Add sample of nested scrolling in ViewPager2
This shows how nested scrolling can be achieved in ViewPager2. Every
child on a page that scrolls in the same direction as ViewPager2 must be
wrapped by a NestedScrollableHostLayout, and one must make sure that the
scrollable child implements canScrollHorizontally/Vertically in order
for this to work.
Bug: 123006042
Test: Manual, run ViewPager2 demo app
Change-Id: I79e24b7668cf7ff5c05c350ea3ab9134dd74b3a4
M viewpager2/integration-tests/testapp/src/main/AndroidManifest.xml
M viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/BrowseActivity.kt
A viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/NestedScrollableHost.kt
A viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/ParallelNestedScrollingActivity.kt
A viewpager2/integration-tests/testapp/src/main/res/layout/item_nested_recyclerviews.xml
M viewpager2/integration-tests/testapp/src/main/res/values/colors.xml
M viewpager2/integration-tests/testapp/src/main/res/values/strings.xml
https://android-review.googlesource.com/1131083
https://goto.google.com/android-sha1/1316417bc87741ea9f739a453eb9e792512c9651
Branch: androidx-master-dev
commit 1316417bc87741ea9f739a453eb9e792512c9651
Author: Jelle Fresen <jellefresen@google.com>
Date: Tue Oct 01 16:58:57 2019
Add sample of nested scrolling in ViewPager2
This shows how nested scrolling can be achieved in ViewPager2. Every
child on a page that scrolls in the same direction as ViewPager2 must be
wrapped by a NestedScrollableHostLayout, and one must make sure that the
scrollable child implements canScrollHorizontally/Vertically in order
for this to work.
Bug: 123006042
Test: Manual, run ViewPager2 demo app
Change-Id: I79e24b7668cf7ff5c05c350ea3ab9134dd74b3a4
M viewpager2/integration-tests/testapp/src/main/AndroidManifest.xml
M viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/BrowseActivity.kt
A viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/NestedScrollableHost.kt
A viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/ParallelNestedScrollingActivity.kt
A viewpager2/integration-tests/testapp/src/main/res/layout/item_nested_recyclerviews.xml
M viewpager2/integration-tests/testapp/src/main/res/values/colors.xml
M viewpager2/integration-tests/testapp/src/main/res/values/strings.xml
Description
Versions
Component used: Navigation
Version used: 2.5.3
Devices/Android versions reproduced on: any
Description
According to the documentation of [BackHandler], nested BackHandlers(https://developer.android.com/reference/kotlin/androidx/activity/compose/package-summary#top-level-functions ) should take priority:
However, this doesn't work correctly if the activity is paused and then resumed.
Steps to reproduce
Code to demonstrate the issue
A sample project is attached.