From ccfa82b096973d40ecd4193fddbc18aaa4483cb2 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Tue, 29 Jul 2025 15:22:49 +0300 Subject: [PATCH] Improved display of call history time --- .../kotlin/com/tutpro/baresip/CallsScreen.kt | 37 +++++++++---------- .../main/kotlin/com/tutpro/baresip/Utils.kt | 4 +- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt index 4a8d23ac..eb99fc13 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt @@ -407,26 +407,23 @@ private fun Calls( ) } } - Box(modifier = Modifier.width(56.dp)) { - Text( - text = Utils.relativeTime(ctx, callRow.stopTime), - fontSize = 12.sp, - minLines = 2, maxLines = 2, - lineHeight = 16.sp, - textAlign = TextAlign.End, - color = if (recordings) - LocalCustomColors.current.accent - else - LocalCustomColors.current.itemText, - modifier = Modifier - .padding(end = 16.dp) - .width(64.dp) - .clickable(onClick = { - viewModel.selectCallRow(callRow) - navController.navigate("call_details") - }) - ) - } + Text( + text = Utils.relativeTime(ctx, callRow.stopTime), + fontSize = 12.sp, + minLines = 2, maxLines = 2, + lineHeight = 16.sp, + textAlign = TextAlign.End, + color = if (recordings) + LocalCustomColors.current.accent + else + LocalCustomColors.current.itemText, + modifier = Modifier + .padding(end = 16.dp) + .clickable(onClick = { + viewModel.selectCallRow(callRow) + navController.navigate("call_details") + }) + ) } } } diff --git a/app/src/main/kotlin/com/tutpro/baresip/Utils.kt b/app/src/main/kotlin/com/tutpro/baresip/Utils.kt index ef922d05..984ccebf 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/Utils.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/Utils.kt @@ -61,6 +61,7 @@ import javax.crypto.SecretKeyFactory import javax.crypto.spec.IvParameterSpec import javax.crypto.spec.PBEKeySpec import javax.crypto.spec.SecretKeySpec +import kotlin.text.replaceFirstChar object Utils { @@ -804,7 +805,8 @@ object Utils { val fmt = DateFormat.getTimeInstance(DateFormat.SHORT) ctx.getString(R.string.today) + "\n" + fmt.format(time.time) } else { - val month = time.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.getDefault()) + val month = time.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.getDefault())!! + .replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() } val day = time.get(Calendar.DAY_OF_MONTH) val currentYear = Calendar.getInstance().get(Calendar.YEAR) if (time.get(Calendar.YEAR) == currentYear) {