Signed-off-by: Giacomo Pacini <giacomopacini98@gmail.com>
This commit is contained in:
Giacomo Pacini 2024-12-19 12:20:30 +01:00
parent 09925699b7
commit 169dac4045
No known key found for this signature in database
GPG Key ID: 2FBC97406B43D889
5 changed files with 18 additions and 12 deletions

View File

@ -157,7 +157,8 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) :
} }
private fun showVoiceMessageDuration(message: ChatMessage) { private fun showVoiceMessageDuration(message: ChatMessage) {
if (message.voiceMessageDuration > 0) { if (message.voiceMessageDuration > 0) {
binding.voiceMessageDuration.text = android.text.format.DateUtils.formatElapsedTime(message.voiceMessageDuration.toLong()) binding.voiceMessageDuration.text = android.text.format.DateUtils.formatElapsedTime(
message.voiceMessageDuration.toLong())
binding.voiceMessageDuration.visibility = View.VISIBLE binding.voiceMessageDuration.visibility = View.VISIBLE
} else { } else {
binding.voiceMessageDuration.visibility = View.INVISIBLE binding.voiceMessageDuration.visibility = View.INVISIBLE
@ -290,7 +291,8 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) :
} }
private fun colorizeMessageBubble(message: ChatMessage) { private fun colorizeMessageBubble(message: ChatMessage) {
viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped, message.isDeleted, message.wasPlayedVoiceMessage) viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped,
message.isDeleted, message.wasPlayedVoiceMessage)
} }
@Suppress("Detekt.TooGenericExceptionCaught") @Suppress("Detekt.TooGenericExceptionCaught")

View File

@ -198,7 +198,8 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) :
private fun showVoiceMessageDuration(message: ChatMessage) { private fun showVoiceMessageDuration(message: ChatMessage) {
if (message.voiceMessageDuration > 0) { if (message.voiceMessageDuration > 0) {
binding.voiceMessageDuration.text = android.text.format.DateUtils.formatElapsedTime(message.voiceMessageDuration.toLong()) binding.voiceMessageDuration.text = android.text.format.DateUtils.formatElapsedTime(
message.voiceMessageDuration.toLong())
binding.voiceMessageDuration.visibility = View.VISIBLE binding.voiceMessageDuration.visibility = View.VISIBLE
} else { } else {
binding.voiceMessageDuration.visibility = View.INVISIBLE binding.voiceMessageDuration.visibility = View.INVISIBLE
@ -355,7 +356,8 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) :
} }
private fun colorizeMessageBubble(message: ChatMessage) { private fun colorizeMessageBubble(message: ChatMessage) {
viewThemeUtils.talk.themeOutgoingMessageBubble(bubble, message.isGrouped, message.isDeleted, message.wasPlayedVoiceMessage) viewThemeUtils.talk.themeOutgoingMessageBubble(bubble, message.isGrouped,
message.isDeleted, message.wasPlayedVoiceMessage)
} }
fun assignVoiceMessageInterface(voiceMessageInterface: VoiceMessageInterface) { fun assignVoiceMessageInterface(voiceMessageInterface: VoiceMessageInterface) {

View File

@ -1205,7 +1205,8 @@ class ChatActivity :
} }
} }
private fun setUpWaveform(message: ChatMessage, thenPlay: Boolean = true, backgroundPlayAllowed : Boolean = false) { private fun setUpWaveform(message: ChatMessage, thenPlay: Boolean = true,
backgroundPlayAllowed: Boolean = false) {
val filename = message.selectedIndividualHashMap!!["name"] val filename = message.selectedIndividualHashMap!!["name"]
val file = File(context.cacheDir, filename!!) val file = File(context.cacheDir, filename!!)
if (file.exists() && message.voiceMessageFloatArray == null) { if (file.exists() && message.voiceMessageFloatArray == null) {
@ -1614,7 +1615,8 @@ class ChatActivity :
} }
} }
private fun startPlayback(message: ChatMessage, doPlay: Boolean = true, backgroundPlayAllowed : Boolean = false) { private fun startPlayback(message: ChatMessage, doPlay: Boolean = true,
backgroundPlayAllowed: Boolean = false) {
if (!active && !backgroundPlayAllowed) { if (!active && !backgroundPlayAllowed) {
// don't begin to play voice message if screen is not visible anymore. // don't begin to play voice message if screen is not visible anymore.
// this situation might happen if file is downloading but user already left the chatview. // this situation might happen if file is downloading but user already left the chatview.