detail: fix issues on small form factors

This commit is contained in:
Alexander Capehart
2024-07-20 16:29:04 -06:00
parent 106194fa52
commit af1ec40dbe
8 changed files with 266 additions and 62 deletions
@@ -137,10 +137,10 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
text = context.getString(R.string.fmt_three, date, songCount, duration)
}
binding.detailPlayButton.setOnClickListener {
binding.detailPlayButton?.setOnClickListener {
playbackModel.play(unlikelyToBeNull(detailModel.currentAlbum.value))
}
binding.detailShuffleButton.setOnClickListener {
binding.detailShuffleButton?.setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentAlbum.value))
}
}
@@ -149,22 +149,22 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
// In the case that this header used to he configured to have no songs,
// we want to reset the visibility of all information that was hidden.
binding.detailPlayButton.isVisible = true
binding.detailShuffleButton.isVisible = true
binding.detailPlayButton?.isVisible = true
binding.detailShuffleButton?.isVisible = true
} else {
// The artist does not have any songs, so hide functionality that makes no sense.
// ex. Play and Shuffle, Song Counts, and Genre Information.
// Artists are always guaranteed to have albums however, so continue to show those.
logD("Artist is empty, disabling genres and playback")
binding.detailSubhead.isVisible = false
binding.detailPlayButton.isEnabled = false
binding.detailShuffleButton.isEnabled = false
binding.detailPlayButton?.isEnabled = false
binding.detailShuffleButton?.isEnabled = false
}
binding.detailPlayButton.setOnClickListener {
binding.detailPlayButton?.setOnClickListener {
playbackModel.play(unlikelyToBeNull(detailModel.currentArtist.value))
}
binding.detailShuffleButton.setOnClickListener {
binding.detailShuffleButton?.setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentArtist.value))
}
}
@@ -129,10 +129,10 @@ class GenreDetailFragment : DetailFragment<Genre, Music>() {
R.string.fmt_two,
context.getPlural(R.plurals.fmt_artist_count, genre.artists.size),
context.getPlural(R.plurals.fmt_song_count, genre.songs.size))
binding.detailPlayButton.setOnClickListener {
binding.detailPlayButton?.setOnClickListener {
playbackModel.play(unlikelyToBeNull(detailModel.currentGenre.value))
}
binding.detailShuffleButton.setOnClickListener {
binding.detailShuffleButton?.setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentGenre.value))
}
}
@@ -225,13 +225,13 @@ class PlaylistDetailFragment :
logD("Playlist is being edited or is empty, disabling playback options")
}
binding.detailPlayButton.apply {
binding.detailPlayButton?.apply {
isEnabled = playable
setOnClickListener {
playbackModel.play(unlikelyToBeNull(detailModel.currentPlaylist.value))
}
}
binding.detailShuffleButton.apply {
binding.detailShuffleButton?.apply {
isEnabled = playable
setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentPlaylist.value))