Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- recyclerView.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- directionDetector.onTouchEvent(event);
- //passing UP action to widgets and reseting the direction
- if (event.getAction() == MotionEvent.ACTION_UP) {
- direction = null;
- motionLayout.onTouchEvent(event);
- }
- //passing initial action to widgets
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- motionLayout.onTouchEvent(event);
- }
- if (direction != null) {
- switch (direction) {
- case UP:
- case DOWN:
- return motionLayout.onTouchEvent(event);
- case LEFT:
- case RIGHT:
- return false;
- }
- }
- return false;
- }
- });
Add Comment
Please, Sign In to add comment