Handle ViewPager swipe inside Navigation Drawer - android

I am using ViewPager inside my Navigation Drawer and am encountering an issue when I want to swipe to next tab in ViewPager. Swiping works in direction which opens Navigation Drawer but doesn't work in direction which closes Navigation drawer.
That means I can normally swipe to ViewPager pages to "right" direction but when I want to swipe to the "left", NavigationDrawer intercepts touch events and closes itself.
I would still like to have ability for navigation drawer to close if user swipes on content which doesn't have horizontal scroll. How can I accomplish something like this? Thank you.

use View.requestDisallowInterceptTouchEvent(true); when you do not want your ViewPager to close, call this View.requestDisallowInterceptTouchEvent(false); immediately after Action_Up.
What it does is it prevents the parent from listening or intercepting the touch event.

Related

Disable the swipe gesture that opens the navigation drawer for a certain view inside DrawerLayout

I have a root DrawerLayout in the android layout swipe left to right on anywhere on the screen.
The problem here the layout includes a board that requires moving a piece from left to right by sliding, so when a user tries to move the piece, the DrawerLayout opens up. the board only covers only half of the screen, so I still want to allow the drawer to open when the user swipes on the other views,
Is it possible to not trigger the drawer when the user swipe on a particular view?

View pager inside a drawer

I want to have a drawer which is always open with a list of options(drawer list). The content has a view pager with fragments.
When I swipe from right to left or left to right on the content frame it should swipe the view pager fragments according to the swipe direction with the drawer open or close state as it is.
When i swipe the drawer from right to left it should dismiss.
So basically I want the view pager swipe enabled even when the drawer is open.
Is this possible and how can it be achieved.

Swiping in order to call another Activity in Android

I want to make something like transitions between ViewControllers in iOS 7 but in Android, is it possible?
Explanation: please look at image below, I have main Activity which has ViewPager inside, so we can swipe between Fragments. I want to call another Activity (or Fragment) from each Fragment (blue on image) swiping to bottom or to top but this action should be done smoothly like in ViewPager.
You can intercept swipe up and down gestures and set items in viewpager accordingly. Please read this guide on how to intercept swipes in various directions.

Android: Hide view while scrolling a ViewPager

I have a layout with a ViewPager and also right left arrows inside the ViewPager for manually moving to the next view without swiping.
While the user is swiping, I'd like to hide those arrows (or maybe only show the right one when the user is swiping to the right...)
How can I find out if the user is scrolling a ViewPager?
Found the solution:
Method onPageScrollStateChanged from SimpleOnPageChangeListener
http://developer.android.com/reference/android/support/v4/view/ViewPager.SimpleOnPageChangeListener.html#onPageScrollStateChanged(int)
the state argument of onPageScrollStateChanged is 1 when you start draggin, 2 when you let go and 0 when the ViewPager has stopped scrolling

Android SlidingDrawer Position Handle Offscreen

Is it possible to position a SlidingDrawer so that the handle is just below the bottom of the screen?
The functionality that I'm going for is that a user will press a button (not attached to the drawer) to slide the drawer up from below the screen. From there the user is able to use the handle to slide it back down.
Use View#setVisibility(View.GONE) and View#setVisibility(View.VISIBLE) on the handle.

Categories

Resources