prepend remaining time with a Minus sign at negative time

This commit is contained in:
tibbi 2018-03-09 22:49:23 +01:00
parent 5878af2cc5
commit 5315c56661
2 changed files with 11 additions and 2 deletions

View File

@ -41,7 +41,7 @@ android {
} }
dependencies { 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.facebook.stetho:stetho:1.5.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.shawnlin:number-picker:2.4.6' implementation 'com.shawnlin:number-picker:2.4.6'

View File

@ -147,7 +147,16 @@ class TimerFragment : Fragment() {
} }
private fun updateDisplayedText() { 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 { private val updateRunnable = object : Runnable {