Add pause_duration to statistics.

This commit is contained in:
voussoir 2023-03-26 19:31:30 -07:00
parent f7101ff83a
commit f62cebdfaf
2 changed files with 9 additions and 0 deletions

View file

@ -135,6 +135,7 @@ data class TrackStatistics(
val trkpts: ArrayList<Trkpt>,
var distance: Double = 0.0,
var duration: Long = 0,
var pause_duration: Long = 0,
var velocity: Double = 0.0,
var total_ascent: Double = 0.0,
var total_descent: Double = 0.0,
@ -158,6 +159,13 @@ data class TrackStatistics(
min_altitude = trkpt.altitude
continue
}
if (trkpt.time - previous.time > Keys.STOP_OVER_THRESHOLD)
{
pause_duration += (trkpt.time - previous.time)
previous = trkpt
last = trkpt
continue
}
distance += previous.toLocation().distanceTo(trkpt.toLocation())
val ascentdiff = trkpt.altitude - previous.altitude
if (ascentdiff > 0)

View file

@ -504,6 +504,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
distanceView.text = LengthUnitHelper.convertDistanceToString(stats.distance, useImperialUnits)
waypointsView.text = track.trkpts.size.toString()
durationView.text = DateTimeHelper.convertToReadableTime(requireContext(), stats.duration)
recordingPausedView.text = DateTimeHelper.convertToReadableTime(requireContext(), stats.pause_duration)
velocityView.text = LengthUnitHelper.convertToVelocityString(stats.velocity, useImperialUnits)
if (track.trkpts.isNotEmpty())
{