quiph / RecyclerView-FastScroller

A fully customizable Fast Scroller for the RecyclerView in Android, written in Kotlin
Apache License 2.0
855 stars 70 forks source link

androidx.recyclerview.widget.StaggeredGridLayoutManager not supported #44

Open lsh-silpion opened 4 years ago

lsh-silpion commented 4 years ago

While I think this is a great library, it sadly seems only to support androidx.recyclerview.widget.LinearLayoutManager. Because our customer insists on a Layout which can only be produced by androidx.recyclerview.widget.StaggeredGridLayoutManager we sadly can't use this

    java.lang.ClassCastException: androidx.recyclerview.widget.StaggeredGridLayoutManager cannot be cast to androidx.recyclerview.widget.LinearLayoutManager
        at com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller$onScrollListener$1.onScrolled(Unknown Source:31)
        at androidx.recyclerview.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:5347)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:4405)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4031)
        at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4578)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at androidx.coordinatorlayout.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1213)
        at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:899)
        at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:919)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1855)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1855)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
        at com.android.internal.policy.DecorView.onLayout(DecorView.java:1099)
        at android.view.View.layout(View.java:23750)
        at android.view.ViewGroup.layout(ViewGroup.java:7277)
        at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3712)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3164)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2225)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9126)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:999)
        at android.view.Choreographer.doCallbacks(Choreographer.java:797)
E/AndroidRuntime:     at android.view.Choreographer.doFrame(Choreographer.java:732)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:984)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
I/Process: Sending signal. PID: 22966 SIG: 9
shahsurajk commented 4 years ago

Im not sure if the necessary functionality required for it is available in the StaggeredGridLayoutManager api. Though it would be worth a check.

lsh-silpion commented 4 years ago

Im not sure if the necessary functionality required for it is available in the StaggeredGridLayoutManager api. Though it would be worth a check.

Thanks for considering this! For now I use https://github.com/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView which supports this feature for StaggeredGridLayoutManager.