diff --git a/android/res/layout/elevation_profile.xml b/android/res/layout/elevation_profile.xml index ed3209a5b5..6829ef1243 100644 --- a/android/res/layout/elevation_profile.xml +++ b/android/res/layout/elevation_profile.xml @@ -5,7 +5,7 @@ android:layout_height="@dimen/elevation_profile_height" android:background="?cardBackground" android:orientation="vertical"> - diff --git a/android/src/com/mapswithme/maps/widget/placepage/ElevationProfileChart.java b/android/src/com/mapswithme/maps/widget/placepage/ElevationProfileChart.java new file mode 100644 index 0000000000..fc9869be49 --- /dev/null +++ b/android/src/com/mapswithme/maps/widget/placepage/ElevationProfileChart.java @@ -0,0 +1,37 @@ +package com.mapswithme.maps.widget.placepage; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; + +import com.github.mikephil.charting.charts.LineChart; + +public class ElevationProfileChart extends LineChart +{ + public ElevationProfileChart(Context context) + { + super(context); + } + + public ElevationProfileChart(Context context, AttributeSet attrs) + { + super(context, attrs); + } + + public ElevationProfileChart(Context context, AttributeSet attrs, int defStyle) + { + super(context, attrs, defStyle); + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) + { + getParent().requestDisallowInterceptTouchEvent(true); + return hasZoom() || super.onInterceptTouchEvent(ev); + } + + private boolean hasZoom() + { + return getScaleX() < 1 || getScaleY() < 1; + } +}