small fixes

This commit is contained in:
nazar-kutz 2020-11-05 02:04:25 +02:00
parent bd45e5aba8
commit b1ddd40ec8
3 changed files with 9 additions and 7 deletions

View file

@ -42,7 +42,7 @@ import net.osmand.router.RouteSegmentResult;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Collections;
import java.util.List; import java.util.List;
import static net.osmand.GPXUtilities.GPXFile; import static net.osmand.GPXUtilities.GPXFile;
@ -107,7 +107,7 @@ public class GraphsCard extends BaseCard implements OnUpdateAdditionalInfoListen
} }
}); });
GraphAdapterHelper.bindGraphAdapters(commonGraphAdapter, Arrays.asList((BaseGraphAdapter) customGraphAdapter), (ViewGroup) view); GraphAdapterHelper.bindGraphAdapters(commonGraphAdapter, Collections.singletonList((BaseGraphAdapter) customGraphAdapter), (ViewGroup) view);
refreshMapCallback = GraphAdapterHelper.bindToMap(commonGraphAdapter, mapActivity, trackDetailsMenu); refreshMapCallback = GraphAdapterHelper.bindToMap(commonGraphAdapter, mapActivity, trackDetailsMenu);
fullUpdate(); fullUpdate();
} }

View file

@ -29,7 +29,7 @@ import net.osmand.router.RouteStatisticsHelper.RouteSegmentAttribute;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Collections;
import java.util.List; import java.util.List;
import static net.osmand.plus.track.ColorsCard.MINIMUM_CONTRAST_RATIO; import static net.osmand.plus.track.ColorsCard.MINIMUM_CONTRAST_RATIO;
@ -122,7 +122,7 @@ public class CustomGraphAdapter extends BaseGraphAdapter<HorizontalBarChart, Bar
case ONE_ELEMENT: case ONE_ELEMENT:
for (RouteSegmentAttribute segment : getSegmentsList()) { for (RouteSegmentAttribute segment : getSegmentsList()) {
if (segment.getPropertyName().equals(selectedPropertyName)) { if (segment.getPropertyName().equals(selectedPropertyName)) {
attachLegend(Arrays.asList(segment), null); attachLegend(Collections.singletonList(segment), null);
break; break;
} }
} }

View file

@ -16,6 +16,8 @@ import com.github.mikephil.charting.listener.ChartTouchListener;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu; import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
import net.osmand.plus.measurementtool.graph.BaseGraphAdapter.ExternalValueSelectedListener;
import net.osmand.plus.measurementtool.graph.BaseGraphAdapter.ExternalGestureListener;
import java.util.List; import java.util.List;
@ -41,7 +43,7 @@ public class GraphAdapterHelper {
} }
for (BaseGraphAdapter adapter : otherGraphAdapters) { for (BaseGraphAdapter adapter : otherGraphAdapters) {
if (adapter.getChart() != null) { if (adapter.getChart() != null) {
final MotionEvent event = MotionEvent.obtainNoHistory(ev); MotionEvent event = MotionEvent.obtainNoHistory(ev);
event.setSource(0); event.setSource(0);
adapter.getChart().dispatchTouchEvent(event); adapter.getChart().dispatchTouchEvent(event);
} }
@ -52,7 +54,7 @@ public class GraphAdapterHelper {
mainChart.setOnTouchListener(mainChartTouchListener); mainChart.setOnTouchListener(mainChartTouchListener);
mainGraphAdapter.addValueSelectedListener(BIND_GRAPH_ADAPTERS_KEY, mainGraphAdapter.addValueSelectedListener(BIND_GRAPH_ADAPTERS_KEY,
new CommonGraphAdapter.ExternalValueSelectedListener() { new ExternalValueSelectedListener() {
@Override @Override
public void onValueSelected(Entry e, Highlight h) { public void onValueSelected(Entry e, Highlight h) {
for (BaseGraphAdapter adapter : otherGraphAdapters) { for (BaseGraphAdapter adapter : otherGraphAdapters) {
@ -126,7 +128,7 @@ public class GraphAdapterHelper {
} }
}); });
graphAdapter.setExternalGestureListener(new CommonGraphAdapter.ExternalGestureListener() { graphAdapter.setExternalGestureListener(new ExternalGestureListener() {
@Override @Override
public void onChartGestureStart(MotionEvent me, ChartTouchListener.ChartGesture lastPerformedGesture) { public void onChartGestureStart(MotionEvent me, ChartTouchListener.ChartGesture lastPerformedGesture) {
} }