mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 12:08:34 +00:00
Fix lifecycle crashes with keyboard fragment and media sending.
This commit is contained in:
@@ -514,7 +514,6 @@ class ConversationFragment :
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
registerForResults()
|
||||
disposables.bindTo(viewLifecycleOwner)
|
||||
FullscreenHelper(requireActivity()).showSystemUI()
|
||||
|
||||
@@ -523,6 +522,8 @@ class ConversationFragment :
|
||||
|
||||
inlineQueryViewModel = createActivityViewModel { InlineQueryViewModelV2(recipientRepository = conversationRecipientRepository) }
|
||||
|
||||
attachmentManager = AttachmentManager(requireContext(), requireView(), AttachmentManagerListener())
|
||||
|
||||
initializeConversationThreadUi()
|
||||
|
||||
val conversationToolbarOnScrollHelper = ConversationToolbarOnScrollHelper(
|
||||
@@ -552,6 +553,8 @@ class ConversationFragment :
|
||||
|
||||
ToolbarDependentMarginListener(binding.toolbar)
|
||||
initializeMediaKeyboard()
|
||||
|
||||
registerForResults()
|
||||
}
|
||||
|
||||
override fun onViewStateRestored(savedInstanceState: Bundle?) {
|
||||
@@ -799,8 +802,6 @@ class ConversationFragment :
|
||||
|
||||
menuProvider.afterFirstRenderMode = true
|
||||
|
||||
attachmentManager = AttachmentManager(requireContext(), requireView(), AttachmentManagerListener())
|
||||
|
||||
viewLifecycleOwner.lifecycle.addObserver(LastScrolledPositionUpdater(adapter, layoutManager, viewModel))
|
||||
|
||||
disposables += viewModel.recipient
|
||||
|
||||
@@ -17,7 +17,7 @@ inline fun <reified T> Fragment.findListener(): T? {
|
||||
parent = parent.parentFragment
|
||||
}
|
||||
|
||||
return requireActivity() as? T
|
||||
return activity as? T
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,9 +40,9 @@ inline fun <reified T> Fragment.requireListener(): T {
|
||||
parent = parent.parentFragment
|
||||
}
|
||||
|
||||
return requireActivity() as T
|
||||
return activity as T
|
||||
} catch (e: ClassCastException) {
|
||||
hierarchy.add(requireActivity()::class.java.name)
|
||||
hierarchy.add(activity?.let { it::class.java.name } ?: "<null activity>")
|
||||
throw ListenerNotFoundException(hierarchy, e)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user