waylife / InfiniteViewPager

InfiniteViewPager is a modified android ViewPager widget that allows infinite paging and auto-scrolling.
MIT License
282 stars 47 forks source link

Unable to vertical scroll #3

Open varunrramani opened 8 years ago

varunrramani commented 8 years ago

When added as header in a recycler view, unable to vertical scroll when touched on the viewpager. and when trying to scroll through the viewpager when autoscrolling it stutters and doesnt change the page.

waylife commented 8 years ago

When you touch on InfiniteViewPager, all events will handled by it. That means it consume all touch events on it.
For vertically scroll, this function may be added in the coming future. As I am busy with my job, I can not make a certain promise for this. When scroll through the viewpager, autoscrolling stops, it is a naturally interaction.

geniushkg commented 7 years ago

@varunrramani I have got this working by changing the following code in InfiniteViewPager file

@Override public boolean onInterceptTouchEvent(MotionEvent ev) { //to solve conflict with parent ViewGroup //getParent().requestDisallowInterceptTouchEvent(true);
if (this.mAutoScroll || this.mTouchedWhenAutoScroll) { int action = ev.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: this.mTouchedWhenAutoScroll = true; Log.d(TAG, "onInterceptTouchEvent: down "); stopAutoScroll(); break; case MotionEvent.ACTION_UP: Log.d(TAG, "onInterceptTouchEvent: up "); break; default: Log.d(TAG, "onInterceptTouchEvent: "+ev.getAction()+" and "+ev.toString()); break; } } return super.onInterceptTouchEvent(ev); }

waylife commented 7 years ago

@geniushkg thanks for sharing your solution. @varunrramani may this helps.