Skip to content

Commit

Permalink
- Fixed bug with occasional crash with stop
Browse files Browse the repository at this point in the history
- Implement MediaRecorderState handling
- Fixed lifecycle bug - recording and locked UI now ends after app exits
- Saves Waveform to storage after initial loading

Signed-off-by: Julius Linus <[email protected]>
  • Loading branch information
rapterjet2004 committed Nov 24, 2023
1 parent cc9ee09 commit 842dd03
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) :
this.message = message
sharedApplication!!.componentApplication.inject(this)

val filename = message.selectedIndividualHashMap!!["name"]
val retrieved = appPreferences!!.getWaveFormFromFile(filename)
if (retrieved.isNotEmpty() &&
message.voiceMessageFloatArray == null ||
message.voiceMessageFloatArray!!.isEmpty()
) {
message.voiceMessageFloatArray = retrieved.toFloatArray()
binding.seekbar.setWaveData(message.voiceMessageFloatArray!!)
}
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)

setAvatarAndAuthorOnMessageItem(message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) :
this.message = message
sharedApplication!!.componentApplication.inject(this)
viewThemeUtils.platform.colorTextView(binding.messageTime, ColorRole.ON_SURFACE_VARIANT)

val filename = message.selectedIndividualHashMap!!["name"]
val retrieved = appPreferences!!.getWaveFormFromFile(filename)
if (retrieved.isNotEmpty() &&
message.voiceMessageFloatArray == null ||
message.voiceMessageFloatArray!!.isEmpty()
) {
Log.d("Julius", "Retrieved and set ${retrieved.contentToString()}")
message.voiceMessageFloatArray = retrieved.toFloatArray()
binding.seekbar.setWaveData(message.voiceMessageFloatArray!!)
}

binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)

colorizeMessageBubble(message)
Expand Down
Loading

0 comments on commit 842dd03

Please sign in to comment.