EventHook unexpected behavior with EndlessScroll and ProgressItem
Closed this issue · 4 comments
This is similar issue to #643. Initial binding is fine but any calls to notifyAdapterItemChanged(position)
are not shown until the list is scrolled for a bit. Interesting part of the problem is that it occurs only when page 2 list is empty. If there are enough data for second page bindings work fine.
As in #643, if we don't add ProgressItem
EventHook works fine.
EventHook
adapter.addEventHook(object : ClickEventHook<MyItemView>() {
override fun onBind(viewHolder: RecyclerView.ViewHolder): View? {
return if (viewHolder is MyItemView.ViewHolder) {
viewHolder.MyItemClickView
}
else null
}
override fun onClick(v: View, position: Int, fastAdapter: FastAdapter<MyItemView>, item: MyItemView) {
*network request*
}
})
EndlessScrollListener
endlessRecyclerOnScrollListener = object : EndlessRecyclerOnScrollListener(manager , visibleTreshold, footerAdapter) {
override fun onLoadMore(currentPage: Int) {
footerAdapter.clear()
mViewModel.page = currentPage + 1
val progressItem = ProgressItem()
progressItem.isEnabled = false
footerAdapter.add(progressItem)
*network call*
}
}
recycler_view.addOnScrollListener(endlessRecyclerOnScrollListener)
Details
- Used library version - 5.3.2
Checklist
- Searched for similar issues
- Checked out the sample application
- Read the README
- Checked out the CHANGELOG
- Checked out the MIGRATION GUIDE
is notifyAdapterItemChanged
called from the UI thread?
can you please clarify if we don't add ProgressItem EventHook works fine
Are you meaning if you don't add the EventHook it's fine? or if you don't add this item to the list it is fine?
is notifyAdapterItemChanged called from the UI thread?
yes
Are you meaning if you don't add the EventHook it's fine? or if you don't add this item to the list it is fine?
Sorry for bad wording. What I meant was if we don't call this line footerAdapter.add(progressItem)
in onLoadMore
everything works fine
Could you please provide a sample app showcasing this issue?
Closing due to inactivity and outstanding quetsions