Custom swipe animation (Tilt, Card Deck, 3D, etc.) - android

How can I implement a custom swipe animation instead of the standard horizontal movement? I'm thinking about a mixture of ViewPager (swipe to scroll) and ViewFlipper (custom animation). It's important that the animation gives a live feedback to the user's finger movement, not just plays after a swipe has been completed.
Some examples:
http://www.youtube.com/watch?feature=player_embedded&v=BcloiEZa1iI
ICS launcher tilt effect
Card deck effect in ICS launcher menu
Cube effect of custom launchers
Any idea on how to generally override the swipe animation in a ViewPager?

You will have to override onTouchEvent(), onScroll() and the likes. Point is that the ViewPager's swipe is no animation but actually scrolls the views around. Animations wont work for you here is my bet.

Related

ViewPager2 without using Viewpager2

I want to create my own version of ViewPager2 so that I can control the animation design and orientation capabilities. Basically, I'm trying to have a scrolling up and down load new users while left and right would be more information about that user.
I tried using custom animations with swipe gestures, which works exactly as I wanted, except I don't get the control of dynamically animating the swiping direction. Essentially, it still works like a button animation - you might swipe in the direction you want but the animation speed/feel/etc is always the same animation vs. ViewPager2's ability to move with the gesture.
I experimented with OnDragListeners which do give me the "Tinder card movement" animation effect but I don't want to allow for animations in all directions. I was able to use a ViewPager2 for the horizontal direction while using the OnDragListener to override the swiping (using OnLongClick). When you drag up or down it has the same issue of the transition animation being the same speed/feel/etc everytime instead of the nice ViewPager2 slide on touch effect.
I only need 4 fragments for each user so my next idea was to try a horizontalscrollview in a recyclerview but that's working either.
Any suggestions for an approach I might not have considered?

How to do a drag-and-drop motion animation with first or last ViewPager item?

I need to implement an animation in ViewPager2
where user can drag first or last item
beyound the bounds (for half of screen width),
and items will bounce back with animation automatically.
Please help me to understand, in which direction I should investigate
for implementing such an animation?
It's about GestureDetector, or MotionLayout, or anything else?

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?

Swiping to make ImageButton disappear / appear

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.

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

Categories

Resources