Android AppWidget Vertical Swipe - How - android

On the Android developers website, in the section discussing AppWidgets, there is a passage that says that the only available gestures for AppWidgets are touch and vertical swipe (link):
Because widgets live on the home screen, they have to co-exist with the navigation that is established there. This limits the gesture support that is available in a widget compared to a full-screen app. While apps for example may support a view pager that allows the user to navigate between screens laterally, that gesture is already taken on the home screen for the purpose of navigating between home panels.
The only gestures available for widgets are:
Touch
Vertical swipe
Does this mean it is possible to listen for vertical swipes on an AppWidget?

I guess this is meant to say that you can only scroll through a ListView or go through items of the StackView (by doing vertical swipes).
There is no way how to implement regular onScroll, nor onTouch listeners for AppWidget.

Related

How do I cause vertical two-finger swipe behavior to cause a horizontal slider to move left or right?

I have a horizontal slider in my app, and I want to make it so that if you have the slider selected, you can do the two-fingered swipe up or down gesture from anywhere on the screen (The scroll up or down gesture) to move the slider left or right. I haven't been able to find anything through google about how to change vertical swipe behavior for Talkback and was wondering if there was in fact a way to change this.
I'd really suggest not doing this, it isn't how Android works so it will confuse your users, and be a big source of bugs as any behavior like this can cause touch errors on completely separate views. I just fixed a problem on something similar in my company's app.
But if you really want to do this- your root ViewGroup needs to intercept touch events if there are two fingers down and it moves far enough to qualify. Read https://developer.android.com/training/gestures/viewgroup#intercept for an explanation of how a parent view group can steal touch events from the child. This is the same way ScrollView works to scroll its contents. In fact, looking up the AOSP implementation of ScrollView would give you good example code.

How to detect swipe gesture in mvvmcross

I am using mvvmcross pattern. I have a list of datasets. I am showing only one dataset on the view. When user swipes either left or right, then I need to reload the view to show corresponding dataset.
My dataset is big (around 100), I am afraid to use viewpager, it might be an issue in terms of memory.
I have used the following approach before Android: How to handle right to left swipe gestures, but I wonder how to detect/implement swipe gesture in mvvmcross ?
Swipe gestures are a View concern and are generally not implemented in a MVVM framework. MvvmCross has a Tap gesture recognizer for iOS only.
So since it is a View concern you should look at how this is done natively on Android.

How does Android flip the Home Screens?

I've implemented an adapterViewFlipper in my application but the way it flips the views, with the 'onFling' event calling displayNext(previous)Picture() is not so cool because the scrolling acts automatically AFTER your gesture is ended.
I would like to know how to implement flipping like Android does with the Home screens where the view follows your finger.
Any idea?

Letting Gestures fall through to different Views on Android

I've got a custom View which wills the screen. I've built its onDraw code to support a pinch-zoom style of zooming in and out. The View itself handles all of this work.
Additionally though, I'd like to allow the user to swipe across the screen, either left or right, so that I can swap out that view with the view before or after (similar to a paging situation).
I was able to capture and respond to the swipe left and right using a GestureOverlayView, but now that overlay view is intercepting my pinch-zooming touch events. How can I allow those pinch-zooming touch events to fall through to the custom View will grabbing the swiping gestures up at the activity level?
I think you might want to use a ViewFlipper with a GestureDetector instead of a GestureOverlayView.
http://android-er.blogspot.com/2012/02/implement-swiping-page-effect-using.html
with a setup like this, the gesture detector should only accept left/right swipes, while the view currently displayed still controls the pinch-zoom effect

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