From 5315c566613f20ca1c928269ebf09d8f9b1e09b7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Mar 2018 22:49:23 +0100 Subject: [PATCH] prepend remaining time with a Minus sign at negative time --- app/build.gradle | 2 +- .../clock/fragments/TimerFragment.kt | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 19723116..81933cbd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -41,7 +41,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:3.15.10' + implementation 'com.simplemobiletools:commons:3.15.11' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.shawnlin:number-picker:2.4.6' diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt index 6153b535..7449d358 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt @@ -147,7 +147,16 @@ class TimerFragment : Fragment() { } private fun updateDisplayedText() { - view.timer_time.text = (initialSecs - totalTicks).getFormattedDuration() + val diff = initialSecs - totalTicks + var formattedDuration = Math.abs(diff).getFormattedDuration() + if (diff < 0) { + formattedDuration = "-$formattedDuration" + } + + view.timer_time.text = formattedDuration + if (diff == 0) { + + } } private val updateRunnable = object : Runnable {