Minor cleanup.

This commit is contained in:
Anton Chekulaev 2020-10-22 13:55:00 +11:00
parent b6d8898ff9
commit 04c132853a
2 changed files with 6 additions and 8 deletions

View File

@ -116,15 +116,13 @@ class PrepareAttachmentAudioExtrasJob : BaseJob {
}
}
val audioExtras = DatabaseAttachmentAudioExtras(
attachDb.setAttachmentAudioExtras(DatabaseAttachmentAudioExtras(
attachmentId,
rmsValues,
totalDurationMs
)
))
attachDb.setAttachmentAudioExtras(audioExtras)
EventBus.getDefault().post(AudioExtrasUpdatedEvent(audioExtras))
EventBus.getDefault().post(AudioExtrasUpdatedEvent(attachmentIdattachmentId))
}
class Factory : Job.Factory<PrepareAttachmentAudioExtrasJob> {
@ -133,8 +131,8 @@ class PrepareAttachmentAudioExtrasJob : BaseJob {
}
}
/** Dispatched once the audio extras have been updated. */
data class AudioExtrasUpdatedEvent(val audioExtras: DatabaseAttachmentAudioExtras)
/** Gets dispatched once the audio extras have been updated. */
data class AudioExtrasUpdatedEvent(val attachmentId: AttachmentId)
@RequiresApi(Build.VERSION_CODES.M)
private class InputStreamMediaDataSource: MediaDataSource {

View File

@ -290,7 +290,7 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEvent(event: PrepareAttachmentAudioExtrasJob.AudioExtrasUpdatedEvent) {
if (event.audioExtras.attachmentId == obtainDatabaseAttachment()?.attachmentId) {
if (event.attachmentId == obtainDatabaseAttachment()?.attachmentId) {
updateFromAttachmentAudioExtras()
}
}