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:
OxygenCobalt 2022-01-19 06:52:05 -07:00
parent e5901fa9e2
commit 47fca7819f
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 11 additions and 6 deletions

View file

@ -117,11 +117,10 @@ class MainActivity : AppCompatActivity() {
window?.setDecorFitsSystemWindows(false) window?.setDecorFitsSystemWindows(false)
// "Should we automatically acquire the insets we need and return them // Instead of automatically fetching these insets and exposing them,
// whenever the user wants them?" // the R+ SDK decides to make you specify the insets yourself with a barely
// "Nah, let's make the user define what insets they want instead through // documented API that isn't even mentioned in any of the edge-to-edge
// a barely-documented API that is not brought up in a single tutorial!" // tutorials. Thanks android, very cool!
// "Great idea!"
binding.root.setOnApplyWindowInsetsListener { _, insets -> binding.root.setOnApplyWindowInsetsListener { _, insets ->
WindowInsets.Builder() WindowInsets.Builder()
.setInsets( .setInsets(

View file

@ -80,6 +80,12 @@ class ActionMenu(
} }
inflate(menuRes) 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 -> setOnMenuItemClickListener { item ->
onMenuClick(item.itemId) onMenuClick(item.itemId)
true true

View file

@ -76,8 +76,8 @@ sh("git clone https://github.com/oxygencobalt/ExoPlayer.git " + exoplayer_path)
os.chdir(exoplayer_path) os.chdir(exoplayer_path)
sh("git checkout auxio") sh("git checkout auxio")
print(INFO + "info:" + NC + " installing flac extension...")
flac_ext_jni_path = os.path.join("extensions", "flac", "src", "main", "jni") flac_ext_jni_path = os.path.join("extensions", "flac", "src", "main", "jni")
print(INFO + "info:" + NC + " installing FLAC extension...")
os.chdir(flac_ext_jni_path) os.chdir(flac_ext_jni_path)
sh('curl "https://ftp.osuosl.org/pub/xiph/releases/flac/flac-' + FLAC_VERSION + '.tar.xz" | tar xJ && mv "flac-' + FLAC_VERSION + '" flac') sh('curl "https://ftp.osuosl.org/pub/xiph/releases/flac/flac-' + FLAC_VERSION + '.tar.xz" | tar xJ && mv "flac-' + FLAC_VERSION + '" flac')
sh(ndk_path + "/ndk-build APP_ABI=all -j4") sh(ndk_path + "/ndk-build APP_ABI=all -j4")