Author: bklaas
Date: Sat Jan 19 15:02:02 2008
New Revision: 1516

URL: http://svn.slimdevices.com?rev=1516&root=Jive&view=rev
Log:
Bug: 5759
Description: Single item playlists immediately push to the songinfo window (for 
Pandora, that's the thumbs up/down page)
Move _goHome() to a public method goHome()
have NowPlaying call goHome()

Modified:
    trunk/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua
    trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua

Modified: trunk/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua?rev=1516&root=Jive&r1=1515&r2=1516&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua 
(original)
+++ trunk/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua Sat 
Jan 19 15:02:02 2008
@@ -461,16 +461,12 @@
                                local type = event:getType()
                                local keyPress = event:getKeycode()
                                if (keyPress == KEY_BACK) then
-                                       local windowStack = 
Framework.windowStack
-                                       Framework:playSound("JUMP")
-                                       while #windowStack > 1 do
-                                               windowStack[#windowStack - 
1]:hide(nil, "JUMP")
-                                       end
                                        -- back to Home
-                                       
--window:hide(Window.transitionPushRight)
+                                       browser:goHome()
                                        return EVENT_CONSUME
 
                                elseif (keyPress == KEY_GO) then
+                                       -- to playlist
                                        browser:showPlaylist()
                                        return EVENT_CONSUME
                                end
@@ -596,7 +592,6 @@
        local transitionOn
        if transition then
                transitionOn = transition
-               log:warn(transitionOn)
        elseif style == 'ss' then
                transitionOn = Window.transitionFadeIn
        elseif style == 'browse' then

Modified: 
trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=1516&root=Jive&r1=1515&r2=1516&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua 
(original)
+++ trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua Sat 
Jan 19 15:02:02 2008
@@ -683,16 +683,6 @@
        showPlaylist()
 end
 
--- _goHome
--- pushes the home window to the top
-local function _goHome()
-       local windowStack = Framework.windowStack
-       Framework:playSound("JUMP")
-       while #windowStack > 1 do
-               windowStack[#windowStack - 1]:hide(nil, "JUMP")
-       end
-end
-
 -- _devnull
 -- sinks that silently swallows data
 -- used for actions that go nowhere (play, add, etc.)
@@ -853,7 +843,7 @@
                                                        log:debug(v.nextWindow)
                                                        if v.nextWindow then
                                                                if v.nextWindow 
== 'home' then
-                                                                       sink = 
_goHome
+                                                                       sink = 
goHome
                                                                elseif 
v.nextWindow == 'playlist' then
                                                                        sink = 
_goPlaylist
                                                                elseif 
v.nextWindow == 'nowPlaying' then
@@ -962,7 +952,7 @@
                           
                -- are we in home?
                if #windowStack > 1 then
-                       _goHome()
+                       goHome()
                else
                        _goNowPlaying()
                end
@@ -1198,7 +1188,7 @@
                                elseif item['nextWindow'] == 'playlist' then
                                        sink = _goPlaylist
                                elseif item['nextWindow'] == 'home' then
-                                       sink = _goHome
+                                       sink = goHome
                                elseif item["showBigArtwork"] then
                                        sink = _bigArtworkPopup
                                elseif actionName == 'go' then
@@ -1681,21 +1671,38 @@
 -- SlimBrowserApplet public methods
 
--==============================================================================
 
+-- goHome
+-- pushes the home window to the top
+function goHome()
+       local windowStack = Framework.windowStack
+       Framework:playSound("JUMP")
+       while #windowStack > 1 do
+               windowStack[#windowStack - 1]:hide(nil, "JUMP")
+       end
+end
+
+
 -- showPlaylist
 --
 function showPlaylist()
        if _statusStep then
                log:debug("showPlaylist()")
-       
-               -- show our NowPlaying window!
-               _statusStep.window:show()
-               
+
                -- arrange so that menuListener works
                _statusStep.origin = _curStep
                _curStep = _statusStep
 
                -- current playlist should select currently playing item 
-               if _statusStep.menu.list.currentIndex then
+               -- if there is only one item in the playlist, bring the 
selected item to top
+               -- FIXME, having the list size of 3 be the indicator of a 
single-item playlist is a hack
+               -- track count should be sent by playerstatus in addition to 
item_loop count
+               if _statusStep.menu.listSize == 3 then
+                       _statusStep.menu["_lastSelectedIndex"] = 1
+                       _statusStep.menu["_lastSelectedOffset"] = 1 
+                       _statusStep.menu.selected = 1
+                       _statusStep.menu:_updateWidgets()
+               -- otherwise bring the currently playing item to the screen 
with offset of 2
+               elseif _statusStep.menu.list.currentIndex then
                        _statusStep.menu.selected = 
_statusStep.menu.list.currentIndex
                        if _statusStep.menu["_lastSelectedIndex"] then
                                _statusStep.menu["_lastSelectedIndex"] = 
_statusStep.menu.selected
@@ -1705,7 +1712,7 @@
                        -- _updateWidgets to display correctly selected item
                        _statusStep.menu:_updateWidgets()
                end
-       
+
                _statusStep.window:addListener(EVENT_KEY_PRESS,
                        function(event)
                                local evtCode = event:getKeycode()
@@ -1714,7 +1721,7 @@
                                        -- if this window is #2 on the stack 
there is no NowPlaying window 
                                        -- (e.g., when playlist is empty)
                                        if #windowStack == 2 then
-                                               _goHome()
+                                               goHome()
                                        else
                                                
_goNowPlaying(Window.transitionPushRight)
                                        end
@@ -1722,11 +1729,29 @@
                                end
                        end
                )
-
-       
+                _statusStep.window:addListener(EVENT_WINDOW_ACTIVE,
+                       function(event)
+                               -- FIXME, next line is a workaround for Bug 6670
+                               _statusStep.window:checkLayout()
+                               -- a menu size of 3 means a single item 
playlist (1 track plus clear/save playlist items)
+                               -- single item playlists are skipped into the 
songinfo window
+                               -- FIXME, having the list size of 3 be the 
indicator of a single-item playlist is a hack
+                               -- track count should be sent by playerstatus 
in addition to item_loop count
+                               if _statusStep.menu.listSize == 3 then
+                                       -- need to spoof a key press here to 
descend one window further
+                                       
_statusStep.menu:dispatchNewEvent(EVENT_ACTION)
+                                       -- we only do this once, so remove the 
listener now
+                                       return EVENT_CONSUME
+                               end
+                       end
+               )
+
+               _statusStep.window:show()
+
                return EVENT_CONSUME
        end
        return EVENT_UNUSED
+
 end
 
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to