Swiping to make ImageButton disappear / appear - android

I've a menu in Android app with several ImageButton (all grouped in a RelativeLayout) and I would like to make it disappear when swiping with finger towards the outside of the screen.
Swiping with finger towards the inside of the screen, instead, the menu should re-appear.
Any suggestion to do this ?

Try writing a gesture detection as given here Fling gesture detection on grid layout and in that code instead of toast write your code.

Related

How to detect screen tap on non-clickable and swipe-able area alone in Android?

My use case is, that I need to hide the toolbar and bottom navigation view after a delay and reveal it once the user taps anywhere on the screen.
But I shouldn't reveal those when the user touches the screen to click on a View/Compose or when the user performs a swipe/scroll gesture.
I achieved this partially using GestureDetectorCompat.onSingleTapConfirmed. The gesture detector doesn't call this method for swipe gestures, but it calls this for click events for clickable views/compose inside the screen.
So when I click an actionable icon in the screen, that click action is executed and the toolbar and bottom bars are revealed. I need to ignore the tap events when the tap occurs on a clickable view/compose.
I mention as view/compose because, my project has both XML-based views and Compose views, so the solution should work for both click events.
Any help is much appreciated, thanks.

Ignore Button Existence When Swiping On Android ViewPager?

I was wondering if there's a way to ignore buttons on the view pager when swiping. For instance, I have a panel of buttons located at the bottom of the screen and the users may swipe left or right to display more of the buttons available. The problem I'm having is that the margins between the buttons a relatively small compared to the buttons themselves so more often than not I'm on a button when swiping, which the viewpager does not respond to so I have to go back and try and get inbetween the buttons with my finger and then swipe. Is there a way to prevent this from happening?

Android - swipe in/out view from/to the right screen edge

I'd like to implement a view that when invisible, slides in when swiping from the right (from outside of the screen). When visible, slides back out to the right when swiping to the right from outside that view.
So I guess this is called a swipe gesture while showing the slide animation as the swipe is still being done. I want it to be fluent, which means that if the swipe gesture is only part made, the view will only part slide, meaning the view follows the gesture.
I'm thinking of something very similar to Amazon's Cloud Drive months view. See screenshot below.
Any idea how to do this? An Example code? 3rd party library?
I tried to search for this. Found how to do the animation: here and here. Found how to recognize the gestures: here and here. Found even the combination of both but not when swiping from the edge of the screen to open nor when swiping from outside of the view to close.
Here are the things I investigated that didn't do the job and why:
SlidingMenu - Slides from the edge and from outside of the view but animates the main window and not just the side view. Also, it's very complicated and hard to get only the required behavior of sliding from/to the edge.
Roman Nurik's Android-SwipeToDismiss - Doesn't recognize swiping from outside of the view nor from the edge of the screen.
Wunderlists - Doesn't recognize swiping from outside of the view nor from the edge of the screen.

android horizontal scrolling with buttons

Hi im wanting to create a function that allows the user to swipe left and right and a button slides in horizontally. for example there will be a big button on screen when you swipe it moves horizontally and another big button could anyone point me in the right direction as i have no idea where to start with it?
heres an example of what i'm looking for
you can use viewpager: http://developer.android.com/reference/android/support/v4/view/ViewPager.html
and when the current page changes (there is a listener to do this) you can change the circle images at the bottom to show the properly page.
:)

Gesture problems with a ViewFlipper that contains a ListView

I have a ViewFlipper where one of the views is a ListView. To move back and forth between the views, I have a GestureListener that detects left and right swipes. Sometimes the left & right swipes interfere with the ListView. That is, when I want to switch to the next view by swiping left/right, I may accidentally click on an item in my list.
Is there a good way to prevent this interference?
Have a look at http://android-journey.blogspot.com/2010/01/android-gestures.html.
The SimpleGestureListener from this page is a great solution to gesture detection. When run in dynamic mode (the default), it intercepts touch events that are determined to be gestures to prevent them from performing other actions. Other touch events are not interfered with.
If you are only interested in swipe gestures I recommend disabling the code for detecting tapping and only listening for swipes.
If you want something a little snazzier than a ViewFlipper (something more like the Android home screen) try out this new addition to the Android compatibility libs: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html?m=1

Categories

Resources