Prevent screen to turn off while recording a voice message
This commit is contained in:
parent
f62d90285f
commit
f20cf11cc9
1 changed files with 11 additions and 0 deletions
|
@ -298,6 +298,17 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
||||||
chatSendingViewModel.onTextToSendChanged(it)
|
chatSendingViewModel.onTextToSendChanged(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chatSendingViewModel.isVoiceRecording.observe(
|
||||||
|
viewLifecycleOwner
|
||||||
|
) { voiceRecording ->
|
||||||
|
// Keep screen on while recording voice message
|
||||||
|
if (voiceRecording) {
|
||||||
|
requireActivity().window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
} else {
|
||||||
|
requireActivity().window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
chatSendingViewModel.requestRecordAudioPermissionEvent.observe(
|
chatSendingViewModel.requestRecordAudioPermissionEvent.observe(
|
||||||
viewLifecycleOwner
|
viewLifecycleOwner
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in a new issue