ui: disable queue adding if no playback
If theres no playback going on, disable the play next/add to queue options, as they will have no effect. This mostly for QoL purposes.
This commit is contained in:
@@ -117,11 +117,10 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
window?.setDecorFitsSystemWindows(false)
|
||||
|
||||
// "Should we automatically acquire the insets we need and return them
|
||||
// whenever the user wants them?"
|
||||
// "Nah, let's make the user define what insets they want instead through
|
||||
// a barely-documented API that is not brought up in a single tutorial!"
|
||||
// "Great idea!"
|
||||
// Instead of automatically fetching these insets and exposing them,
|
||||
// the R+ SDK decides to make you specify the insets yourself with a barely
|
||||
// documented API that isn't even mentioned in any of the edge-to-edge
|
||||
// tutorials. Thanks android, very cool!
|
||||
binding.root.setOnApplyWindowInsetsListener { _, insets ->
|
||||
WindowInsets.Builder()
|
||||
.setInsets(
|
||||
|
||||
@@ -80,6 +80,12 @@ class ActionMenu(
|
||||
}
|
||||
|
||||
inflate(menuRes)
|
||||
|
||||
// Disable any queue options if we don't have anything playing.
|
||||
val queueEnabled = playbackModel.song.value != null
|
||||
menu.findItem(R.id.action_play_next)?.isEnabled = queueEnabled
|
||||
menu.findItem(R.id.action_queue_add)?.isEnabled = queueEnabled
|
||||
|
||||
setOnMenuItemClickListener { item ->
|
||||
onMenuClick(item.itemId)
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user