ebanx / swipe-button

A button that activates by swipe instead of touch
487 stars 101 forks source link

States #12

Closed Andronymous closed 7 years ago

Andronymous commented 7 years ago

Hi Thanks for your grate library Is it possible to use the swipe button just in active state? I want to call "moveButtonBack" function after i slide the button Actually I need it without "expandButton" implementation , just like slide view .

leandroBorgesFerreira commented 7 years ago

Hello @Andronymous. I just created a branch called no_expand that I believe that does what you are asking. You can fork it and use as you like. I won't merge this branch to the master because I don't see this as the natural use of this View. If you believe this should be added as a feature in the button, please let me know and present a use case scenario. Thanks!

leandroBorgesFerreira commented 7 years ago

@Andronymous Did the brach solved your problem?

Andronymous commented 7 years ago

Hi @leandroBorgesFerreira Yes Thank for your help. The swipe-button is a beautiful customizable view that can be used in different use cases. my use case scenario : I'm working on a delivery application.fore some sensitive actions, I prefer not to use a simple button, to prevent user accidental clicks or touches. Instead a sliding button is very more useful. The sensitive action is sending some data to serve (some similar user status , every time by user Command) and every time the button's text, needs to be filled by new text to be ready for next slide and action. So this is what I need after slide the button of swipe-view : expand at first and automatically(without click on expanded button state ) collapse and return to first position and during this animate I can refresh the text of it. I believe this feature can make your project useful for more use cases. 👍

leandroBorgesFerreira commented 7 years ago

Hello @Andronymous

Thanks the detailed use case. I just added the functionality in the 0.6.0 version of this library. You can use the button with only one state by setting

app:has_activate_state="false"

Or using the setter. You should also you the OnActiveListener instead of OnStateChangeListener. Let me know if you have any trouble using this new version of the library