From 52c9600a5d44daef20b9cebac4e025c2b5cebf6e Mon Sep 17 00:00:00 2001 From: 1hitsong <3330318+1hitsong@users.noreply.github.com> Date: Sun, 9 Apr 2023 14:05:30 -0400 Subject: [PATCH] Adjust track number display logic Shuffled Enabled: Shuffled Track Number / Total Tracks Shuffled Disabled: Linear Track Number / Total Tracks --- components/music/AudioPlayerView.brs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/components/music/AudioPlayerView.brs b/components/music/AudioPlayerView.brs index 84792112..c49dface 100644 --- a/components/music/AudioPlayerView.brs +++ b/components/music/AudioPlayerView.brs @@ -112,7 +112,6 @@ sub setupInfoNodes() m.playPosition = m.top.findNode("playPosition") m.bufferPosition = m.top.findNode("bufferPosition") m.seekBar = m.top.findNode("seekBar") - m.numberofsongsField = m.top.findNode("numberofsongs") m.shuffleIndicator = m.top.findNode("shuffleIndicator") m.loopIndicator = m.top.findNode("loopIndicator") end sub @@ -339,13 +338,13 @@ function shuffleClicked() as boolean m.shuffleIndicator.opacity = ".4" m.shuffleIndicator.uri = m.shuffleIndicator.uri.Replace("-on", "-off") m.global.queueManager.callFunc("setPosition", currentSongIndex) - setFieldTextValue("numberofsongs", "Track " + stri(m.global.queueManager.callFunc("getPosition") + 1) + "/" + stri(m.global.queueManager.callFunc("getCount"))) - + setTrackNumberDisplay() return true end if m.shuffleIndicator.opacity = "1" m.shuffleIndicator.uri = m.shuffleIndicator.uri.Replace("-off", "-on") + setTrackNumberDisplay() return true end function @@ -357,6 +356,10 @@ sub setShuffleIconState() end if end sub +sub setTrackNumberDisplay() + setFieldTextValue("numberofsongs", "Track " + stri(m.global.queueManager.callFunc("getPosition") + 1) + "/" + stri(m.global.queueManager.callFunc("getCount"))) +end sub + sub LoadNextSong() if m.global.audioPlayer.state = "playing" m.global.audioPlayer.control = "stop" @@ -498,14 +501,8 @@ end sub ' Populate on screen text variables sub setOnScreenTextValues(json) if isValid(json) - currentSongIndex = m.global.queueManager.callFunc("getPosition") - - if m.global.queueManager.callFunc("getIsShuffled") - currentSongIndex = findCurrentSongIndex(m.global.queueManager.callFunc("getUnshuffledQueue")) - end if - if m.playlistTypeCount = 1 - setFieldTextValue("numberofsongs", "Track " + stri(currentSongIndex + 1) + "/" + stri(m.global.queueManager.callFunc("getCount"))) + setTrackNumberDisplay() end if setFieldTextValue("artist", json.Artists[0])