-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting refresh initial offset keeps loading animation after setRefreshing(false) is called #11
Comments
After some debugging, I see that reset() is being called, from the mResetListener->onAnimationEnd which in turn sets the mRefreshView.visibility = GONE, however mRefreshView visibility is set to VISIBLE again right after in setTargetOrRefreshViewOffsetY, particularly here: |
@branislav-zlatkovic thank you for posting the issue, |
thanks for a swift reply @nishchal-v-simformsolutions ! The above solution proposal seem to work great as long the mRefreshView is not scrolled back into it's original position by user scrolling the recyclerview content, then it again 'get stuck' in being visible after setRefreshing(false) is being called. In other words, if loading takes a while and user starts scrolling up while loading still is in progress, once loading finish after mRefreshView has been put into it's original position by the scroll, the mRefreshView won't disappear (visibility != GONE). Additional debugging shows that in this case the following if statement fulfills the condition, preventing the animation's listener ultimately calling reset() when things are done: if (computeAnimateToStartDuration(from.toFloat()) <= 0) { My quick solution inserts reset() call from within the condition, like this: if (computeAnimateToStartDuration(from.toFloat()) <= 0) { This fix seem to work great as a complementary to the above proposed solution, but haven't fully checked if it affect anything else. |
After some more testing of the above proposed solution, turns out that |
Thanks @branislav-zlatkovic. We will try to fix it ASAP |
@branislav-zlatkovic fixed the issue you posted, and thanks for the suggestion of yours |
Refresh animation still visible after setRefreshing(false) if there's setRefreshInitialOffset() applied.
Steps to reproduce the behavior:
swipeRefresh.setRepeatMode(SSPullToRefreshLayout.RepeatMode.REPEAT)
swipeRefresh.setRepeatCount(SSPullToRefreshLayout.RepeatCount.INFINITE)
and wrap around a recyclerview that has clipToPadding = false and a top padding at a double size of a standard toolbar height
swipeRefresh.setRefreshInitialOffset(/half the measured height of the above recyclerview padding/)
swipeRefresh.setOnRefreshListener.... { loadData() }
Expected behavior
Loading animation is gone after calling setRefreshing(false) with initial refresh offset set, just as it would be gone if there's no initial refresh offset set - it would probably just be enough to set visibility = GONE to mRefreshView
The text was updated successfully, but these errors were encountered: