mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
removed stopMediaPlayer method call in onStop(),
so that audio continues playing when activity in background. if backpressed, stops mediaplayer Signed-off-by: Giacomo Pacini <giacomopacini98@gmail.com>
This commit is contained in:
parent
a483fb7017
commit
b44641c0c7
@ -405,6 +405,9 @@ class ChatActivity :
|
|||||||
|
|
||||||
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||||
override fun handleOnBackPressed() {
|
override fun handleOnBackPressed() {
|
||||||
|
if (currentlyPlayedVoiceMessage != null) {
|
||||||
|
stopMediaPlayer(currentlyPlayedVoiceMessage!!)
|
||||||
|
}
|
||||||
val intent = Intent(this@ChatActivity, ConversationsListActivity::class.java)
|
val intent = Intent(this@ChatActivity, ConversationsListActivity::class.java)
|
||||||
intent.putExtras(Bundle())
|
intent.putExtras(Bundle())
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
@ -558,9 +561,10 @@ class ChatActivity :
|
|||||||
if (mediaRecorderState == MediaRecorderState.RECORDING) {
|
if (mediaRecorderState == MediaRecorderState.RECORDING) {
|
||||||
stopAudioRecording()
|
stopAudioRecording()
|
||||||
}
|
}
|
||||||
if (currentlyPlayedVoiceMessage != null) {
|
//if (currentlyPlayedVoiceMessage != null) {
|
||||||
stopMediaPlayer(currentlyPlayedVoiceMessage!!)
|
// stopMediaPlayer(currentlyPlayedVoiceMessage!!)
|
||||||
}
|
//} this is done also in onDestroy,
|
||||||
|
// it is better to continue audio playback when the activity is not visible but still open
|
||||||
val text = binding.messageInputView.messageInput.text.toString()
|
val text = binding.messageInputView.messageInput.text.toString()
|
||||||
val cursor = binding.messageInputView.messageInput.selectionStart
|
val cursor = binding.messageInputView.messageInput.selectionStart
|
||||||
val previous = context.getSharedPreferences(localClassName, MODE_PRIVATE).getString(roomToken, "null")
|
val previous = context.getSharedPreferences(localClassName, MODE_PRIVATE).getString(roomToken, "null")
|
||||||
|
Loading…
Reference in New Issue
Block a user