valkriaine / Bouncy

RecyclerView and NestedScrollView with physics-based bouncy overscroll effect
Apache License 2.0
198 stars 18 forks source link

IllegalArgumentException When Setting LayoutManager Thru XML #9

Closed rluick15 closed 3 years ago

rluick15 commented 3 years ago

Noticed that when you set the layout manager on the recycler view in xml like so:

    <com.factor.bouncy.BouncyRecyclerView
        ...
       app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />

We see the following crash:

 Caused by: java.lang.IllegalArgumentException: Spring stiffness constant must be positive.
        at androidx.dynamicanimation.animation.SpringForce.setStiffness(SpringForce.java:138)
        at com.factor.bouncy.BouncyRecyclerView.setupDirection(BouncyRecyclerView.kt:125)
        at com.factor.bouncy.BouncyRecyclerView.setOrientation(BouncyRecyclerView.kt:30)
        at com.factor.bouncy.BouncyRecyclerView.setLayoutManager(BouncyRecyclerView.kt:103)
        at androidx.recyclerview.widget.RecyclerView.createLayoutManager(RecyclerView.java:813)
        at androidx.recyclerview.widget.RecyclerView.<init>(RecyclerView.java:711)
        at androidx.recyclerview.widget.RecyclerView.<init>(RecyclerView.java:650)
        at com.factor.bouncy.BouncyRecyclerView.<init>(BouncyRecyclerView.kt:16)

Easy enough to set it through code for now, but just wanted to point this out.

valkriaine commented 3 years ago

resolved in version 1.9