From 8b628229ed4ab111959bba9c9af2cbc29178a783 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Tue, 12 Apr 2022 15:21:30 +0200 Subject: [PATCH] Do not append 0 values when formatting duration --- .../java/im/vector/app/core/utils/TextUtils.kt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/utils/TextUtils.kt b/vector/src/main/java/im/vector/app/core/utils/TextUtils.kt index bb197b2e9d..f9c33ffe2a 100644 --- a/vector/src/main/java/im/vector/app/core/utils/TextUtils.kt +++ b/vector/src/main/java/im/vector/app/core/utils/TextUtils.kt @@ -93,15 +93,21 @@ object TextUtils { when { hours > 0 -> { appendHours(context, builder, hours) - builder.append(" ") - appendMinutes(context, builder, minutes) - builder.append(" ") - appendSeconds(context, builder, seconds) + if(minutes > 0) { + builder.append(" ") + appendMinutes(context, builder, minutes) + } + if(seconds > 0) { + builder.append(" ") + appendSeconds(context, builder, seconds) + } } minutes > 0 -> { appendMinutes(context, builder, minutes) - builder.append(" ") - appendSeconds(context, builder, seconds) + if(seconds > 0) { + builder.append(" ") + appendSeconds(context, builder, seconds) + } } else -> { appendSeconds(context, builder, seconds)