OSMDroid Tabbed Activity Swipe - android

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?

Related

Scrolling a ViewPager programmatically, by a small amount

I have the requirement for what is effectively two activities side by side, allowing the user to scroll from one to the other, and back. I've decided that ViewPager is probably the best way to handle this, but am open to suggestions.
When the activity loads, the left hand view is displayed. I want to indicate to the user that the other view exists, by just scrolling it a small amount to the left and back again (similar to the way it's now common to show that a sliding drawer menu exists).
I've tried a number of things but have yet failed to find a method where both the views scroll smoothly together. Another way of interpretting the requirement is saying I want to programmatically fake a user flicking the page briefly.
Try calling the method fakeDragBy(float)! According to the documentation you need to first call beginFakeDrag() to initiate it and then call endFakeDrag(). This will mantain the ViewPagers default snapping behavior, so once you've revealed the other screen is there you don't have to animate the transition back, simply call endFakeDrag and the ViewPager will correctly snap back to the last screen (As long as you haven't dragged it past the half-way mark).

How to increase ViewPager swipeable area

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.

Android SlideShow View

I want to show 4 images like a slide show with translate (right to left) animation.
So I used ViewPager with 4 Fragments, and thread for automatic navigation to the next Fragment.
Everything was fine except navigation from the last item to the first.
In that case ViewPager scroll all Fragments (from left to right) to the first one, and this is the problem.
I need something like infinite navigating (right to left).
So what alternatives of ViewPager for doing this there are?
check this out , you can achieve using this
https://github.com/antonyt/InfiniteViewPager
hope it helps :)

How to implement vertically moving tabbs panel?

In google play, if you enter a screen that uses tabs, you can notice how you can scroll each tab but the panel that seen to contain the tabs also moves vertically to a certain extent. I can imagine that it accomplishes the movement of the tab panel with a TranslateAnimation and a layout animations. But what I can't understand is how it decouples the content of the tab from the tab panel.
To answer the decoupling of the tabs and content question; I have implemented this before using 2 sets of tabs. One is in the content as a list header, the other is layered on top of the list in a containing FrameLayout so it's 'floating'.
Using scroll callbacks you can change the visibility of the floating tabs to suit your needs. Once the list header tabs moves off the screen make the floating tabs visible, once they move fully back onto the screen hide the floating tabs.
Just ensure that every time you show/hide tabs that you copy the values for horizontal scroll position and selected tab from the currently visible tabs to the ones that are about to become visible. works a treat.
The best open-source project you can find for this Android-ObservableScrollView

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.

Categories

Resources