@@ -92,17 +92,17 @@ class DuckDuckGoWebView : WebView, NestedScrollingChild {
9292
9393 returnValue = super .onTouchEvent(event)
9494
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)) {
10196 event.offsetLocation(0f , scrollOffset[1 ].toFloat())
10297 nestedOffsetY + = scrollOffset[1 ]
10398 lastY - = scrollOffset[1 ]
10499 }
105100
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+
106106 lastDeltaY = deltaY
107107 }
108108
@@ -153,7 +153,7 @@ class DuckDuckGoWebView : WebView, NestedScrollingChild {
153153 override fun onOverScrolled (scrollX : Int , scrollY : Int , clampedX : Boolean , clampedY : Boolean ) {
154154 // taking into account lastDeltaY since we are only interested whether we clamped at the top
155155 lastClampedTopY = clampedY && lastDeltaY <= 0
156- enableSwipeRefresh(clampedY && scrollY == 0 )
156+ enableSwipeRefresh(clampedY && scrollY == 0 && (lastDeltaY <= 0 || nestedOffsetY == 0 ) )
157157 super .onOverScrolled(scrollX, scrollY, clampedX, clampedY)
158158 }
159159
0 commit comments