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