Merge pull request #11098 from osmandapp/fix_10394

Fix_10394
This commit is contained in:
Vitaliy 2021-03-10 15:36:27 +02:00 committed by GitHub
commit c0e769b746
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,9 +1,7 @@
package net.osmand.plus.mapcontextmenu.other; package net.osmand.plus.mapcontextmenu.other;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.Pair; import android.util.Pair;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -20,7 +18,6 @@ import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData; import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.highlight.Highlight; import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.github.mikephil.charting.listener.BarLineChartTouchListener;
import com.github.mikephil.charting.listener.ChartTouchListener.ChartGesture; import com.github.mikephil.charting.listener.ChartTouchListener.ChartGesture;
import com.github.mikephil.charting.listener.OnChartGestureListener; import com.github.mikephil.charting.listener.OnChartGestureListener;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener; import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
@ -611,39 +608,39 @@ public class TrackDetailsMenu {
} }
}); });
final float minDragTriggerDist = AndroidUtils.dpToPx(app, 3); // final float minDragTriggerDist = AndroidUtils.dpToPx(app, 3);
chart.setOnTouchListener(new BarLineChartTouchListener(chart, chart.getViewPortHandler().getMatrixTouch(), 3f) { // chart.setOnTouchListener(new BarLineChartTouchListener(chart, chart.getViewPortHandler().getMatrixTouch(), 3f) {
private PointF touchStartPoint = new PointF(); // private PointF touchStartPoint = new PointF();
//
@SuppressLint("ClickableViewAccessibility") // @SuppressLint("ClickableViewAccessibility")
@Override // @Override
public boolean onTouch(View v, MotionEvent event) { // public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction() & MotionEvent.ACTION_MASK) { // switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: // case MotionEvent.ACTION_DOWN:
saveTouchStart(event); // saveTouchStart(event);
break; // break;
case MotionEvent.ACTION_POINTER_DOWN: // case MotionEvent.ACTION_POINTER_DOWN:
if (event.getPointerCount() >= 2) { // if (event.getPointerCount() >= 2) {
saveTouchStart(event); // saveTouchStart(event);
} // }
break; // break;
case MotionEvent.ACTION_MOVE: // case MotionEvent.ACTION_MOVE:
if (mTouchMode == NONE && mChart.hasNoDragOffset()) { // if (mTouchMode == NONE && mChart.hasNoDragOffset()) {
float touchDistance = distance(event.getX(), touchStartPoint.x, event.getY(), touchStartPoint.y); // float touchDistance = distance(event.getX(), touchStartPoint.x, event.getY(), touchStartPoint.y);
if (Math.abs(touchDistance) > minDragTriggerDist) { // if (Math.abs(touchDistance) > minDragTriggerDist) {
mTouchMode = DRAG; // mTouchMode = DRAG;
} // }
} // }
break; // break;
} // }
return super.onTouch(v, event); // return super.onTouch(v, event);
} // }
//
private void saveTouchStart(MotionEvent event) { // private void saveTouchStart(MotionEvent event) {
touchStartPoint.x = event.getX(); // touchStartPoint.x = event.getX();
touchStartPoint.y = event.getY(); // touchStartPoint.y = event.getY();
} // }
}); // });
chart.setOnChartGestureListener(new OnChartGestureListener() { chart.setOnChartGestureListener(new OnChartGestureListener() {
boolean hasTranslated = false; boolean hasTranslated = false;
float highlightDrawX = -1; float highlightDrawX = -1;