From 9a3d2ad1caff9ae6c0da8f28037ac49330b74cb6 Mon Sep 17 00:00:00 2001 From: Daniel Cohen Gindi Date: Fri, 23 Oct 2015 15:12:36 +0300 Subject: [PATCH] Moved highlightTouch logic to highlightValue & deprecated highlightTouch --- .../mikephil/charting/charts/Chart.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/MPChartLib/src/com/github/mikephil/charting/charts/Chart.java b/MPChartLib/src/com/github/mikephil/charting/charts/Chart.java index a5eec8893..5745b32df 100644 --- a/MPChartLib/src/com/github/mikephil/charting/charts/Chart.java +++ b/MPChartLib/src/com/github/mikephil/charting/charts/Chart.java @@ -572,14 +572,12 @@ public void highlightValue(int xIndex, int dataSetIndex) { /** * Highlights the values represented by the provided Highlight object + * This DOES NOT generate a callback to the OnChartValueSelectedListener. * * @param highlight contains information about which entry should be highlighted */ public void highlightValue(Highlight highlight) { - if (highlight == null) - highlightValues(null); - else - highlightValues(new Highlight[]{highlight}); + highlightValue(highlight); } /** @@ -587,9 +585,10 @@ public void highlightValue(Highlight highlight) { * highlightValues(...), this generates a callback to the * OnChartValueSelectedListener. * - * @param high + * @param high - the highlight object + * @param callListener - call the listener */ - public void highlightTouch(Highlight high) { + public void highlightValue(Highlight high, boolean callListener) { Entry e = null; @@ -612,7 +611,7 @@ public void highlightTouch(Highlight high) { } } - if (mSelectionListener != null) { + if (callListener && mSelectionListener != null) { if (!valuesToHighlight()) mSelectionListener.onNothingSelected(); @@ -625,6 +624,14 @@ public void highlightTouch(Highlight high) { invalidate(); } + /** + * Deprecated. Calls highlightValue(high, true) + */ + @Deprecated + public void highlightTouch(Highlight high) { + highlightValue(high, true); + } + /** * Set a new (e.g. custom) ChartTouchListener NOTE: make sure to * setTouchEnabled(true); if you need touch gestures on the chart