Fixed: IllegalStateException while setting the toolbar in SearchFragment which i accidentally faced while navigating very frequently to other screens.

This commit is contained in:
MohitMaliFtechiz 2024-12-10 16:54:37 +05:30 committed by Kelson
parent 8df7bddff0
commit 9444a3d74b

View File

@ -192,11 +192,12 @@ class SearchFragment : BaseFragment() {
) )
} }
@Suppress("UnnecessarySafeCall")
private fun setupToolbar(view: View) { private fun setupToolbar(view: View) {
view.post { view.post {
with(requireActivity() as CoreMainActivity) { with(activity as? CoreMainActivity) {
setSupportActionBar(view.findViewById(R.id.toolbar)) this?.setSupportActionBar(view.findViewById(R.id.toolbar))
supportActionBar?.apply { this?.supportActionBar?.apply {
setHomeButtonEnabled(true) setHomeButtonEnabled(true)
title = getString(R.string.menu_search_in_text) title = getString(R.string.menu_search_in_text)
} }