aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-15 13:42:22 -0700
committerGitHub <noreply@github.com>2017-08-15 13:42:22 -0700
commit203305e1890f9e23caa80d7ad6921767f830a4da (patch)
tree82e011105d3f8506fbe439a0365bc8bc89a8777d /app/src/main
parent5d9a3fd7fb8f2f9d0f592c89446824980c9841c6 (diff)
downloadfrost-203305e1890f9e23caa80d7ad6921767f830a4da.tar.gz
frost-203305e1890f9e23caa80d7ad6921767f830a4da.tar.bz2
frost-203305e1890f9e23caa80d7ad6921767f830a4da.zip
Add try catch (#179)
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostViewPager.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostViewPager.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostViewPager.kt
index d692c7aa..91673b15 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostViewPager.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostViewPager.kt
@@ -15,7 +15,12 @@ import com.pitchedapps.frost.utils.Prefs
class FrostViewPager @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ViewPager(context, attrs) {
var enableSwipe = true
- override fun onInterceptTouchEvent(ev: MotionEvent?) = Prefs.viewpagerSwipe && enableSwipe && super.onInterceptTouchEvent(ev)
+ override fun onInterceptTouchEvent(ev: MotionEvent?) =
+ try {
+ Prefs.viewpagerSwipe && enableSwipe && super.onInterceptTouchEvent(ev)
+ } catch(e: IllegalArgumentException) {
+ true
+ }
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(ev: MotionEvent?): Boolean = Prefs.viewpagerSwipe && enableSwipe && super.onTouchEvent(ev)