Skip to content

Commit

Permalink
#7 NonSwipeableViewPager
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-mausch committed Jan 8, 2018
1 parent 47be1e1 commit b675c2a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.neonew.mesh.android.ui.onboarding

import android.content.Context
import android.support.v4.view.ViewPager
import android.util.AttributeSet
import android.view.MotionEvent

// https://stackoverflow.com/questions/9650265/how-do-disable-paging-by-swiping-with-finger-in-viewpager-but-still-be-able-to-s
class NonSwipeableViewPager : ViewPager {

constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)

override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
return false
}

override fun onTouchEvent(event: MotionEvent): Boolean {
return false
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/onboarding.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:gravity="center"
android:layout_margin="40dp"/>

<android.support.v4.view.ViewPager
<de.neonew.mesh.android.ui.onboarding.NonSwipeableViewPager
android:id="@+id/onboarding_pager"
android:padding="20dp"
android:layout_width="match_parent"
Expand Down

0 comments on commit b675c2a

Please sign in to comment.