diff --git a/app/src/main/java/audio/funkwhale/ffa/adapters/AlbumsAdapter.kt b/app/src/main/java/audio/funkwhale/ffa/adapters/AlbumsAdapter.kt index 839f7706f0b9f0a58da1994c8564ce888b06d4ea..03e2c92f7f6dbfffd7f6850808e8c3ac5f3a4153 100644 --- a/app/src/main/java/audio/funkwhale/ffa/adapters/AlbumsAdapter.kt +++ b/app/src/main/java/audio/funkwhale/ffa/adapters/AlbumsAdapter.kt @@ -19,6 +19,10 @@ class AlbumsAdapter( private val listener: OnAlbumClickListener ) : FFAAdapter<Album, AlbumsAdapter.ViewHolder>() { + init { + this.stateRestorationPolicy = StateRestorationPolicy.PREVENT_WHEN_EMPTY + } + interface OnAlbumClickListener { fun onClick(view: View?, album: Album) } diff --git a/app/src/main/java/audio/funkwhale/ffa/adapters/ArtistsAdapter.kt b/app/src/main/java/audio/funkwhale/ffa/adapters/ArtistsAdapter.kt index afdfe42bc958ac6ec3813d44c66f0e551daad0a9..956860db490b92f61678e4708d20e1e8b824528e 100644 --- a/app/src/main/java/audio/funkwhale/ffa/adapters/ArtistsAdapter.kt +++ b/app/src/main/java/audio/funkwhale/ffa/adapters/ArtistsAdapter.kt @@ -42,6 +42,8 @@ class ArtistsAdapter( super.onItemRangeInserted(positionStart, itemCount) } }) + + this.stateRestorationPolicy = StateRestorationPolicy.PREVENT_WHEN_EMPTY } override fun getItemCount() = active.size diff --git a/app/src/main/java/audio/funkwhale/ffa/adapters/FavoritesAdapter.kt b/app/src/main/java/audio/funkwhale/ffa/adapters/FavoritesAdapter.kt index 66ea97a11736d69bb5eed8b39960c3b51435a05c..95fe68abd02c565c154f76dc69e9dd26c786ed18 100644 --- a/app/src/main/java/audio/funkwhale/ffa/adapters/FavoritesAdapter.kt +++ b/app/src/main/java/audio/funkwhale/ffa/adapters/FavoritesAdapter.kt @@ -30,6 +30,10 @@ class FavoritesAdapter( val fromQueue: Boolean = false ) : FFAAdapter<Track, FavoritesAdapter.ViewHolder>() { + init { + this.stateRestorationPolicy = StateRestorationPolicy.PREVENT_WHEN_EMPTY + } + interface OnFavoriteListener { fun onToggleFavorite(id: Int, state: Boolean) } diff --git a/app/src/main/java/audio/funkwhale/ffa/adapters/PlaylistsAdapter.kt b/app/src/main/java/audio/funkwhale/ffa/adapters/PlaylistsAdapter.kt index b6b29d5100cf0d8dbd80c54375a8f7accd369f82..11e3cd8161dd7472323761852f50b8a1806c4286 100644 --- a/app/src/main/java/audio/funkwhale/ffa/adapters/PlaylistsAdapter.kt +++ b/app/src/main/java/audio/funkwhale/ffa/adapters/PlaylistsAdapter.kt @@ -20,6 +20,10 @@ class PlaylistsAdapter( private val listener: OnPlaylistClickListener ) : FFAAdapter<Playlist, PlaylistsAdapter.ViewHolder>() { + init { + this.stateRestorationPolicy = StateRestorationPolicy.PREVENT_WHEN_EMPTY + } + interface OnPlaylistClickListener { fun onClick(holder: View?, playlist: Playlist) } diff --git a/app/src/main/java/audio/funkwhale/ffa/adapters/RadiosAdapter.kt b/app/src/main/java/audio/funkwhale/ffa/adapters/RadiosAdapter.kt index 8d57fa2ae490a3592e06e850d0ef19f448cdacb7..cb9dbf913460385579498ab492cf1efe4b813835 100644 --- a/app/src/main/java/audio/funkwhale/ffa/adapters/RadiosAdapter.kt +++ b/app/src/main/java/audio/funkwhale/ffa/adapters/RadiosAdapter.kt @@ -27,6 +27,10 @@ class RadiosAdapter( private val listener: OnRadioClickListener ) : FFAAdapter<Radio, RadiosAdapter.ViewHolder>() { + init { + this.stateRestorationPolicy = StateRestorationPolicy.PREVENT_WHEN_EMPTY + } + interface OnRadioClickListener { fun onClick(holder: RowRadioViewHolder, radio: Radio) } diff --git a/app/src/main/java/audio/funkwhale/ffa/adapters/TracksAdapter.kt b/app/src/main/java/audio/funkwhale/ffa/adapters/TracksAdapter.kt index 049df34d93586ca16ee616e11c0b6bc43e354e7f..499e7996a7495a343889340a8e1e10b446e33645 100644 --- a/app/src/main/java/audio/funkwhale/ffa/adapters/TracksAdapter.kt +++ b/app/src/main/java/audio/funkwhale/ffa/adapters/TracksAdapter.kt @@ -35,6 +35,10 @@ class TracksAdapter( val fromQueue: Boolean = false ) : FFAAdapter<Track, TracksAdapter.ViewHolder>() { + init { + this.stateRestorationPolicy = StateRestorationPolicy.PREVENT_WHEN_EMPTY + } + interface OnFavoriteListener { fun onToggleFavorite(id: Int, state: Boolean) } diff --git a/changes/changelog.d/95.bugfix b/changes/changelog.d/95.bugfix new file mode 100644 index 0000000000000000000000000000000000000000..fda08e7776dd3ebbf01fe41c90027c948fceb1a9 --- /dev/null +++ b/changes/changelog.d/95.bugfix @@ -0,0 +1 @@ +Remember scroll positions in list views (Artists/Albums/...) (#95) \ No newline at end of file