|
@@ -225,6 +225,8 @@ class ChatActivity :
|
|
CommonMessageInterface,
|
|
CommonMessageInterface,
|
|
PreviewMessageInterface {
|
|
PreviewMessageInterface {
|
|
|
|
|
|
|
|
+ var active = false
|
|
|
|
+
|
|
private lateinit var binding: ControllerChatBinding
|
|
private lateinit var binding: ControllerChatBinding
|
|
|
|
|
|
@Inject
|
|
@Inject
|
|
@@ -344,6 +346,16 @@ class ChatActivity :
|
|
binding.messagesListView.setAdapter(adapter)
|
|
binding.messagesListView.setAdapter(adapter)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ override fun onStart() {
|
|
|
|
+ super.onStart()
|
|
|
|
+ active = true
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun onStop() {
|
|
|
|
+ super.onStop()
|
|
|
|
+ active = false
|
|
|
|
+ }
|
|
|
|
+
|
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
|
override fun onResume() {
|
|
override fun onResume() {
|
|
super.onResume()
|
|
super.onResume()
|
|
@@ -1085,14 +1097,13 @@ class ChatActivity :
|
|
}
|
|
}
|
|
|
|
|
|
private fun startPlayback(message: ChatMessage) {
|
|
private fun startPlayback(message: ChatMessage) {
|
|
- // TODO check how to handle this when conductor is removed
|
|
|
|
- // if (!this.isAttached) {
|
|
|
|
- // // don't begin to play voice message if screen is not visible anymore.
|
|
|
|
- // // this situation might happen if file is downloading but user already left the chatview.
|
|
|
|
- // // If user returns to chatview, the old chatview instance is not attached anymore
|
|
|
|
- // // and he has to click the play button again (which is considered to be okay)
|
|
|
|
- // return
|
|
|
|
- // }
|
|
|
|
|
|
+ if (!active) {
|
|
|
|
+ // don't begin to play voice message if screen is not visible anymore.
|
|
|
|
+ // this situation might happen if file is downloading but user already left the chatview.
|
|
|
|
+ // If user returns to chatview, the old chatview instance is not attached anymore
|
|
|
|
+ // and he has to click the play button again (which is considered to be okay)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
|
|
initMediaPlayer(message)
|
|
initMediaPlayer(message)
|
|
|
|
|