How to increase ViewPager swipeable area - android

I have a ViewPager with two Fragments. The first Fragment is a simple RecyclerView. But the second Fragment contains a full screen Google Maps element.
Fragment 1:
Fragment 2:
The problem is that when you are viewing Fragment 2, it's very hard to go to Fragment 1 by swiping from the left side of the screen to the right because the map will start moving. You really have to touch from the very edge of the left side in order to go to Fragment 1.
How do I extend the swipeable area on the left side of the screen when in Fragment 2?
I've tried adding a left padding to the map which does work but the layout gets ugly since the map starts after the padding.

Related

OSMDroid Tabbed Activity Swipe

I'm creating a tabbed Android project that uses OSMDroid to display a map in one of the fragments and some other information in some other fragment (in another tab).
The way you move from tab to tab is by swiping left or right or by pressing on the tab buttons at the top of the application.
However, when you want to scroll the map that is contained in the first fragment to the left, for example (to the West), then you will actually swipe to the other tab instead of scrolling the map.
Does anybody know how can I "tell" my application that, when I scroll on the map, I actually want the map to scroll and not the application to swipe to another tab? I've seen this implementation in other apps, where you can swipe to another tab if you swipe at the edge of the screen, but if you swipe somewhere in the middle (or more precisely said, "not at the edge of the screen") you will scroll the map that's in that tab, and not go to another tab.
Any ideas on how to make this work?

Weird black view showing app in the fragment next to Skobbler because of the Skobbler map

I have a ViewPager with 2 children in my MainActivity.
One child is a fragment called WalkMapFragment that holds the SKMapFragment within,
(since I wasn't able to use the Skobbler maps by defining the SKMapViewHolder item on the xml)
and the other is an About fragment. But when I tap on the About tab item, I get this:
Theres a black View on top of my fragment that shouldn't be there.
Now notice something weird, if I tap on an annotation and open a callout view in the map fragment like so:
check what happens:
Notice that the black view from the right tab moves exactly to SKCalloutView's position
(Optional - Additional info:)
p.s 1: If I open a callout, then zoom in and out by hand, the black view disappears from my About Fragment.
p.s 2: By testing I found out that by removing the map, this weird black view also gets removed from the About fragment.
p.s 3: Also if I flip the tabs and put the About fragment on the left, I don't get this behaviour. It only happens when I have a fragment on the right side of the Skobbler map.
What is this issue about? How can I remove this black view that overlays my fragment?
Try making map layout visibility invisible or gone when you go to the 'about' tab.

ViewPager showing border of fragment

I'd love to know if anybody knows how to achieve following:
I've got a ViewPager showing up a fragment. While this fragment is showing, You can see the small left border of the fragment to the right. This fragment can be pulled out and acts like a NavigationDrawer.
Here's an example, the Android L Calculator app:
https://d13yacurqjgara.cloudfront.net/users/409459/screenshots/1647461/calculatorrender.gif
As You can see, there is a small blueish border to the right which can be pulled out by swiping it in just like a NavigationDrawer.
Any suggestions how this is achieved?
From the looks of it, this is not done with a ViewPager.
If I would have to do this layout, I would do it with 2 ViewGroups next to each other.
The first one would take 90% width of the screen, would be in the back, and aligned to the left, lets call this layout A.
The second one would take 75% width of the screen, placed in the front, aligned to the right, and have right margin of -65%. I would also add a nice shadow to its left edge, and call it layout B.
Layout A would have a grey background and lots of buttons, as in the animation. If the user swipes left on this view, you set a flag that layout B is shown, and animate the right margin of layout B, to show it. You would do the same when layout B is tapped while being almost hidden.
Any tap on layout A now would close layout B (you can control this with the flag).
When tapped on a button in layout B, you also animate the right margin back, and set the flag also back to false.
If you would use fragments for this, then you would have to worry too much with the communication between the two, and it would just go the same way as with views.

Sync two ViewPagers inside a Vertical ViewPager

I have an activity. Inside that activity I have implemented VerticalViewPager in which 3 pages are fed i.e. Upper Page, Middle page and Lower Page. Inside the middle page fragment and Lower page fragment I have separately another ViewPagers(Horizontal).Inside these ViewPagers I have 3/3 pages each. So far I have been able to make them working just fine i.e. on vertical swipe gesture the VerticalViewPager gets triggered and on horizontal swipe gesture native android ViewPager gets triggered. Now I need to sync the horizontal swipe transition between the middle fragment pages and lower fragment pages.
Let me give an example: say I have A,B and C pages inside middle fragment of VerticalViewPager and D,E,F inside the lower vertical fragment. Assume I am in the middle fragment now. So when I swipe from A to B left to right, the lower fragment should also swipe from D to E automatically.
[P.S.: For the horizontal(native) ViewPager to work inside
VerticalViewPager, the horizontal ViewPager Adapter needs to run
in the AsyncTask or threads. So please consider this scenario as
well]
You can make the adapter scope available globally and set the current view or fragment according to the change in the middle fragment.
According to the example:

Android Sliding fragment instead of menu

I would like to implement an activity with 2 fragments in tablet app. Fragment A on left and second fragment B with some additional info on the right. Lets say each fragment has half of the screen width. Now I would like to add the option to slide the right fragment B to the right side of screen and let the fragment only e.g. 10 % of width (so fragment A can expand to 90%).
So fragment A now can has more space and fragment B can be slided to the middle back again. I would like to ask if there is a library that can help me or if there is already functional solution of this.
I have never worked with SlidingDrawer that seems to be right but now it is deprecated.
Download this library:
https://github.com/jfeinstein10/SlidingMenu
Check here how to implement:
Dynamic UI with sliding menu and actionbarsherlock

Categories

Resources