onClick not detected on Android


#1

Hello,

I have a pretty typical situation

ShinobiChart shinobiChart = chart.getShinobiChart();
	...
	ShinobiChartListener listener = new ShinobiChartListener(); //custom which implements all ShinobiCallback interfaces
	shinobiChartLandscape.setOnPanZoomGestureListener(listener);
	shinobiChartLandscape.setOnAxisMotionStateChangeListener(listener);
	shinobiChartLandscape.setOnAxisRangeChangeListener(listener);
	chart.setOnClickListener(listener);

The onPanZoomGesure, Axis Motion, and Axis Range all work, however i cannot seem to forward the onClick.

Any ideas?


#2

I have the same problem with onTouchListener, I would like to detect a double tap.


#3

Hi AEB and harmelzinga,

The forthcoming V1.2 release (due out in 2 weeks) will include Selection and Crosshair, which along with the existing Pan and Zoom are the major interaction-based features. Part of this work will be to provide listeners for the remaining touch events. The basic structure of these is to provide notifications at 2 levels (this structure is evident in the snippet AEB provided above): 

At the functional level you can receive callbacks from axes about range changes and motion state changes, and from series about selection changes, etc. These tell you about what the chart is doing in response to touch events, and are likely to be the most useful things to listen to. Generally you will listen to these individually - the interfaces tend to have one method only.

At the touch level you can receive callbacks about the gestures themselves. These may be useful if you are adding non-chart functionality based on specific gestures. Implementation-wise, in V1.2 we are going to add a new ShinobiChart.OnChartGestureListener interface, containing methods for all the gestures we recognise, and we will deprecate the ShinobiChart.OnPanZoomGestureListener interface. I’ve bumped a recent forum post that explains our policy on API changes.

Best Regards,

Robin Sillem


#4

Thanks again Robin.  I’m not clear from your answer if the callbacks from the series about selections are currently available, or coming in the next update.  If they are could you give a brief explanation of their intended use.


#5

Hi AEB,

Sorry I was a bit unclear - the callbacks are not currently available, but will be in V1.2. As it turns out, Selection is the feature I have assigned to myself for this release, and the notification element of it is not yet started - I’m currently working on the actual behaviour in response to gestures. When I do get onto the notification part, I will be implementing it using a pattern very similar to the way pan/zoom/axis notifications are handled, with a listener interface to notifiy you of the gestures themselves, and separate listener interfaces to notify you of the changes that occur in the chart as a result of the gestures.

In terms of use cases, I’d expect people to be writing code that (for instance) responds to the change in the selection state of a series, maybe updating some other view with information about the data the series represents, or whatever their app requires. I’d expect less use of the actual gesture listener, as this will simply tell you that the user has tapped at some location, without giving much idea of the context of effect of the tap. 

Having said that, i’m also confident that those expectations will be confounded - it’s alway interesting and surprising to find out what people actually do with our charts! In your snippet above you’re listening to everything, which is only necessary if you’re actully going to do something as a result of each callback. You’re not finding onClick because we have no use for it in the context of pan and zoom - that’s all swipe and fling - but we will have some equivalent in when Selection is done.

Best regards,

Robin Sillem


#6

Thanks Robin,

The listenening to everything was more of a debug idea.  My use case was as follow:

Click graph and it pauses the graphing (which is live) and populates a menu.  I’ve worked around this by inflating a custom view to act as my pause menu,which is replaced during pause.

Once the graph is paused panning would create a crosshair to display the value at that part of the line.

Hopefully that will be covered in the update, I dont think its anything outside of the normal use (I hope =])

Regards,

AEB


#7

Thanks, I will wait for 1.2 for these features.