diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index 4def538c46..c9e8382a6b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -71,6 +71,7 @@ import im.vector.app.core.extensions.ensureEndsLeftToRight import im.vector.app.core.extensions.filterDirectionOverrides import im.vector.app.core.extensions.hideKeyboard import im.vector.app.core.extensions.registerStartForActivityResult +import im.vector.app.core.extensions.replaceChildFragment import im.vector.app.core.extensions.setTextOrHide import im.vector.app.core.extensions.toMvRxBundle import im.vector.app.core.extensions.trackItemsVisibilityChange @@ -298,13 +299,13 @@ class TimelineFragment : } } - childFragmentManager.findFragmentById(R.id.composerContainer) as? MessageComposerFragment ?: run { + if (childFragmentManager.findFragmentById(R.id.composerContainer) == null) { childFragmentManager.commitTransaction { replace(R.id.composerContainer, MessageComposerFragment()) } } - childFragmentManager.findFragmentById(R.id.voiceMessageRecorderContainer) as? VoiceRecorderFragment ?: run { + if (childFragmentManager.findFragmentById(R.id.voiceMessageRecorderContainer) == null) { childFragmentManager.commitTransaction { replace(R.id.voiceMessageRecorderContainer, VoiceRecorderFragment()) }