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) {
view.post {
with(requireActivity() as CoreMainActivity) {
setSupportActionBar(view.findViewById(R.id.toolbar))
supportActionBar?.apply {
with(activity as? CoreMainActivity) {
this?.setSupportActionBar(view.findViewById(R.id.toolbar))
this?.supportActionBar?.apply {
setHomeButtonEnabled(true)
title = getString(R.string.menu_search_in_text)
}