turing-tech / MaterialScrollBar

An Android library that brings the Material Design 5.1 sidebar to pre-5.1 devices.
Apache License 2.0
781 stars 126 forks source link

Programmatic constructor of MaterialScrollBar throws NPE #115

Open pavelskala opened 6 years ago

pavelskala commented 6 years ago

The programmatic constructor MaterialScrollBar(Context context, RecyclerView recyclerView, boolean lightOnTouch) cannot be used, because it calls method generalSetup(); which works with member field private TypedArray a; which in case of programmatic instantiation of this class is not initialized and the constructor fails on NullPointerException. The only workaround to create any of MaterialScrollBars by hand (i.e. using Anko) is to create XML layout with the scroll bar and inflate it using LayoutInflater.