aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt
index 0ab11fc6..451f3948 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt
@@ -24,11 +24,13 @@ class SwipeRefreshLayout @JvmOverloads constructor(context: Context, attrs: Attr
private var downY: Float = -1f
private val touchSlop = ViewConfiguration.get(context).scaledTouchSlop
+ private var nestedCanChildScrollUp: OnChildScrollUpCallback? = null
+
/**
* Copy of [canChildScrollUp], with additional support if necessary
*/
private val canChildScrollUp = OnChildScrollUpCallback { parent, child ->
- when (child) {
+ nestedCanChildScrollUp?.canChildScrollUp(parent, child) ?: when (child) {
is WebView -> child.canScrollVertically(-1).apply {
L.d { "Webview can scroll up $this" }
}
@@ -42,6 +44,10 @@ class SwipeRefreshLayout @JvmOverloads constructor(context: Context, attrs: Attr
setOnChildScrollUpCallback(canChildScrollUp)
}
+ override fun setOnChildScrollUpCallback(callback: OnChildScrollUpCallback?) {
+ this.nestedCanChildScrollUp = callback
+ }
+
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
if (ev.action != MotionEvent.ACTION_DOWN && preventRefresh) {
return false