Closed rteterin closed 6 years ago
hi @rteterin , i can't reproduce your case, and I tried the following code, the load more view will be hidden immediately as expected.
recyclerView.setLoadingMore(true);
recyclerView.setLoadingMore(false);
Hello @jaychang0917, I created a simple app that reproduces the issue: https://github.com/rteterin/SimpleRecyclerView_issue34_demo
I tested on Android 5.1.1 and 6.0.1.
Thanks your report, the new release 1.2.7
should fix this issue.
When
setLoadingMore(true)
is called (which in turn callsshowLoadMoreView()
), a call toaddCell
method is added to the UI message queue andisLoadMoreViewShown
is set to true.If
setLoadingMore(false)
is called right after that,removeCell
method is called immediately andisLoadMoreViewShown
is set to false.The problem is that at this moment the runnable that calls
addCell
is still in the message queue, therefore it will be called later. But when it's called, it adds this cell despite the fact thatisLoadMoreViewShown
is false. Now the cell is displayed, and it's not possible to hide it with another call tosetLoadingMore(false)
, becausehideLoadMoreView()
thinks that it's already hidden.