A Kotlin-based Android application that allows the user to play music from their device while custom animations fall over the album artwork of the currently playing song.
It appears to be due to sometimes the adapter being updated before the RecyclerView is measured and ready. Stacktrace below:
java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling androidx.recyclerview.widget.RecyclerView{2406410 VFED..... ......I. 0,0-1096,1987}, adapter:com.codersguidebook.supernova.fragment.adapter.ArtistAdapter@ca5d1a4, layout:androidx.recyclerview.widget.LinearLayoutManager@847ab09, context:com.codersguidebook.supernova.MainActivity@724db22
at androidx.recyclerview.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:3441)
at androidx.recyclerview.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeChanged(RecyclerView.java:6025)
at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java:13128)
at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java:13118)
at androidx.recyclerview.widget.RecyclerView$Adapter.notifyItemChanged(RecyclerView.java:8023)
at com.codersguidebook.supernova.ui.artist.ArtistFragment$updateRecyclerView$1.invokeSuspend(ArtistFragment.kt:71)
It appears to be due to sometimes the adapter being updated before the RecyclerView is measured and ready. Stacktrace below:
java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling androidx.recyclerview.widget.RecyclerView{2406410 VFED..... ......I. 0,0-1096,1987}, adapter:com.codersguidebook.supernova.fragment.adapter.ArtistAdapter@ca5d1a4, layout:androidx.recyclerview.widget.LinearLayoutManager@847ab09, context:com.codersguidebook.supernova.MainActivity@724db22 at androidx.recyclerview.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:3441) at androidx.recyclerview.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeChanged(RecyclerView.java:6025) at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java:13128) at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java:13118) at androidx.recyclerview.widget.RecyclerView$Adapter.notifyItemChanged(RecyclerView.java:8023) at com.codersguidebook.supernova.ui.artist.ArtistFragment$updateRecyclerView$1.invokeSuspend(ArtistFragment.kt:71)