Uh, so I've been working on this addiction of a gesture animation on Android with @CodeSlice's
iOS tutorial. Here's the
బంక | banka | バンカ
toggle https://git.io/JtKhQ
The takeaways — a thread
(1/n) Is there an Android equivalent to this <Any> iOS property? No.



The takeaways — a thread
(1/n) Is there an Android equivalent to this <Any> iOS property? No.
(2/n) Utterly inspired by the Large, Sticky and Stretchy Toggle. Thank you for the well-explained tutorial @CodeSlice!
I've had your original tweet pinned on my browser for a solid 2 months until I could work on it
Original: https://twitter.com/CodeSlice/status/1337108594718859271


Original: https://twitter.com/CodeSlice/status/1337108594718859271
(3/n) In Telugu, బంక (pronounced banka | バンカ) literally means sticky slime or sap and can be used to refer to 'hard to shake off' people and things lol. 


Also, see https://teluguenglishdictionary.in/tag/telugu-word-banka-meaning/



Also, see https://teluguenglishdictionary.in/tag/telugu-word-banka-meaning/
(4/n) iOS properties tend to abstract the implementation of things like offset and translation and measurements and pivots and animation, but the 'why'/'how' explanations really helped me figure out how to do an Android equivalent.
(5/n) Android has a ViewDragHelper class
. When we drag a View, the ViewDragHelper can share the gesture/touch event handling with onInterceptTouchEvent and onTouchEvent in its parent custom ViewGroup.


(6/n) clampViewPositionVertical / clampViewPositionHorizontal are lifesavers, no doubt!
At the moment, drag on Android can't be easily constrained in a specific direction, so the top and dx/dy parameters passed in these functions are super useful for customisation.

(7/n) Springing the top back to its original shape when the object unsticks was the most interesting problem. I ended up using an AnimatorSet with custom stretch and scale property ObjectAnimators https://git.io/Jt6fa - worked out well, I think.

(8/n) Will add updates on this thread as I convert this gesture animation into a library and start on a post to document all of the new classes and functions and workarounds I've learnt. I'd love to get feedback and suggestions and improvements and critique, thank you!
