Minor UI fixes for gpx context menu

This commit is contained in:
Vitaliy 2020-06-19 18:19:54 +03:00
parent 55a377cb47
commit 315a6f696d
2 changed files with 17 additions and 15 deletions

View file

@ -53,10 +53,10 @@ public class SelectedGpxMenuBuilder extends MenuBuilder {
@Override @Override
public void buildInternal(View view) { public void buildInternal(View view) {
buildPointRows(view);
buildOverviewRows(view); buildOverviewRows(view);
buildElevationRows(view); buildElevationRows(view);
buildSpeedRows(view); buildSpeedRows(view);
buildPointRows(view);
} }
public void buildOverviewRows(View 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 timeSpan = Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled());
String timeMoving = Algorithms.formatDuration((int) (analysis.timeMoving / 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); 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, title, buildRow(view, getThemedIcon(R.drawable.ic_action_time_span), null, timeSpanTitle,
timeSpan + " / " + timeMoving, 0, null, timeSpan + " / " + timeMoving, 0, null,
false, null, false, 0, false, false, false, null, false); false, null, false, 0, false, false, false, null, false);
Date start = new Date(analysis.startTime); Date start = new Date(analysis.startTime);
Date end = new Date(analysis.endTime); Date end = new Date(analysis.endTime);
DateFormat format = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); 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); 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), buildRow(view, getThemedIcon(R.drawable.ic_action_altitude_descent), null, app.getString(R.string.ascent_descent),
asc + " / " + desc, 0, null, asc + " / " + desc, 0, null,
false, null, false, 0, false, false, false, null, true); 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), buildRow(view, getThemedIcon(R.drawable.ic_action_max_speed), null, app.getString(R.string.max_speed),
OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app), 0, null, OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app), 0, null,
false, null, false, 0, false, false, false, null, false); 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); false, null, false, 0, false, false, false, null, false);
} }
if (!Double.isNaN(selectedPoint.speed)) { 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, OsmAndFormatter.getFormattedSpeed((float) selectedPoint.speed, app), 0, null,
false, null, false, 0, false, false, false, null, false); false, null, false, 0, false, false, false, null, false);
} }

View file

@ -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); projectionPoint.time = (long) getValueByDistInterpolation(projectionPoint.distance, prevPoint.distance, prevPoint.time, nextPoint.distance, nextPoint.time);
} }
Location projectionLocation = new Location(""); Location prevPointLocation = new Location("");
projectionLocation.setLatitude(projectionPoint.lat); prevPointLocation.setLatitude(prevPoint.lat);
projectionLocation.setLongitude(projectionPoint.lon); prevPointLocation.setLongitude(prevPoint.lon);
Location nextPointLocation = new Location(""); Location nextPointLocation = new Location("");
nextPointLocation.setLatitude(nextPoint.lat); nextPointLocation.setLatitude(nextPoint.lat);
nextPointLocation.setLongitude(nextPoint.lon); 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) { private double getValueByDistInterpolation(double projectionDist, double prevDist, double prevVal, double nextDist, double nextVal) {