diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt | 2 | ||||
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackPage.kt | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt index 8f1da04..c5b64e3 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt @@ -245,7 +245,7 @@ internal class SwipeBackLayout @JvmOverloads constructor( @SuppressLint("ClickableViewAccessibility") override fun onTouchEvent(event: MotionEvent): Boolean { - if (!swipeEnabled) return false + if (!swipeEnabled || disallowIntercept) return false try { dragHelper.processTouchEvent(event) } catch (e: Exception) { diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackPage.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackPage.kt index bc5b459..c85625a 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackPage.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackPage.kt @@ -75,6 +75,7 @@ internal interface SwipeBackContractInternal : SwipeBackContract { interface SwipeBackContract { /** * Toggle main touch intercept + * Disabling will remove the swipe back handler */ var swipeEnabled: Boolean /** @@ -91,6 +92,10 @@ interface SwipeBackContract { * Set the scrolling threshold for wish a page is deemed closing */ var scrollThreshold: Float + /** + * Toggle main touch intercept + * Disabling will just ignore touch events, but the handler will remain attached + */ var disallowIntercept: Boolean /** * Set the min velocity of the view drag helper |