fix #21, wrong time at stopwatch This lap

This commit is contained in:
tibbi 2018-03-28 23:05:55 +02:00
parent 2810497771
commit 9262e7f072
1 changed files with 11 additions and 0 deletions

View File

@ -76,6 +76,17 @@ class StopwatchFragment : Fragment() {
stopwatch_lap.setOnClickListener {
stopwatch_sorting_indicators_holder.beVisible()
if (laps.isEmpty()) {
val lap = Lap(currentLap++, lapTicks * UPDATE_INTERVAL, totalTicks * UPDATE_INTERVAL)
laps.add(0, lap)
lapTicks = 0
} else {
laps.first().apply {
lapTime = lapTicks * UPDATE_INTERVAL
totalTime = totalTicks * UPDATE_INTERVAL
}
}
val lap = Lap(currentLap++, lapTicks * UPDATE_INTERVAL, totalTicks * UPDATE_INTERVAL)
laps.add(0, lap)
lapTicks = 0