package net.pokeranalytics.android.ui.view

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.viewpager.widget.ViewPager

/**
 * ViewPager with paging disabled
 */
class NoPagingViewPager(context: Context, attrs: AttributeSet) : ViewPager(context, attrs) {

	var enablePaging: Boolean = false

	init {
		this.enablePaging = false
	}

	override fun onTouchEvent(event: MotionEvent): Boolean {
		return if (this.enablePaging) {
			super.onTouchEvent(event)
		} else false

	}

	override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
		return if (this.enablePaging) {
			super.onInterceptTouchEvent(event)
		} else false

	}

}