Fix RTL constraints for Album/Song items
Fix incorrect constraints when viewing an album or song item in Right-To-Left mode.
This commit is contained in:
@@ -32,6 +32,7 @@ class LibraryFragment : Fragment() {
|
||||
val adapter = AlbumDataAdapter()
|
||||
binding.libraryRecycler.adapter = adapter
|
||||
binding.libraryRecycler.applyDivider()
|
||||
binding.libraryRecycler.setHasFixedSize(true)
|
||||
|
||||
libraryModel.albums.observe(
|
||||
viewLifecycleOwner,
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.oxycblt.auxio.databinding.SongItemBinding
|
||||
import org.oxycblt.auxio.music.models.Song
|
||||
import org.oxycblt.auxio.recycler.SongViewHolder
|
||||
@@ -17,15 +18,20 @@ class SongDataAdapter : ListAdapter<Song, SongViewHolder>(DiffCallback) {
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SongViewHolder {
|
||||
return SongViewHolder(
|
||||
SongItemBinding.inflate(LayoutInflater.from(parent.context))
|
||||
val binding = SongItemBinding.inflate(LayoutInflater.from(parent.context))
|
||||
|
||||
// Force the layout to be the width of the screen so that the cutoff can work properly.
|
||||
binding.root.layoutParams = RecyclerView.LayoutParams(
|
||||
RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
|
||||
return SongViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: SongViewHolder, position: Int) {
|
||||
val Song = getItem(position)
|
||||
val song = getItem(position)
|
||||
|
||||
holder.bind(Song)
|
||||
holder.bind(song)
|
||||
}
|
||||
|
||||
companion object DiffCallback : DiffUtil.ItemCallback<Song>() {
|
||||
|
||||
@@ -30,6 +30,7 @@ class SongsFragment : Fragment() {
|
||||
val adapter = SongDataAdapter()
|
||||
binding.songRecycler.adapter = adapter
|
||||
binding.songRecycler.applyDivider()
|
||||
binding.songRecycler.setHasFixedSize(true)
|
||||
|
||||
songsModel.songs.observe(
|
||||
viewLifecycleOwner,
|
||||
|
||||
Reference in New Issue
Block a user