package com.mints.goodmoney.ui.widgets;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.viewpager.widget.ViewPager;

public class MyViewPager extends ViewPager
{

    public MyViewPager(Context context)
    {
        super(context);
    }

    public MyViewPager(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        // TODO Auto-generated constructor stub
    }

    private boolean isCanScroll = true;

    public void setCanScroll(boolean isCanScroll)
    {
        this.isCanScroll = isCanScroll;
    }

    @Override
    public boolean onTouchEvent(MotionEvent arg0)
    {
        if (isCanScroll)
        {
            return super.onTouchEvent(arg0);
        }
        else
        {
            return false;
        }
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent arg0)
    {
        if (isCanScroll)
        {
            return super.onInterceptTouchEvent(arg0);
        }
        else
        {
            return false;
        }
    }

}
