mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-19 04:38:44 +03:00
Memory leaks: clean after Benoit's remarks
This commit is contained in:
parent
f8dca1237a
commit
ff171a39c6
2 changed files with 6 additions and 2 deletions
|
@ -27,13 +27,17 @@ private const val LAYOUT_MANAGER_STATE = "LAYOUT_MANAGER_STATE"
|
|||
|
||||
class LayoutManagerStateRestorer(layoutManager: RecyclerView.LayoutManager) : Restorable, DefaultListUpdateCallback {
|
||||
|
||||
var layoutManager: RecyclerView.LayoutManager? = null
|
||||
private var layoutManager: RecyclerView.LayoutManager? = null
|
||||
private var layoutManagerState = AtomicReference<Parcelable?>()
|
||||
|
||||
init {
|
||||
this.layoutManager = layoutManager
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
layoutManager = null
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
val layoutManagerState = layoutManager?.onSaveInstanceState()
|
||||
outState.putParcelable(LAYOUT_MANAGER_STATE, layoutManagerState)
|
||||
|
|
|
@ -127,7 +127,7 @@ class RoomListFragment @Inject constructor(
|
|||
modelBuildListener = null
|
||||
roomListView.cleanup()
|
||||
roomController.listener = null
|
||||
stateRestorer.layoutManager = null
|
||||
stateRestorer.clear()
|
||||
createChatFabMenu.listener = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue