Closed biniamHaddish closed 12 months ago
what I mean is when I swipe to right instead of having one action I can have to: for example one for saving and one for posting ...
I see now. Unfortunately that is currently not possible (but I am open to pull requests 😃).
The closest feature you can get is to place view with few buttons as one of the background views and then return false
from gesture listener. This will make it so when users swipe the view it won't be automatically swiped back and they will be able to click on the revealed buttons. You can read about that behavior in Gesture listeners section of the Readme.
Creating a pull request that would add such feature probably wouldn't be that hard. We could add a parameter to gesture listener telling how far the user has swiped, which would then allow us to determine which action to execute. And with the use of custom animations we could make it so the background views correctly update also based on the swipe distance. (Documentation about these animators is currently lacking but you can see how it works by checking ScalableIconAnimator).
If someone would like to create such a pull request feel free to contact me. I can answer any questions and help with ideas.
Not sure if I understand correctly but when you add background views in xml code you can use the
android:layout_gravity
attribute to specify whether they should be displayed on left or right side.The example from readme adds
ImageView
for left and right actions which can then be listened to via gesture listeners to see in which direction the user did swipe.Appearance of these "background" views is entierly up to you. They can be basic
ImageViews
or custom views. You can customize them in regular ways likefindViewById
or similar.