Avoid crash if activity is already dead
This commit is contained in:
parent
f4dd150b70
commit
2e2663bad9
@ -217,7 +217,7 @@ class LibraryController(
|
|||||||
}
|
}
|
||||||
.launchIn(viewScope)
|
.launchIn(viewScope)
|
||||||
|
|
||||||
(activity!! as MainActivity).fixViewToBottom(binding.actionToolbar)
|
(activity as? MainActivity)?.fixViewToBottom(binding.actionToolbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
||||||
@ -230,7 +230,7 @@ class LibraryController(
|
|||||||
|
|
||||||
override fun onDestroyView(view: View) {
|
override fun onDestroyView(view: View) {
|
||||||
destroyActionModeIfNeeded()
|
destroyActionModeIfNeeded()
|
||||||
(activity!! as MainActivity).clearFixViewToBottom(binding.actionToolbar)
|
(activity as? MainActivity)?.clearFixViewToBottom(binding.actionToolbar)
|
||||||
binding.actionToolbar.destroy()
|
binding.actionToolbar.destroy()
|
||||||
adapter?.onDestroy()
|
adapter?.onDestroy()
|
||||||
adapter = null
|
adapter = null
|
||||||
|
@ -242,7 +242,7 @@ class MangaController :
|
|||||||
}
|
}
|
||||||
.launchIn(viewScope)
|
.launchIn(viewScope)
|
||||||
|
|
||||||
(activity!! as MainActivity).fixViewToBottom(binding.actionToolbar)
|
(activity as? MainActivity)?.fixViewToBottom(binding.actionToolbar)
|
||||||
|
|
||||||
settingsSheet = ChaptersSettingsSheet(router, presenter) { group ->
|
settingsSheet = ChaptersSettingsSheet(router, presenter) { group ->
|
||||||
if (group is ChaptersSettingsSheet.Filter.FilterGroup) {
|
if (group is ChaptersSettingsSheet.Filter.FilterGroup) {
|
||||||
@ -321,7 +321,7 @@ class MangaController :
|
|||||||
|
|
||||||
override fun onDestroyView(view: View) {
|
override fun onDestroyView(view: View) {
|
||||||
destroyActionModeIfNeeded()
|
destroyActionModeIfNeeded()
|
||||||
(activity!! as MainActivity).clearFixViewToBottom(binding.actionToolbar)
|
(activity as? MainActivity)?.clearFixViewToBottom(binding.actionToolbar)
|
||||||
binding.actionToolbar.destroy()
|
binding.actionToolbar.destroy()
|
||||||
mangaInfoAdapter = null
|
mangaInfoAdapter = null
|
||||||
chaptersHeaderAdapter = null
|
chaptersHeaderAdapter = null
|
||||||
|
@ -109,12 +109,12 @@ class UpdatesController :
|
|||||||
}
|
}
|
||||||
.launchIn(viewScope)
|
.launchIn(viewScope)
|
||||||
|
|
||||||
(activity!! as MainActivity).fixViewToBottom(binding.actionToolbar)
|
(activity as? MainActivity)?.fixViewToBottom(binding.actionToolbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView(view: View) {
|
override fun onDestroyView(view: View) {
|
||||||
destroyActionModeIfNeeded()
|
destroyActionModeIfNeeded()
|
||||||
(activity!! as MainActivity).clearFixViewToBottom(binding.actionToolbar)
|
(activity as? MainActivity)?.clearFixViewToBottom(binding.actionToolbar)
|
||||||
binding.actionToolbar.destroy()
|
binding.actionToolbar.destroy()
|
||||||
adapter = null
|
adapter = null
|
||||||
super.onDestroyView(view)
|
super.onDestroyView(view)
|
||||||
|
Loading…
Reference in New Issue
Block a user