Add header to artist albums
Add a header to the album RecyclerView in ArtistDetailFragment.
This commit is contained in:
@@ -4,7 +4,7 @@ import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.oxycblt.auxio.ClickListener
|
||||
import org.oxycblt.auxio.databinding.ItemAlbumBigBinding
|
||||
import org.oxycblt.auxio.databinding.ItemAlbumBinding
|
||||
import org.oxycblt.auxio.music.models.Album
|
||||
|
||||
class DetailAlbumAdapter(
|
||||
@@ -16,19 +16,17 @@ class DetailAlbumAdapter(
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
return ViewHolder(
|
||||
ItemAlbumBigBinding.inflate(LayoutInflater.from(parent.context))
|
||||
ItemAlbumBinding.inflate(LayoutInflater.from(parent.context))
|
||||
)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val album = data[position]
|
||||
|
||||
holder.bind(album)
|
||||
holder.bind(data[position])
|
||||
}
|
||||
|
||||
// Generic ViewHolder for an album
|
||||
inner class ViewHolder(
|
||||
private val binding: ItemAlbumBigBinding
|
||||
private val binding: ItemAlbumBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
init {
|
||||
|
||||
@@ -9,8 +9,7 @@ import org.oxycblt.auxio.music.models.Album
|
||||
|
||||
class AlbumAdapter(
|
||||
private val data: List<Album>,
|
||||
private val listener: ClickListener<Album>,
|
||||
private val isLarge: Boolean
|
||||
private val listener: ClickListener<Album>
|
||||
) : RecyclerView.Adapter<AlbumAdapter.ViewHolder>() {
|
||||
|
||||
override fun getItemCount(): Int = data.size
|
||||
@@ -22,9 +21,7 @@ class AlbumAdapter(
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val album = data[position]
|
||||
|
||||
holder.bind(album)
|
||||
holder.bind(data[position])
|
||||
}
|
||||
|
||||
// Generic ViewHolder for an album
|
||||
|
||||
@@ -15,14 +15,9 @@ class SongAdapter(
|
||||
override fun getItemCount(): Int = data.size
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = ItemSongBinding.inflate(LayoutInflater.from(parent.context))
|
||||
|
||||
// Force the item to *actually* be the screen width so ellipsizing can work.
|
||||
binding.root.layoutParams = RecyclerView.LayoutParams(
|
||||
RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT
|
||||
return ViewHolder(
|
||||
ItemSongBinding.inflate(LayoutInflater.from(parent.context))
|
||||
)
|
||||
|
||||
return ViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
|
||||
Reference in New Issue
Block a user