-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio files in the timeline now appear with the audio player #5586
Merged
Merged
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
00bced9
Changes unTrack to untrack
ericdecanini cde10ca
Fixes wrong spellings in Message file and voice items
ericdecanini 2617632
Fixes epoxy errors with renamed epoxy attributes
ericdecanini d54b465
Uses messageVoiceItem for audio files
ericdecanini fab78c9
Refactors MessageAudioItem to work for both audio files and voice mes…
ericdecanini 2e716cb
Adapts special body text for audio messages
ericdecanini 7a7d36d
Renames functions and variables
ericdecanini ff26829
Adds new audio timeline stub
ericdecanini 5a819bb
Merge remote-tracking branch 'origin/develop' into feature/eric/audio…
ericdecanini c9946b6
Code cleanup
ericdecanini 06468a4
Adds changelog file
ericdecanini b035911
Fixes import lint error
ericdecanini 249db18
Removes ic_headphones
ericdecanini 82cde16
Merge remote-tracking branch 'origin/develop' into feature/eric/audio…
ericdecanini 806af47
Fixes post merge errors
ericdecanini c8a56d6
Merge remote-tracking branch 'origin/develop' into feature/eric/audio…
ericdecanini 313595e
Fixes textview layout bounds in item_timeline_event_audio_stub
ericdecanini 8aaaf80
Fixes lint error
ericdecanini 931c0e9
Improves accessibility talkback on MessageAudioItem
ericdecanini fa56a5e
Fixes playback button state not tracking after onPause
ericdecanini cc5e8f3
Improves code formatting
ericdecanini 6adf487
Fixes bugs related to audio message duration being set incorrectly be…
ericdecanini 8ad4f20
Fixes bug where audio can be played before waveform is ready
ericdecanini 34dcd70
Adds layout with seek bar to audio stub
ericdecanini d0155c9
Adds proper handling of audio seek bar
ericdecanini 76b2cfd
Readds onPermissionDeniedSnackbar import in TimelineFragment
ericdecanini dc36301
Improves accessibility on MessageAudioItem
ericdecanini 355db98
Updates some text sizes and colours in audio timeline item
ericdecanini 4159850
Removes underline in audio filename
ericdecanini d9f2033
Removes unused import
ericdecanini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Adds the ability for audio attachments to be played in the timeline | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,10 +154,11 @@ import im.vector.app.features.home.room.detail.timeline.action.EventSharedAction | |
import im.vector.app.features.home.room.detail.timeline.action.MessageActionsBottomSheet | ||
import im.vector.app.features.home.room.detail.timeline.action.MessageSharedActionViewModel | ||
import im.vector.app.features.home.room.detail.timeline.edithistory.ViewEditHistoryBottomSheet | ||
import im.vector.app.features.home.room.detail.timeline.helper.AudioMessagePlaybackTracker | ||
import im.vector.app.features.home.room.detail.timeline.helper.MatrixItemColorProvider | ||
import im.vector.app.features.home.room.detail.timeline.helper.VoiceMessagePlaybackTracker | ||
import im.vector.app.features.home.room.detail.timeline.image.buildImageContentRendererData | ||
import im.vector.app.features.home.room.detail.timeline.item.AbsMessageItem | ||
import im.vector.app.features.home.room.detail.timeline.item.MessageAudioItem | ||
import im.vector.app.features.home.room.detail.timeline.item.MessageFileItem | ||
import im.vector.app.features.home.room.detail.timeline.item.MessageImageVideoItem | ||
import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData | ||
|
@@ -260,7 +261,7 @@ class TimelineFragment @Inject constructor( | |
private val roomDetailPendingActionStore: RoomDetailPendingActionStore, | ||
private val pillsPostProcessorFactory: PillsPostProcessor.Factory, | ||
private val callManager: WebRtcCallManager, | ||
private val voiceMessagePlaybackTracker: VoiceMessagePlaybackTracker, | ||
private val audioMessagePlaybackTracker: AudioMessagePlaybackTracker, | ||
private val clock: Clock, | ||
private val matrixConfiguration: MatrixConfiguration | ||
) : | ||
|
@@ -728,7 +729,7 @@ class TimelineFragment @Inject constructor( | |
} | ||
|
||
private fun setupVoiceMessageView() { | ||
voiceMessagePlaybackTracker.track(VoiceMessagePlaybackTracker.RECORDING_ID, views.voiceMessageRecorderView) | ||
audioMessagePlaybackTracker.track(AudioMessagePlaybackTracker.RECORDING_ID, views.voiceMessageRecorderView) | ||
views.voiceMessageRecorderView.callback = object : VoiceMessageRecorderView.Callback { | ||
|
||
override fun onVoiceRecordingStarted() { | ||
|
@@ -785,13 +786,13 @@ class TimelineFragment @Inject constructor( | |
|
||
override fun onVoiceWaveformTouchedUp(percentage: Float, duration: Int) { | ||
messageComposerViewModel.handle( | ||
MessageComposerAction.VoiceWaveformTouchedUp(VoiceMessagePlaybackTracker.RECORDING_ID, duration, percentage) | ||
MessageComposerAction.VoiceWaveformTouchedUp(AudioMessagePlaybackTracker.RECORDING_ID, duration, percentage) | ||
) | ||
} | ||
|
||
override fun onVoiceWaveformMoved(percentage: Float, duration: Int) { | ||
messageComposerViewModel.handle( | ||
MessageComposerAction.VoiceWaveformTouchedUp(VoiceMessagePlaybackTracker.RECORDING_ID, duration, percentage) | ||
MessageComposerAction.VoiceWaveformTouchedUp(AudioMessagePlaybackTracker.RECORDING_ID, duration, percentage) | ||
) | ||
} | ||
|
||
|
@@ -1189,13 +1190,10 @@ class TimelineFragment @Inject constructor( | |
} | ||
|
||
val messageContent: MessageContent? = event.getLastMessageContent() | ||
val nonFormattedBody = if (messageContent is MessageAudioContent && messageContent.voiceMessageIndicator != null) { | ||
val formattedDuration = DateUtils.formatElapsedTime(((messageContent.audioInfo?.duration ?: 0) / 1000).toLong()) | ||
getString(R.string.voice_message_reply_content, formattedDuration) | ||
} else if (messageContent is MessagePollContent) { | ||
messageContent.getBestPollCreationInfo()?.question?.getBestQuestion() | ||
} else { | ||
messageContent?.body ?: "" | ||
val nonFormattedBody = when (messageContent) { | ||
is MessageAudioContent -> getAudioContentBodyText(messageContent) | ||
is MessagePollContent -> messageContent.getBestPollCreationInfo()?.question?.getBestQuestion() | ||
else -> messageContent?.body ?: "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is the |
||
} | ||
var formattedBody: CharSequence? = null | ||
if (messageContent is MessageTextContent && messageContent.format == MessageFormat.FORMAT_MATRIX_HTML) { | ||
|
@@ -1234,6 +1232,15 @@ 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) | ||
|
@@ -1258,7 +1265,7 @@ class TimelineFragment @Inject constructor( | |
override fun onPause() { | ||
super.onPause() | ||
notificationDrawerManager.setCurrentRoom(null) | ||
voiceMessagePlaybackTracker.unTrack(VoiceMessagePlaybackTracker.RECORDING_ID) | ||
audioMessagePlaybackTracker.pauseAllPlaybacks() | ||
|
||
if (withState(messageComposerViewModel) { it.isVoiceRecording } && requireActivity().isChangingConfigurations) { | ||
// we're rotating, maintain any active recordings | ||
|
@@ -1386,6 +1393,7 @@ class TimelineFragment @Inject constructor( | |
} | ||
return when (model) { | ||
is MessageFileItem, | ||
is MessageAudioItem, | ||
is MessageVoiceItem, | ||
is MessageImageVideoItem, | ||
is MessageTextItem -> { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use the Github issue number instead for the Changelog entry? I know there were some discussions about it, but I don't know what was decided. I think all the team should use use the same pattern: either Github issue number or PR number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I learned about this process, I heard it's very ambiguous and we go either way, but I agree that one way or the other we should choose one and be consistent with it!