Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ class DuckDuckGoWebView : WebView, NestedScrollingChild {

returnValue = super.onTouchEvent(event)

if (scrollY == 0 && lastClampedTopY) {
// we have reached the top and are clamped -> enable swipeRefresh (by default always disabled)
enableSwipeRefresh(true)

stopNestedScroll()
} else if (dispatchNestedScroll(0, scrollOffset[1], 0, deltaY, scrollOffset)) {
if (dispatchNestedScroll(0, scrollOffset[1], 0, deltaY, scrollOffset)) {
event.offsetLocation(0f, scrollOffset[1].toFloat())
nestedOffsetY += scrollOffset[1]
lastY -= scrollOffset[1]
}

if (scrollY == 0 && lastClampedTopY && nestedOffsetY == 0) {
// we have reached the top, are clamped vertically and nestedScrollY is done too -> enable swipeRefresh (by default always disabled)
enableSwipeRefresh(true)
}

lastDeltaY = deltaY
}

Expand Down Expand Up @@ -153,7 +153,7 @@ class DuckDuckGoWebView : WebView, NestedScrollingChild {
override fun onOverScrolled(scrollX: Int, scrollY: Int, clampedX: Boolean, clampedY: Boolean) {
// taking into account lastDeltaY since we are only interested whether we clamped at the top
lastClampedTopY = clampedY && lastDeltaY <= 0
enableSwipeRefresh(clampedY && scrollY == 0)
enableSwipeRefresh(clampedY && scrollY == 0 && (lastDeltaY <= 0 || nestedOffsetY == 0))
super.onOverScrolled(scrollX, scrollY, clampedX, clampedY)
}

Expand Down