#95: Remember scroll positions in list views

This commit is contained in:
Ryan Harg 2021-09-10 09:44:36 +02:00
parent 81dea70ebe
commit 898d2b437b
No known key found for this signature in database
GPG Key ID: 89106F3A84E6958C
7 changed files with 23 additions and 0 deletions

View File

@ -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)
}

View File

@ -42,6 +42,8 @@ class ArtistsAdapter(
super.onItemRangeInserted(positionStart, itemCount)
}
})
this.stateRestorationPolicy = StateRestorationPolicy.PREVENT_WHEN_EMPTY
}
override fun getItemCount() = active.size

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}

View File

@ -0,0 +1 @@
Remember scroll positions in list views (Artists/Albums/...) (#95)