@@ -92,17 +92,17 @@ class DuckDuckGoWebView : WebView, NestedScrollingChild {
92
92
93
93
returnValue = super .onTouchEvent(event)
94
94
95
- if (scrollY == 0 && lastClampedTopY) {
96
- // we have reached the top and are clamped -> enable swipeRefresh (by default always disabled)
97
- enableSwipeRefresh(true )
98
-
99
- stopNestedScroll()
100
- } else if (dispatchNestedScroll(0 , scrollOffset[1 ], 0 , deltaY, scrollOffset)) {
95
+ if (dispatchNestedScroll(0 , scrollOffset[1 ], 0 , deltaY, scrollOffset)) {
101
96
event.offsetLocation(0f , scrollOffset[1 ].toFloat())
102
97
nestedOffsetY + = scrollOffset[1 ]
103
98
lastY - = scrollOffset[1 ]
104
99
}
105
100
101
+ if (scrollY == 0 && lastClampedTopY && nestedOffsetY == 0 ) {
102
+ // we have reached the top, are clamped vertically and nestedScrollY is done too -> enable swipeRefresh (by default always disabled)
103
+ enableSwipeRefresh(true )
104
+ }
105
+
106
106
lastDeltaY = deltaY
107
107
}
108
108
@@ -153,7 +153,7 @@ class DuckDuckGoWebView : WebView, NestedScrollingChild {
153
153
override fun onOverScrolled (scrollX : Int , scrollY : Int , clampedX : Boolean , clampedY : Boolean ) {
154
154
// taking into account lastDeltaY since we are only interested whether we clamped at the top
155
155
lastClampedTopY = clampedY && lastDeltaY <= 0
156
- enableSwipeRefresh(clampedY && scrollY == 0 )
156
+ enableSwipeRefresh(clampedY && scrollY == 0 && (lastDeltaY <= 0 || nestedOffsetY == 0 ) )
157
157
super .onOverScrolled(scrollX, scrollY, clampedX, clampedY)
158
158
}
159
159
0 commit comments