-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Tidy up touch on Android #553
Comments
Perhaps we can leverage code from the raster SDK https://github.com/mapbox/mapbox-android-sdk/issues/525 |
Here is the code https://github.com/mapbox/mapbox-android-sdk/pull/536/files |
We need to update to latest code from https://github.com/Almeros/android-gesture-detectors/commits/master Also should migrate to using this as a gradle dependency |
@ljbade Our of curiosity, is the third-party library we use for gestures necessary? Is it the best? Would it make sense to write our own, smaller, abstracted (open source) one? /cc @hollinger |
@incanus @hollinger, I used it since it seemed well written and didn't have the time back then to roll my own. Since it is used by others I also presumed that it would be more robust than anything I came up with. Android's support for touch is basically nill other than sending you the messages and leaving you to figure out how to process them into gestures. They only have basic tap and drag gestures in the Android library, everyone has to either roll their own support for other gestures, or use a 3rd party library |
Ok, great @ljbade, that's helpful. I think we might look into hooking up rotation as a good feet-wetter. |
Awesome, if you can get this working. Let me know if you can't understand any of the touch code, (I have forgotten parts of it myself :-( |
Woot, awesome having rotation — works great for me. |
@hollinger @incanus some feedback:
Ideally I would like our touch gestures (as well as the other input types) to be as close to Google Maps as possible so the average Android user can just start using our maps without it feeling 'wrong'. |
|
Background on rotation limiting: #458 |
Also, agree on dead zone, we need this on iOS as well. There, the native widget appears to disallow small amount of rotation if any other gesture (pan or zoom) is also happening. |
We need to use http://developer.android.com/reference/android/support/v4/view/GestureDetectorCompat.html and http://developer.android.com/reference/android/support/v4/view/ScaleGestureDetectorCompat.html for backwards compatibility. We should also use http://developer.android.com/reference/android/support/v4/view/ScaleGestureDetectorCompat.html#setQuickScaleEnabled(java.lang.Object, boolean) Also http://developer.android.com/reference/android/view/VelocityTracker.html will be good for flings. |
OK added GestureDetectorCompat and ScaleGestureDetectorCompat. |
Should add the MoveGestureDetector Almeros. |
I hope Almeros adds his project to Maven. |
Hmm quick zoom (two finger tap then drag up or down) gets detected as a double tap zoom in which causes problems. Need a delay between deciding if double tap or quick zoom. |
Trying to rotate and pan past the map edge at the same time causes jankyness, Google Maps remains fluid. |
Can we ticket & link that? |
Someone already has asked for it to be in Maven: Almeros/android-gesture-detectors#12 |
Had to revert to older library version due to #634 Why is it so hard to handle touch gestures on Android 😠 There has to be an easier way to get everything right. |
Is this due to needed features/polish in Almeros? Could we consider sponsoring/forking/etc. in order to move that forward as a general-use Android tool? Or is this just inherent to the platform. Basically: can we put some effort in here to solve our problems + benefit all of Android development with some concrete tools? |
Yeah I think we can do a good job with effort. Android platform sucks, but Google Maps must be use the same API and they have perfect gesture support. |
@tobrun One more that Google Maps does. They detect the start a gesture based on velocity, whereas we wait for a minimum movement distance. You will notice this if you try the pinch zoom very slowly on Google, it just ignores it. Im going to remove the TODO comments and see if I can hit #813 which is the most annoying of our bugs. |
A user reached out and gave us some detailed information about Marker click as seen here |
Closing, we are looking into improving our currently used dependency from Almeros. |
My touch input handling code needs a lot of work. It is very messy and should perhaps be moved into another class.
We also need to add any missing gestures from Google Maps eg fling. We should match their 'feel' so that Android users can pick up and use our map with minimal learning
Finally the two finger rotation gesture is broken.
The text was updated successfully, but these errors were encountered: