mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Adapts special body text for audio messages
This commit is contained in:
parent
fab78c9a6e
commit
2e716cb8a0
2 changed files with 12 additions and 1 deletions
|
@ -1177,6 +1177,9 @@ class TimelineFragment @Inject constructor(
|
|||
|
||||
val messageContent: MessageContent? = event.getLastMessageContent()
|
||||
val nonFormattedBody = when {
|
||||
messageContent is MessageAudioContent -> {
|
||||
getAudioContentBodyText(messageContent)
|
||||
}
|
||||
messageContent is MessageAudioContent && messageContent.voiceMessageIndicator != null -> {
|
||||
val formattedDuration = DateUtils.formatElapsedTime(((messageContent.audioInfo?.duration ?: 0) / 1000).toLong())
|
||||
getString(R.string.voice_message_reply_content, formattedDuration)
|
||||
|
@ -1225,6 +1228,14 @@ class TimelineFragment @Inject constructor(
|
|||
focusComposerAndShowKeyboard()
|
||||
}
|
||||
|
||||
private fun getAudioContentBodyText(messageContent: MessageAudioContent): String {
|
||||
val formattedDuration = DateUtils.formatElapsedTime(((messageContent.audioInfo?.duration ?: 0) / 1000).toLong())
|
||||
return if (messageContent.voiceMessageIndicator != null)
|
||||
getString(R.string.voice_message_reply_content, formattedDuration)
|
||||
else
|
||||
getString(R.string.audio_message_reply_content, messageContent.body, formattedDuration)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
notificationDrawerManager.setCurrentRoom(timelineArgs.roomId)
|
||||
|
|
|
@ -2862,7 +2862,7 @@
|
|||
<string name="a11y_pause_audio_message">Pause Audio Message</string>
|
||||
<string name="error_audio_message_unable_to_play">Pause Audio Message</string>
|
||||
<string name="error_audio_message_cannot_reply_or_edit">Cannot reply or edit while audio message is active</string>
|
||||
<string name="audio_message_reply_content">Audio Message (%1$s)</string>
|
||||
<string name="audio_message_reply_content">%1$s (%2$s)</string>
|
||||
|
||||
<string name="upgrade_room_for_restricted">Anyone in %s will be able to find and join this room - no need to manually invite everyone. You’ll be able to change this in room settings anytime.</string>
|
||||
<string name="upgrade_room_for_restricted_no_param">Anyone in a parent space will be able to find and join this room - no need to manually invite everyone. You’ll be able to change this in room settings anytime.</string>
|
||||
|
|
Loading…
Reference in a new issue