package com.hanwha.morakmorak.ui.custom

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

/**
 * Created by aaron on 05/09/2019
 */
class NonSwipeViewPager @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ViewPager(context, attrs) {

    var swipeEnabled = true

    override fun onTouchEvent(ev: MotionEvent?) = if (swipeEnabled) super.onTouchEvent(ev) else swipeEnabled

    override fun onInterceptTouchEvent(ev: MotionEvent?) = if (swipeEnabled) super.onInterceptTouchEvent(ev) else swipeEnabled

}