Back to project page PECSMobile.
The source code is released under:
GNU General Public License
If you think the Android project PECSMobile listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jjoseba.pecsmobile.ui; /*from ww w . ja va2 s. c o m*/ import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; /** * Created by Joseba on 28/12/2014. */ public class EnableableViewPager extends ViewPager { private boolean pagingEnabled; public EnableableViewPager(Context context, AttributeSet attrs) { super(context, attrs); this.pagingEnabled = true; } @Override public boolean onTouchEvent(MotionEvent event) { if (this.pagingEnabled) { return super.onTouchEvent(event); } return false; } @Override public boolean onInterceptTouchEvent(MotionEvent event) { if (this.pagingEnabled) { return super.onInterceptTouchEvent(event); } return false; } public void setPagingEnabled(boolean enabled) { this.pagingEnabled = enabled; } public boolean isPagingEnabled(){ return this.pagingEnabled; } }