mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Code documentation.
This commit is contained in:
parent
b262aad3a8
commit
aa344b1ecd
1 changed files with 7 additions and 0 deletions
|
@ -94,6 +94,13 @@ object TextUtils {
|
|||
return formatDurationWithUnits(duration, stringProvider::getString)
|
||||
}
|
||||
|
||||
/**
|
||||
* We don't always have Context to get strings or we want to use StringProvider instead.
|
||||
* So we can pass the getString function either from Context or the StringProvider.
|
||||
* @param duration duration to be formatted
|
||||
* @param getString getString method from Context or StringProvider
|
||||
* @return formatted duration with a localized form like "10h 30min 5sec"
|
||||
*/
|
||||
private fun formatDurationWithUnits(duration: Duration, getString: ((Int) -> String)): String {
|
||||
val hours = getHours(duration)
|
||||
val minutes = getMinutes(duration)
|
||||
|
|
Loading…
Reference in a new issue