TonicArtos / SuperSLiM

A layout manager for the RecyclerView with interchangeable linear, grid, and staggered displays of views, all with configurable section headers including the sticky variety as specified in the material design docs.
http://tonicartos.nz
2.12k stars 296 forks source link

Request: add fast-scroller #5

Closed AndroidDeveloperLB closed 7 years ago

AndroidDeveloperLB commented 9 years ago

As the title says. It's like on the ListView and as shown on the contacts app, so that the user could scroll easily and go through the sections.

TonicArtos commented 9 years ago

This will be done after some changes to how sections are handled, and the scroll bar size and position is calculated.

AndroidDeveloperLB commented 9 years ago

Thank you for considering it. I was wondering : how do you add a fast scroller ? Is there any built in view for this?

TonicArtos commented 9 years ago

Honestly, I only looked at it just now. It looks like I'll have to build a fast scroll for it. I might end out doing a generic fast scroll overlay as well.

AndroidDeveloperLB commented 9 years ago

That's too bad. odd that Google doesn't provide one, as it's used on various scrolling views...

TonicArtos commented 9 years ago

I think the reason for it is twofold. 1) RecyclerView is extremely bare bones anyway, and 2) adding a fast scroller might have limited the kinds of layout manager you can create. I am already thinking about what kind of assumptions I might have to make in order to implement the fast scroller. On 8 Jan 2015 20:49, "AndroidDeveloperLB" notifications@github.com wrote:

That's too bad. odd that Google doesn't provide one, as it's used on various scrolling views...

— Reply to this email directly or view it on GitHub https://github.com/TonicArtos/SuperSLiM/issues/5#issuecomment-69146559.

AndroidDeveloperLB commented 9 years ago

I didn't talk about RecyclerView. I meant even before it was introduced. I think ListView isn't the only view with a fast-scroller, so I also thought that it's odd that it isn't a build in view that you can use in other places. About how to make it generic, I think you should have a 2-way listener. One for telling where the user is scrolling via the fast-scroller, and another for telling where the user is scrolling on the scrolling-container (listView/RecyclerView/...) . When scrolling via the scroller itself, the scrolling-container should scroll so that the first item (row in the case of ListView) would be at the top and completely visible. Also, you could add an option to customize how the fast-scroller looks like and how the small popup of it looks like (and if you wish to show it at all). Another thing to look for is the SectionIndexer.

AndroidDeveloperLB commented 9 years ago

Maybe SectionIndexer isn't needed. I think that once you provide a listener, the developer can check what is the first item, and decide what to show for the popup of the scroller.

RayDar commented 9 years ago

I would like to throw my hat into the ring in requesting a 'vertical fast scroller'.

AndroidDeveloperLB commented 9 years ago

@RayDar I've made a POC that demonstrates it, if you wish: https://github.com/AndroidDeveloperLB/LollipopContactsRecyclerViewFastScroller

EpariNigam commented 8 years ago

@TonicArtos in the LayoutManager, computeVerticalScrollRange() method is there, when you are going to implement this method. It's implemented but of no use as of now bcoz, for this reason, I am unable to implement FastScroll and is failing for computation.

TonicArtos commented 8 years ago

It is planned, but the rewrite still has to be finished. With 0.4 it wasn't possible to implement without significant performance problems, and was never going to work with lazily loaded views either.

TonicArtos commented 8 years ago

See the roadmap

luweglinski commented 8 years ago
 private fun updateBubbleAndHandlePosition() {
        if (bubble == null || handle!!.isSelected)
            return
        val offset = recyclerView!!.computeVerticalScrollOffset()
        val extent = recyclerView!!.computeVerticalScrollExtent()
        val range = recyclerView!!.computeVerticalScrollRange()

        var relativePos = 0f
        if (recyclerView!!.childCount > 0) {
            relativePos = offset / (range - extent).toFloat()
        }
        setBubbleAndHandlePosition(viewHeight * relativePos)
    }

change this method to work with https://github.com/AndroidDeveloperLB/LollipopContactsRecyclerViewFastScroller