Fixed global layout listener never removed if binding is not available
This commit is contained in:
parent
2ed862426e
commit
fcd0779507
1 changed files with 4 additions and 3 deletions
|
@ -746,10 +746,11 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
|||
.addOnGlobalLayoutListener(
|
||||
object : OnGlobalLayoutListener {
|
||||
override fun onGlobalLayout() {
|
||||
binding.chatMessagesList
|
||||
.viewTreeObserver
|
||||
.removeOnGlobalLayoutListener(this)
|
||||
|
||||
if (isBindingAvailable()) {
|
||||
binding.chatMessagesList
|
||||
.viewTreeObserver
|
||||
.removeOnGlobalLayoutListener(this)
|
||||
if (::chatScrollListener.isInitialized) {
|
||||
binding.chatMessagesList.addOnScrollListener(chatScrollListener)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue