playback: update tablet layouts

Use proper exact-size layouts for the tablet views. This also adds a
new compact view that shows more controls for landscape/tablet layouts.
This commit is contained in:
OxygenCobalt
2021-11-20 10:44:40 -07:00
parent 58c2681f72
commit 4475d4a5cc
8 changed files with 152 additions and 21 deletions
@@ -142,10 +142,6 @@ class MainFragment : Fragment(), PlaybackBarLayout.ActionCallback {
return binding.root
}
override fun onPlayPauseClick() {
playbackModel.invertPlayingStatus()
}
override fun onNavToPlayback() {
findNavController().navigate(
MainFragmentDirections.actionGoToPlayback()
@@ -155,4 +151,16 @@ class MainFragment : Fragment(), PlaybackBarLayout.ActionCallback {
override fun onNavToItem() {
detailModel.navToItem(playbackModel.song.value ?: return)
}
override fun onPrev() {
playbackModel.skipPrev()
}
override fun onPlayPauseClick() {
playbackModel.invertPlayingStatus()
}
override fun onNext() {
playbackModel.skipNext()
}
}
@@ -352,7 +352,9 @@ class PlaybackBarLayout @JvmOverloads constructor(
* view is detached.
*/
interface ActionCallback {
fun onPrev()
fun onPlayPauseClick()
fun onNext()
fun onNavToItem()
fun onNavToPlayback()
}
@@ -81,10 +81,6 @@ class PlaybackBarView @JvmOverloads constructor(
true
}
binding.playbackPlayPause.setOnClickListener {
mCallback?.onPlayPauseClick()
}
// Deliberately override the progress bar color [in a Lollipop-friendly way] so that
// we use colorSecondary instead of colorSurfaceVariant. This is for two reasons:
// 1. colorSurfaceVariant is used with the assumption that the view that is using it
@@ -115,9 +111,11 @@ class PlaybackBarView @JvmOverloads constructor(
fun setCallback(callback: PlaybackBarLayout.ActionCallback) {
mCallback = callback
binding.callback = callback
}
fun clearCallback() {
mCallback = null
binding.callback = null
}
}