fedepaol / dragqueen

Sample app that shows android's ViewDragHelper usage
Apache License 2.0
101 stars 28 forks source link

How would you handle orientation changes ? #3

Closed martinbonnin closed 8 years ago

martinbonnin commented 8 years ago

I noticed that changing orientation resets the "Queen" button. Any advice about how to handle this elegantly ?

fedepaol commented 8 years ago

I don't remember what I did on that never committed firefox patch. In any case, apart from some strange exception, I would reset the button (or the view you are dragging) in a rest position. You can choose between honoring the user's intention (the state is "opening", you reset the button as opened) or deleting the user's intent. Having the target follow the new position of the finger is a bit more complex (the position in the new configuration might be outside the range, I am not sure what happens to the motion event sequence if the finger starts already on the screen).

You should also consider that you are talking about a scenario where the user is rotating the device WHILE holding a finger on the screen...