From 315a6f696d661288a8761f4d6c4b4571fbbdabd7 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 19 Jun 2020 18:19:54 +0300 Subject: [PATCH] Minor UI fixes for gpx context menu --- .../builders/SelectedGpxMenuBuilder.java | 22 ++++++++++--------- .../src/net/osmand/plus/views/GPXLayer.java | 10 ++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/SelectedGpxMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/SelectedGpxMenuBuilder.java index 29c54f5b90..ab122b1bac 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/SelectedGpxMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/SelectedGpxMenuBuilder.java @@ -53,10 +53,10 @@ public class SelectedGpxMenuBuilder extends MenuBuilder { @Override public void buildInternal(View view) { + buildPointRows(view); buildOverviewRows(view); buildElevationRows(view); buildSpeedRows(view); - buildPointRows(view); } public void buildOverviewRows(View view) { @@ -68,16 +68,18 @@ public class SelectedGpxMenuBuilder extends MenuBuilder { String timeSpan = Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled()); String timeMoving = Algorithms.formatDuration((int) (analysis.timeMoving / 1000), app.accessibilityEnabled()); - String title = app.getString(R.string.shared_string_time_span) + " / " + app.getString(R.string.shared_string_time_moving); - buildRow(view, getThemedIcon(R.drawable.ic_action_time_span), null, title, + String timeSpanTitle = app.getString(R.string.shared_string_time_span) + " / " + app.getString(R.string.shared_string_time_moving); + buildRow(view, getThemedIcon(R.drawable.ic_action_time_span), null, timeSpanTitle, timeSpan + " / " + timeMoving, 0, null, false, null, false, 0, false, false, false, null, false); Date start = new Date(analysis.startTime); Date end = new Date(analysis.endTime); DateFormat format = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); - buildRow(view, getThemedIcon(R.drawable.ic_action_time_start), null, app.getString(R.string.shared_string_start_time), - format.format(start) + " / " + format.format(end), 0, null, + + String startEndTimeTitle = app.getString(R.string.shared_string_start_time) + " - " + app.getString(R.string.shared_string_end_time); + buildRow(view, getThemedIcon(R.drawable.ic_action_time_start), null, startEndTimeTitle, + format.format(start) + " - " + format.format(end), 0, null, false, null, false, 0, false, false, false, null, true); } @@ -100,6 +102,10 @@ public class SelectedGpxMenuBuilder extends MenuBuilder { buildRow(view, getThemedIcon(R.drawable.ic_action_altitude_descent), null, app.getString(R.string.ascent_descent), asc + " / " + desc, 0, null, false, null, false, 0, false, false, false, null, true); + + buildRow(view, getThemedIcon(R.drawable.ic_action_altitude_descent), null, app.getString(R.string.distance_moving), + OsmAndFormatter.getFormattedDistance(analysis.totalDistanceMoving, app), 0, null, + false, null, false, 0, false, false, false, null, true); } } @@ -114,10 +120,6 @@ public class SelectedGpxMenuBuilder extends MenuBuilder { buildRow(view, getThemedIcon(R.drawable.ic_action_max_speed), null, app.getString(R.string.max_speed), OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app), 0, null, false, null, false, 0, false, false, false, null, false); - - buildRow(view, getThemedIcon(R.drawable.ic_action_altitude_descent), null, app.getString(R.string.distance_moving), - OsmAndFormatter.getFormattedDistance(analysis.totalDistanceMoving, app), 0, null, - false, null, false, 0, false, false, false, null, true); } } @@ -140,7 +142,7 @@ public class SelectedGpxMenuBuilder extends MenuBuilder { false, null, false, 0, false, false, false, null, false); } if (!Double.isNaN(selectedPoint.speed)) { - buildRow(view, getThemedIcon(R.drawable.ic_action_speed), null, app.getString(R.string.average_speed), + buildRow(view, getThemedIcon(R.drawable.ic_action_speed), null, app.getString(R.string.map_widget_speed), OsmAndFormatter.getFormattedSpeed((float) selectedPoint.speed, app), 0, null, false, null, false, 0, false, false, false, null, false); } diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index 62c7795979..f61d0e56b7 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -673,17 +673,17 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM projectionPoint.time = (long) getValueByDistInterpolation(projectionPoint.distance, prevPoint.distance, prevPoint.time, nextPoint.distance, nextPoint.time); } - Location projectionLocation = new Location(""); - projectionLocation.setLatitude(projectionPoint.lat); - projectionLocation.setLongitude(projectionPoint.lon); + Location prevPointLocation = new Location(""); + prevPointLocation.setLatitude(prevPoint.lat); + prevPointLocation.setLongitude(prevPoint.lon); Location nextPointLocation = new Location(""); nextPointLocation.setLatitude(nextPoint.lat); nextPointLocation.setLongitude(nextPoint.lon); - projectionLocation.setBearing(projectionLocation.bearingTo(nextPointLocation)); + prevPointLocation.setBearing(prevPointLocation.bearingTo(nextPointLocation)); - return new SelectedGpxPoint(selectedGpxFile, projectionPoint, projectionLocation); + return new SelectedGpxPoint(selectedGpxFile, projectionPoint, prevPointLocation); } private double getValueByDistInterpolation(double projectionDist, double prevDist, double prevVal, double nextDist, double nextVal) {