Status Update
Comments
jg...@google.com <jg...@google.com> #4
to...@gtempaccount.com <to...@gtempaccount.com> #5
I'm sorry that I can't give you a reliable way to replicate it, but i'm assuming it is something to do with the fact we are using nested scrolling views inside our fragment, or how we are consuming the touch events our side.
If you 'flick' the recyclerview in our fragment down, it scrolls fine. However, if you 'drag', it gets consumed by the side swipe to go to the next tab, which is not desired behaviour.
Here is an example of what is happening. If you need anymore info from me, i'm happy to provide.
jg...@google.com <jg...@google.com> #6
jg...@google.com <jg...@google.com> #7
Could you advise on your view hierarchy from RecyclerView to ViewPager2?
I've noticed this issue caused by NestedScrollView being in the way in this sample:
- No scroll orientation lock because of NestedScrollView (from
However, in a typical case, it works fine:
- Scroll orientation lock (from
jg...@google.com <jg...@google.com> #8
to...@gtempaccount.com <to...@gtempaccount.com> #9
After some investigation, it seems to be the SwipeRefreshLayout that is the culprit.
In the example that works fine that you provided me (
The heirachy in the video above for the child fragment is pretty simple
<SwipeRefreshLayout>
<ConstraintLayout>
<CustomErrorView/>
<RecyclerView/>
</ConstraintLayout>
</SwipeRefreshLayout>
I can cofirm when I remove the SwipeRefreshLayout, it works as intended.
je...@google.com <je...@google.com> #10
In this particular case, you will only need the bugfix of RecyclerView, because with this view hierarchy RV is driving the nested scroll.
In the absence of a scrolling child in SRL, you would need the bugfix of SRL.
If you have any other scrolling child in SRL, that component either already does the right thing or needs to be fixed similar to how RV was fixed. To the best of my knowledge, the most likely candidate, NestedScrollView, already does the right thing.
Original issue:
[1]
[2]
je...@google.com <je...@google.com> #11
to...@gtempaccount.com <to...@gtempaccount.com> #12
I started using both 1.1.0-beta02 for recyclerview and 1.1.0-alpha02 for swiperefreshlayout, but unfortunately, still not working.
The only way I can get scroll behaviour as predicted, is it if remove the SwipeRefreshLayout all together.
to...@gtempaccount.com <to...@gtempaccount.com> #13
jg...@google.com <jg...@google.com> #14
Probably the easiest way to do it is to modify our sample [1], but any self-contained sample that'd allow us to reproduce the issue would be great.
[1]
to...@gtempaccount.com <to...@gtempaccount.com> #15
jg...@google.com <jg...@google.com>
je...@google.com <je...@google.com>
je...@google.com <je...@google.com> #16
to...@gtempaccount.com <to...@gtempaccount.com> #17
ap...@google.com <ap...@google.com> #18
Branch: androidx-master-dev
commit 6a9efe2e5b9ad406f486b5c4999fd6c119eb59fa
Author: Jelle Fresen <jellefresen@google.com>
Date: Tue Aug 27 14:56:12 2019
Improve SwipeRefreshLayout test
Fixes/improvements in
SwipeRefreshLayoutInHorizontallyScrollingParentTest:
- Make sibling pages non-zero size
- Calculates 'gesture distance' correctly
- Accounts for touch slop when performing gesture
- Asserts that requestDisallowInterceptTouchEvent(true) is called
- Speeds up the gesture
Bug: 138314213
Test: ./gradlew swiperefreshlayout:cC
Change-Id: I00a5f73ef0c54f41034cdacd023b8348e133384c
M swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutInHorizontallyScrollingParentTest.java
M swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutInRecyclerViewActivity.java
A swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeToRefreshLayoutRequestDisallowInterceptTest.java
to...@gtempaccount.com <to...@gtempaccount.com> #19
Just to confirm, I have tried the new update (beta-04) and the issue persists.
je...@google.com <je...@google.com> #20
In the mean time, it might be possible to work around the issue by extending SwipeRefreshLayout and overriding "requestDisallowInterceptTouchEvent" with the following implementation:
@Override
public void requestDisallowInterceptTouchEvent(boolean b) {
// Ignore here, but pass it up to our parent
ViewParent parent = getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(b);
}
}
Does that solve the problem for now?
ap...@google.com <ap...@google.com> #21
Branch: androidx-master-dev
commit 6d5f435733bf7c9975d1b8064605a237fe6086a9
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Aug 23 10:53:45 2019
Don't ignore requestDisallowInterceptTouchEvent in SRL
A SwipeRefreshLayout ignored calls to requestDisallowInterceptTouchEvent
when nested scrolling was not enabled in its child, but there is no good
reason why it shouldn't propagate the call to its parents. It is OK for
SRL itself to dishonor the request, as one can always use
OnChildScrollUpCallback to control cooperation with scrolls in children.
Bug: 138314213
Test: ./gradlew swiperefreshlayout:cC
Change-Id: I4959df942ebb2097f3c3ebe39ff0582f6ae6f395
M swiperefreshlayout/api/1.1.0-alpha03.txt
M swiperefreshlayout/api/current.txt
M swiperefreshlayout/api/public_plus_experimental_1.1.0-alpha03.txt
M swiperefreshlayout/api/public_plus_experimental_current.txt
M swiperefreshlayout/api/restricted_1.1.0-alpha03.txt
M swiperefreshlayout/api/restricted_current.txt
M swiperefreshlayout/build.gradle
M swiperefreshlayout/src/androidTest/AndroidManifest.xml
A swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/RequestDisallowInterceptRecordingRecyclerView.java
M swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutInRecyclerViewBaseActivity.java
A swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutInRecyclerViewWithRecyclerViewChildActivity.java
A swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutInRecyclerViewWithSimpleChildActivity.java
A swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutInScrollingParentAndChildTest.java
M swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutInScrollingParentBaseTest.java
A swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutInScrollingParentTest.java
A swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutRequestDisallowInterceptAsChildAndParentTest.java
A swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutRequestDisallowInterceptAsChildTest.java
M swiperefreshlayout/src/androidTest/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayoutRequestDisallowInterceptBaseTest.java
M swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayout.java
je...@google.com <je...@google.com> #22
ji...@careem.com <ji...@careem.com> #23
<swiperefreshlayout>
<recycler>
</swiperefreshlayout>
still getting this error
ji...@careem.com <ji...@careem.com> #24
je...@google.com <je...@google.com> #25
I think you ran into
c....@gmail.com <c....@gmail.com> #26
ContainerFragment;
<androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.tabs.TabLayout/>
<androidx.viewpager2.widget.ViewPager2/>
</androidx.constraintlayout.widget.ConstraintLayout>
InnerFragment;
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<FrameLayout android:nestedScrollingEnabled="true">
<androidx.recyclerview.widget.RecyclerView/>
</FrameLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
constraintLayoutVersion = "1.1.3"
viewPager2 = "1.1.0-alpha01"
swipeRefreshLayoutVersion = "1.2.0-alpha01"
recyclerViewVersion = "1.2.0-alpha05"
je...@google.com <je...@google.com> #27
I'm having trouble understanding the video. Maybe you could record it again, going a bit slower than this? In particular, I can't work out if the list is scrolling up or down because the scrolls happen at a high speed and follow each other in rapid succession; I can't work out the used gestures because the contact time with the screen is very short; and consequently I wasn't able to see the occurrence of the bug. It will also be helpful to turn on the debug option "Pointer location" (next to "Show taps", which I see you already turned on) so it's easier to work out what gestures you make while reproducing the issue.
Description
I am afraid a sample will not explain this. However, ViewPager2 seems to be more sensitive (compared to ViewPager) to small variations while scrolling a RecyclerView that is in a Fragment that is part of ViewPager2.
I have started to new project and implemented ViewPager2. It does not feel natural when scrolling a page up or down. It changes tabs when there is a small left or right drag in your pull.
I have implement same project with original ViewPager it is more natural, it does not switch tabs unless you pull left or Right.
While it was really bad in 1.0.0-alpha06, it did get better in 1.0.0-beta02