detail: reformat
This commit is contained in:
@@ -139,9 +139,7 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
|
|||||||
|
|
||||||
// Add a QoL behavior where navigation to the artist will occur if the artist
|
// Add a QoL behavior where navigation to the artist will occur if the artist
|
||||||
// name is pressed.
|
// name is pressed.
|
||||||
setOnClickListener {
|
setOnClickListener { detailModel.showArtist(album) }
|
||||||
detailModel.showArtist(album)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date, song count, and duration map to the info text
|
// Date, song count, and duration map to the info text
|
||||||
@@ -153,12 +151,8 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
|
|||||||
text = context.getString(R.string.fmt_three, date, songCount, duration)
|
text = context.getString(R.string.fmt_three, date, songCount, duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.detailPlayButton?.setOnClickListener {
|
binding.detailPlayButton?.setOnClickListener { playbackModel.play(album) }
|
||||||
playbackModel.play(album)
|
binding.detailShuffleButton?.setOnClickListener { playbackModel.shuffle(album) }
|
||||||
}
|
|
||||||
binding.detailShuffleButton?.setOnClickListener {
|
|
||||||
playbackModel.shuffle(album)
|
|
||||||
}
|
|
||||||
setToolbarPlaybackButtonsEnabled(true)
|
setToolbarPlaybackButtonsEnabled(true)
|
||||||
updatePlayback(
|
updatePlayback(
|
||||||
playbackModel.song.value,
|
playbackModel.song.value,
|
||||||
|
|||||||
@@ -181,12 +181,8 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
|
|||||||
setToolbarPlaybackButtonsEnabled(false)
|
setToolbarPlaybackButtonsEnabled(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.detailPlayButton?.setOnClickListener {
|
binding.detailPlayButton?.setOnClickListener { playbackModel.play(artist) }
|
||||||
playbackModel.play(artist)
|
binding.detailShuffleButton?.setOnClickListener { playbackModel.shuffle(artist) }
|
||||||
}
|
|
||||||
binding.detailShuffleButton?.setOnClickListener {
|
|
||||||
playbackModel.shuffle(artist)
|
|
||||||
}
|
|
||||||
updatePlayback(
|
updatePlayback(
|
||||||
playbackModel.song.value,
|
playbackModel.song.value,
|
||||||
playbackModel.parent.value,
|
playbackModel.parent.value,
|
||||||
|
|||||||
@@ -22,30 +22,24 @@ import android.os.Bundle
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.WindowInsets
|
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
import com.google.android.material.transition.MaterialSharedAxis
|
import com.google.android.material.transition.MaterialSharedAxis
|
||||||
import org.oxycblt.auxio.BuildConfig
|
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
import org.oxycblt.auxio.BuildConfig
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.databinding.FragmentDetailBinding
|
import org.oxycblt.auxio.databinding.FragmentDetailBinding
|
||||||
import org.oxycblt.auxio.detail.list.DetailListAdapter
|
import org.oxycblt.auxio.detail.list.DetailListAdapter
|
||||||
import org.oxycblt.auxio.list.ListFragment
|
import org.oxycblt.auxio.list.ListFragment
|
||||||
import org.oxycblt.auxio.list.ListViewModel
|
import org.oxycblt.auxio.list.ListViewModel
|
||||||
import org.oxycblt.auxio.list.PlainDivider
|
|
||||||
import org.oxycblt.auxio.list.PlainHeader
|
|
||||||
import org.oxycblt.auxio.music.MusicViewModel
|
import org.oxycblt.auxio.music.MusicViewModel
|
||||||
import org.oxycblt.auxio.playback.PlaybackViewModel
|
import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||||
import org.oxycblt.auxio.util.getDimenPixels
|
import org.oxycblt.auxio.util.getDimenPixels
|
||||||
import org.oxycblt.auxio.util.setFullWidthLookup
|
|
||||||
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
||||||
import org.oxycblt.auxio.util.systemCutoutInsetsCompat
|
|
||||||
import org.oxycblt.musikr.Music
|
import org.oxycblt.musikr.Music
|
||||||
import org.oxycblt.musikr.MusicParent
|
import org.oxycblt.musikr.MusicParent
|
||||||
|
|
||||||
@@ -90,9 +84,9 @@ abstract class DetailFragment<P : MusicParent, C : Music> :
|
|||||||
// 2-pane layout, re-adjust toolbar and pane to insets but not recycler,
|
// 2-pane layout, re-adjust toolbar and pane to insets but not recycler,
|
||||||
// it applies its own insets
|
// it applies its own insets
|
||||||
binding.detailToolbar.setOnApplyWindowInsetsListener { view, insets ->
|
binding.detailToolbar.setOnApplyWindowInsetsListener { view, insets ->
|
||||||
view.updatePadding(top = insets.systemBarInsetsCompat.top)
|
view.updatePadding(top = insets.systemBarInsetsCompat.top)
|
||||||
insets
|
insets
|
||||||
}
|
}
|
||||||
// prevents duplicate titles
|
// prevents duplicate titles
|
||||||
// not needed for buttons since they are not in the dual-pane layout
|
// not needed for buttons since they are not in the dual-pane layout
|
||||||
binding.detailNormalToolbar.titleContainer.alpha = 0f
|
binding.detailNormalToolbar.titleContainer.alpha = 0f
|
||||||
@@ -118,9 +112,7 @@ abstract class DetailFragment<P : MusicParent, C : Music> :
|
|||||||
setOnOverflowMenuClick { onOpenParentMenu() }
|
setOnOverflowMenuClick { onOpenParentMenu() }
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.detailRecycler.apply {
|
binding.detailRecycler.apply { adapter = getDetailListAdapter() }
|
||||||
adapter = getDetailListAdapter()
|
|
||||||
}
|
|
||||||
|
|
||||||
spacingSmall = requireContext().getDimenPixels(R.dimen.spacing_small)
|
spacingSmall = requireContext().getDimenPixels(R.dimen.spacing_small)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,12 +145,8 @@ class GenreDetailFragment : DetailFragment<Genre, Music>() {
|
|||||||
context.getPlural(R.plurals.fmt_artist_count, genre.artists.size),
|
context.getPlural(R.plurals.fmt_artist_count, genre.artists.size),
|
||||||
context.getPlural(R.plurals.fmt_song_count, genre.songs.size),
|
context.getPlural(R.plurals.fmt_song_count, genre.songs.size),
|
||||||
)
|
)
|
||||||
binding.detailPlayButton?.setOnClickListener {
|
binding.detailPlayButton?.setOnClickListener { playbackModel.play(genre) }
|
||||||
playbackModel.play(genre)
|
binding.detailShuffleButton?.setOnClickListener { playbackModel.shuffle(genre) }
|
||||||
}
|
|
||||||
binding.detailShuffleButton?.setOnClickListener {
|
|
||||||
playbackModel.shuffle(genre)
|
|
||||||
}
|
|
||||||
setToolbarPlaybackButtonsEnabled(true)
|
setToolbarPlaybackButtonsEnabled(true)
|
||||||
updatePlayback(
|
updatePlayback(
|
||||||
playbackModel.song.value,
|
playbackModel.song.value,
|
||||||
|
|||||||
@@ -187,10 +187,7 @@ class PlaylistDetailFragment :
|
|||||||
|
|
||||||
override fun onOpenParentMenu() {
|
override fun onOpenParentMenu() {
|
||||||
val currentPlaylist = detailModel.currentPlaylist.value ?: return
|
val currentPlaylist = detailModel.currentPlaylist.value ?: return
|
||||||
listModel.openMenu(
|
listModel.openMenu(R.menu.detail_playlist, currentPlaylist)
|
||||||
R.menu.detail_playlist,
|
|
||||||
currentPlaylist
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenMenu(item: Song) {
|
override fun onOpenMenu(item: Song) {
|
||||||
@@ -250,15 +247,11 @@ class PlaylistDetailFragment :
|
|||||||
|
|
||||||
binding.detailPlayButton?.apply {
|
binding.detailPlayButton?.apply {
|
||||||
isEnabled = playable
|
isEnabled = playable
|
||||||
setOnClickListener {
|
setOnClickListener { playbackModel.play(playlist) }
|
||||||
playbackModel.play(playlist)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
binding.detailShuffleButton?.apply {
|
binding.detailShuffleButton?.apply {
|
||||||
isEnabled = playable
|
isEnabled = playable
|
||||||
setOnClickListener {
|
setOnClickListener { playbackModel.shuffle(playlist) }
|
||||||
playbackModel.shuffle(playlist)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setToolbarPlaybackButtonsEnabled(playable)
|
setToolbarPlaybackButtonsEnabled(playable)
|
||||||
updatePlayback(
|
updatePlayback(
|
||||||
|
|||||||
Reference in New Issue
Block a user