Last active
November 4, 2021 00:26
-
-
Save mbobiosio/86c8d32314970fe601da02c3969bd065 to your computer and use it in GitHub Desktop.
Every other useful Kotlin Extension useful for daily stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts milliseconds to formatted mm:ss | |
* | |
* @param value, time in milliseconds. | |
*/ | |
@BindingAdapter("elapsedTime") | |
fun TextView.setElapsedTime(value: Long) { | |
val seconds = value / 1000 | |
text = if (seconds < 60) seconds.toString() | |
else DateUtils.formatElapsedTime(seconds) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment