aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-07-02 16:48:43 -0700
committerAllan Wang <me@allanwang.ca>2019-07-02 16:48:43 -0700
commit00ba1bcf7a756252baa808e62a0916fd18e95946 (patch)
tree043e9f2a1742ef37cf948648fe718c1b9665edce /core/src/main/kotlin/ca
parent9cb9c1f057e5326f34cf2838177504df1fad64ed (diff)
downloadkau-00ba1bcf7a756252baa808e62a0916fd18e95946.tar.gz
kau-00ba1bcf7a756252baa808e62a0916fd18e95946.tar.bz2
kau-00ba1bcf7a756252baa808e62a0916fd18e95946.zip
Add disallow on touch and document
Diffstat (limited to 'core/src/main/kotlin/ca')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackPage.kt5
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