Is there a way to know whether `LazyListState.isSc...
# compose
n
Is there a way to know whether
LazyListState.isScrollInProgress
was triggered by user or not? Documentation says "Whether this ScrollableState is currently scrolling by gesture, fling or programmatically". I think I can use
InteractionSource
to catch drags, but it would not cover flinging and maybe some other user-initiated scrolls.
m
We don't provide a way to disambiguate between fling and any other programmatic scroll, it's either dragging or "animation". Could you elaborate on your usecase here?
n
We want to load next page of data when a certain condition is met (for example, last available item starts to be visible). But not if the item was scrolled through our own animateScrollToItem calls. I can solve this by manually keeping some "isInProgrammaticScroll", though I was hoping for a simpler solution.
m
I don't think we provide a simpler solution then to keep the track manually in this case, as we want fling to be treated similar to the animation with ‘animateScrollTo’, because it gives the same signal to the app to load more items or do other processing (analytics or other db/network request)
n
Thanks! It can't be the same signal for us because the list is not the only place where data is shown. It's a list of thumbnails which helps navigating through the content, which is shown in a fullscreen pager at the same time. Same data. Scrolling the pager will call 'animateScrollTo' to the thumbnails, and this should NOT trigger data loads because the pager has its own logic for this. We could use the thumbnail list as the 'source of truth' for loading more items, but unfortunately this list is not always part of the UI.
m
I have a very limited context, but it seems like the problem is coming from the 2 entities requiring the business logic to work, both with similar needs and interfaces, but only one entity is connected properly and can request some side effects, where the other doesn't. This sort of problem is something we don't want to actively encourage in the apps with compose, therefore we don't provide a way to disambiguate between fling and animation. I'm happy you find a workaround for your case though!