1
0
mirror of https://github.com/vector-im/riotX-android synced 2025-10-06 00:02:48 +02:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Johannes Marbach
fced3de8ef Stop recording via playback tracker when it ends
Signed-off-by: Johannes Marbach <johannesm@element.io>
2022-08-08 08:56:04 +02:00
Johannes Marbach
14d85519c9 Also clear the view when unbinding MessageVoiceItem
Signed-off-by: Johannes Marbach <johannesm@element.io>
2022-08-05 16:17:12 +02:00
Johannes Marbach
3085afed8c Clear wave form view before rendering new wave form
Signed-off-by: Johannes Marbach <johannesm@element.io>
2022-08-05 13:25:08 +02:00
Johannes Marbach
fc79fa72f3 Use syntactic sugar
Signed-off-by: Johannes Marbach <johannesm@element.io>
2022-08-04 17:51:59 +02:00
Johannes Marbach
7df8e911c1 Merge branch 'develop' into feature/voice-message-max-length 2022-08-04 17:47:48 +02:00
Johannes Marbach
ad29f81d54 Rename changelog file
Signed-off-by: Johannes Marbach <johannesm@element.io>
2022-08-04 13:55:04 +02:00
Johannes Marbach
fd24813b0b Add changelog
Signed-off-by: Johannes Marbach <johannesm@element.io>
2022-08-04 13:40:37 +02:00
Johannes Marbach
39b6ab7a6c Increase max length of voice messages to 15m (PSG-663)
Relates to: vector-im/element-ios#5415

Signed-off-by: Johannes Marbach <johannesm@element.io>
2022-08-04 13:36:34 +02:00
6 changed files with 16 additions and 3 deletions

1
changelog.d/6738.misc Normal file
View File

@@ -0,0 +1 @@
Increase max length of voice messages to 15m (PSG-663)

View File

@@ -16,6 +16,8 @@
package im.vector.app.config
import kotlin.time.Duration.Companion.minutes
/**
* Set of flags to configure the application.
*/
@@ -43,7 +45,7 @@ object Config {
/**
* The maximum length of voice messages in milliseconds.
*/
const val VOICE_MESSAGE_LIMIT_MS = 120_000L
val VOICE_MESSAGE_LIMIT_MS = 15.minutes.inWholeMilliseconds
/**
* The strategy for sharing device keys.

View File

@@ -79,6 +79,7 @@ class AudioMessageHelper @Inject constructor(
}
fun stopRecording(): MultiPickerAudioType? {
playbackTracker.stopRecording(AudioMessagePlaybackTracker.RECORDING_ID)
tryOrNull("Cannot stop media recording amplitude") {
stopRecordingAmplitudes()
}
@@ -110,11 +111,13 @@ class AudioMessageHelper @Inject constructor(
* When entering in playback mode actually.
*/
fun pauseRecording() {
playbackTracker.stopRecording(AudioMessagePlaybackTracker.RECORDING_ID)
voiceRecorder.stopRecord()
stopRecordingAmplitudes()
}
fun deleteRecording() {
playbackTracker.stopRecording(AudioMessagePlaybackTracker.RECORDING_ID)
tryOrNull("Cannot stop media recording amplitude") {
stopRecordingAmplitudes()
}

View File

@@ -348,8 +348,10 @@ class VoiceMessageViews(
fun renderRecordingWaveform(amplitudeList: List<Int>) {
views.voicePlaybackWaveform.doOnLayout { waveFormView ->
val waveformColor = ThemeUtils.getColor(waveFormView.context, R.attr.vctr_content_quaternary)
val view = waveFormView as AudioWaveformView
view.clear()
amplitudeList.forEach {
(waveFormView as AudioWaveformView).add(AudioWaveformView.FFT(it.toFloat(), waveformColor))
view.add(AudioWaveformView.FFT(it.toFloat(), waveformColor))
}
}
}

View File

@@ -116,6 +116,10 @@ class AudioMessagePlaybackTracker @Inject constructor() {
setState(id, Listener.State.Recording(amplitudeList))
}
fun stopRecording(id: String) {
setState(id, Listener.State.Idle)
}
fun getPlaybackState(id: String) = states[id]
fun getPlaybackTime(id: String): Int {

View File

@@ -161,10 +161,11 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
private fun formatPlaybackTime(time: Int) = DateUtils.formatElapsedTime((time / 1000).toLong())
override fun unbind(holder: Holder) {
super.unbind(holder)
holder.voicePlaybackWaveform.clear()
contentUploadStateTrackerBinder.unbind(attributes.informationData.eventId)
contentDownloadStateTrackerBinder.unbind(mxcUrl)
audioMessagePlaybackTracker.untrack(attributes.informationData.eventId)
super.unbind(holder)
}
override fun getViewStubId() = STUB_ID