Improved display of call history time

This commit is contained in:
Juha Heinanen
2025-07-29 15:22:49 +03:00
parent c79a08e23c
commit ccfa82b096
2 changed files with 20 additions and 21 deletions

View File

@ -407,26 +407,23 @@ private fun Calls(
) )
} }
} }
Box(modifier = Modifier.width(56.dp)) { Text(
Text( text = Utils.relativeTime(ctx, callRow.stopTime),
text = Utils.relativeTime(ctx, callRow.stopTime), fontSize = 12.sp,
fontSize = 12.sp, minLines = 2, maxLines = 2,
minLines = 2, maxLines = 2, lineHeight = 16.sp,
lineHeight = 16.sp, textAlign = TextAlign.End,
textAlign = TextAlign.End, color = if (recordings)
color = if (recordings) LocalCustomColors.current.accent
LocalCustomColors.current.accent else
else LocalCustomColors.current.itemText,
LocalCustomColors.current.itemText, modifier = Modifier
modifier = Modifier .padding(end = 16.dp)
.padding(end = 16.dp) .clickable(onClick = {
.width(64.dp) viewModel.selectCallRow(callRow)
.clickable(onClick = { navController.navigate("call_details")
viewModel.selectCallRow(callRow) })
navController.navigate("call_details") )
})
)
}
} }
} }
} }

View File

@ -61,6 +61,7 @@ import javax.crypto.SecretKeyFactory
import javax.crypto.spec.IvParameterSpec import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.PBEKeySpec import javax.crypto.spec.PBEKeySpec
import javax.crypto.spec.SecretKeySpec import javax.crypto.spec.SecretKeySpec
import kotlin.text.replaceFirstChar
object Utils { object Utils {
@ -804,7 +805,8 @@ object Utils {
val fmt = DateFormat.getTimeInstance(DateFormat.SHORT) val fmt = DateFormat.getTimeInstance(DateFormat.SHORT)
ctx.getString(R.string.today) + "\n" + fmt.format(time.time) ctx.getString(R.string.today) + "\n" + fmt.format(time.time)
} else { } 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 day = time.get(Calendar.DAY_OF_MONTH)
val currentYear = Calendar.getInstance().get(Calendar.YEAR) val currentYear = Calendar.getInstance().get(Calendar.YEAR)
if (time.get(Calendar.YEAR) == currentYear) { if (time.get(Calendar.YEAR) == currentYear) {