From ad6b62fdea08999af6488a4806949b18b890d197 Mon Sep 17 00:00:00 2001 From: corne Date: Sat, 28 Sep 2019 15:15:37 +0200 Subject: [PATCH 1/2] fixed random crash IllegalArgumentException: pointerIndex out of range --- .../com/kodmap/app/library/ui/KmViewPager.kt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/kodmap/app/library/ui/KmViewPager.kt b/library/src/main/java/com/kodmap/app/library/ui/KmViewPager.kt index 72142de..7f0ab9b 100644 --- a/library/src/main/java/com/kodmap/app/library/ui/KmViewPager.kt +++ b/library/src/main/java/com/kodmap/app/library/ui/KmViewPager.kt @@ -17,15 +17,27 @@ class KmViewPager : ViewPager { @SuppressLint("ClickableViewAccessibility") override fun onTouchEvent(event: MotionEvent): Boolean { - return !swipeLocked && super.onTouchEvent(event) + try { + return !swipeLocked && super.onTouchEvent(event) + }catch (e: java.lang.Exception) { + return !swipeLocked + } } override fun onInterceptTouchEvent(event: MotionEvent): Boolean { - return !swipeLocked && super.onInterceptTouchEvent(event) + try { + return !swipeLocked && super.onInterceptTouchEvent(event) + }catch (e: java.lang.Exception) { + return !swipeLocked + } } override fun canScrollHorizontally(direction: Int): Boolean { - return !swipeLocked && super.canScrollHorizontally(direction) + try { + return !swipeLocked && super.canScrollHorizontally(event) + }catch (e: java.lang.Exception) { + return !swipeLocked + } } From eea985d99af86f19a2c663a125101e73adf03fc6 Mon Sep 17 00:00:00 2001 From: corne Date: Sat, 28 Sep 2019 15:22:21 +0200 Subject: [PATCH 2/2] typo --- library/src/main/java/com/kodmap/app/library/ui/KmViewPager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/com/kodmap/app/library/ui/KmViewPager.kt b/library/src/main/java/com/kodmap/app/library/ui/KmViewPager.kt index 7f0ab9b..95d9661 100644 --- a/library/src/main/java/com/kodmap/app/library/ui/KmViewPager.kt +++ b/library/src/main/java/com/kodmap/app/library/ui/KmViewPager.kt @@ -34,7 +34,7 @@ class KmViewPager : ViewPager { override fun canScrollHorizontally(direction: Int): Boolean { try { - return !swipeLocked && super.canScrollHorizontally(event) + return !swipeLocked && super.canScrollHorizontally(direction) }catch (e: java.lang.Exception) { return !swipeLocked }