adam-codersgu / supernova

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.
0 stars 0 forks source link

Crash on navigating to ArtistFragment #97

Closed adam-codersgu closed 1 year ago

adam-codersgu commented 1 year ago

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)

adam-codersgu commented 1 year ago

Working on branch bug/artistfragment_crash

adam-codersgu commented 1 year ago

Merged bug fix https://github.com/adam-codersgu/supernova/pull/98