addisonElliott / SegmentedButton

Segmented Control/Button with animation for Android API 16+
Apache License 2.0
148 stars 39 forks source link

Is there a way to unselected all buttons ? #23

Open Seeyko opened 4 years ago

Seeyko commented 4 years ago

Hello,

Is there a way to toggle a button ? For example if a click on a button when it's selected it unselected it and don't selected any other buttons ? I saw that giving an out of bound index to setPosition is just doing nothing.

addisonElliott commented 4 years ago

Hello, no I don't think I have that functionality yet.

It can be done. One question is how that'll work for animation. Should it just disappear or animate off the screen somehow?

PRs are welcome. I won't be able to get to this project for a few weeks

Seeyko commented 4 years ago

Hey,

Yes fade off/slide out, both are possible i guess. I have never work with animation or draw in android so i don't think i will be able to make a good PR.

The code seems very well commented so i'm still going to take a look and try to do something. If you have any suggestion where to look/ the big steps ?

Thanks

addisonElliott commented 4 years ago

SegmentedButtonGroup is where all the necessary should be.

I have the SegmentedButtons setup so that you just tell it "I want 80% to show selected and 20% unselected" and by animating the values it will appear to move.

Besides that, I'm not quite sure how to go about the animation part. You are welcome to submit a PR that doesn't animate at all and we can add something later