You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue might be a duplicate of #172 -- has there been some progress meanwhile?
I want to use RxBindings to implement a custom component which is drawn on canvas. For this, I need clicks, long clicks, double clicks etc. together with the precise location of these events.
What is possible:
react on clicks and long clicks on Views using RxView.clicks() and RxView.longClicks()
react on touch events using RxView.touches() which supplies MotionEvents conveying the position information
However, the combination, detecting a click and having the position of the click at hand seems not to be supported. In particular, a combined approach using something like view.longClicks().withLatestFrom(view.touches()) does not produce any results at all. I guess this is one of the cases which are simply not supported by this project.
[@JakeWharton just started to use Rx* and love the concept, keep up the good work]
The text was updated successfully, but these errors were encountered:
The information provided is the same information that is available to the callback. So if you were using a long click listener callback directly you wouldn't have any touch information. I don't know how you do something like this. Perhaps listen to touches and figure out click/long click timings yourself? And then you have the MotionEvent as to the location. I don't think there's anything the library can do for you though since it's just relaying the events it gets.
I believe an operation like view.longClicks().withLatestFrom(view.touches()) would produce exactly that result in an intuitive way (assuming withLatestFrom(view.touches()) is not too expensive). This approach is probably not working because of an low-level issue regarding the listeners required for this task. I understand that this is something you will not support:
The library is not responsible for supporting multiple observables bound to the same view
Another approach would be to use a GestureDetector and use it as a sink for the touches() events. In turn, the detector could produce different event streams for single clicks, long clicks, double clicks etc (basically everything SimpleOnGestureListener provides). However, this would require an intermediate object (which has to be taken care of ..) plus logic to handle the different streams. So, I guess this is also not in scope of this library.
I conclude that both approaches are unfortunately not in scope of this library. Feel free to close this issue.
This issue might be a duplicate of #172 -- has there been some progress meanwhile?
I want to use RxBindings to implement a custom component which is drawn on canvas. For this, I need clicks, long clicks, double clicks etc. together with the precise location of these events.
What is possible:
RxView.clicks()
andRxView.longClicks()
RxView.touches()
which supplies MotionEvents conveying the position informationHowever, the combination, detecting a click and having the position of the click at hand seems not to be supported. In particular, a combined approach using something like
view.longClicks().withLatestFrom(view.touches())
does not produce any results at all. I guess this is one of the cases which are simply not supported by this project.[@JakeWharton just started to use Rx* and love the concept, keep up the good work]
The text was updated successfully, but these errors were encountered: