mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-14 16:25:05 +01:00
this should work - didn't test yet tho
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
65e5be4798
commit
03c5d2561e
app/src/main/java/com/nextcloud/talk/chat
@ -506,10 +506,15 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
chatViewModel.handleOrientationChange()
|
chatViewModel.handleSavedInstance()
|
||||||
super.onSaveInstanceState(outState)
|
super.onSaveInstanceState(outState)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
|
||||||
|
chatViewModel.handleRestoreInstance()
|
||||||
|
super.onRestoreInstanceState(savedInstanceState)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
active = false
|
active = false
|
||||||
|
@ -35,6 +35,7 @@ class MediaRecorderManager : LifecycleAwareManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var currentVoiceRecordFile: String = ""
|
var currentVoiceRecordFile: String = ""
|
||||||
|
private var lockRecording = false
|
||||||
|
|
||||||
enum class MediaRecorderState {
|
enum class MediaRecorderState {
|
||||||
INITIAL,
|
INITIAL,
|
||||||
@ -166,6 +167,12 @@ class MediaRecorderManager : LifecycleAwareManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun handleOnStop() {
|
override fun handleOnStop() {
|
||||||
|
if (!lockRecording) {
|
||||||
stop()
|
stop()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun lockRecording(shouldLock: Boolean) {
|
||||||
|
lockRecording = shouldLock
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -667,8 +667,13 @@ class ChatViewModel @Inject constructor(
|
|||||||
audioFocusRequestManager.audioFocusRequest(request, callback)
|
audioFocusRequestManager.audioFocusRequest(request, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun handleOrientationChange() {
|
fun handleSavedInstance() {
|
||||||
_getCapabilitiesViewState.value = GetCapabilitiesStartState
|
_getCapabilitiesViewState.value = GetCapabilitiesStartState
|
||||||
|
mediaRecorderManager.lockRecording(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun handleRestoreInstance() {
|
||||||
|
mediaRecorderManager.lockRecording(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getMessageById(url: String, conversationModel: ConversationModel, messageId: Long): Flow<ChatMessage> =
|
fun getMessageById(url: String, conversationModel: ConversationModel, messageId: Long): Flow<ChatMessage> =
|
||||||
|
Loading…
Reference in New Issue
Block a user