roughike / SwipeSelector

A nicer-looking, more intuitive and highly customizable alternative for radio buttons and dropdowns for Android.
Apache License 2.0
1.09k stars 154 forks source link

The selected items change (or sometimes stay) during orientation changes. #1

Closed roughike closed 8 years ago

roughike commented 8 years ago

In other words, the viewpager doesn't hold state properly.

EmmanuelMess commented 8 years ago

Solved in #6?

roughike commented 8 years ago

@EmmanuelMess

Solved in #6?

Nope, that only solves it for the sample app, not for the SwipeSelector View itself. And that wouldn't be a solution, rather a hack. See this Stack Overflow answer.

The API level 8 support commit was looking fine though. It was coming, but I was too busy with other projects (in other words: lazy) to get it done before you.

I'll merge it when I've tested it and learned to merge just that part. Don't hold your breath because I'm such a noob with git.

EmmanuelMess commented 8 years ago

@roughike So, when the activity restarts the state shouldn't? I don't quite understand when the state should be saved and isn't.

roughike commented 8 years ago

@EmmanuelMess Whenever an Activity is being stopped, all of its' Views get notified by a callback the Activity calls and they can return a Parcelable with the saved state. Then, when the Activity restarts, all the Views are passed the same Parcelable that they previously returned.

So it's like a container that you can drop stuff into and then get it back so you remember where you left off.

I haven't fixed this just yet, but it should be relatively simple. Will probably fix in the next version when I have some free time.

EmmanuelMess commented 8 years ago

@roughike Solved at Solved state holding issue but I don't want to cluster too many things and have to close and open another pull request ;); Sorry if I'm bothering you you too much, I still want to help... also .."take any feedback you’ve received and go forth and pull request again"...

roughike commented 8 years ago

@EmmanuelMess Well thank you! They're looking good. I'll merge these when I have the time to test them.

roughike commented 8 years ago

Aaaaaaand done. Now we're perfect.

Huge thanks to @EmmanuelMess for helping to close this issue. My lazy ass probably wouldn't have fixed this until next year.