Have each button observe separately, so we can track them better
This commit is contained in:
parent
c382464647
commit
f3c9a4c25d
|
@ -76,7 +76,7 @@ end function
|
|||
|
||||
sub setFavoriteColor()
|
||||
fave = m.top.itemContent.favorite
|
||||
fave_button = m.top.findNode("buttons").getChild(3)
|
||||
fave_button = m.top.findNode("favorite-button")
|
||||
if fave
|
||||
fave_button.textColor = "#00ff00ff"
|
||||
fave_button.focusedTextColor = "#269926ff"
|
||||
|
@ -88,7 +88,7 @@ end sub
|
|||
|
||||
sub setWatchedColor()
|
||||
watched = m.top.itemContent.watched
|
||||
watched_button = m.top.findNode("buttons").getChild(2)
|
||||
watched_button = m.top.findNode("watched-button")
|
||||
if watched
|
||||
watched_button.textColor = "#ff0000ff"
|
||||
watched_button.focusedTextColor = "#992626ff"
|
||||
|
|
|
@ -19,10 +19,9 @@
|
|||
<Label id="video_codec" />
|
||||
<Label id="audio_codec" />
|
||||
<ButtonGroup id="buttons" layoutDirection="horiz" itemSpacings="[10, 0]">
|
||||
<Button text="Play" />
|
||||
<Button text="Delete" />
|
||||
<Button text="Watched" />
|
||||
<Button text="Favorite" />
|
||||
<Button text="Play" id="play-button" />
|
||||
<Button text="Watched" id="watched-button" />
|
||||
<Button text="Favorite" id="favorite-button" />
|
||||
</ButtonGroup>
|
||||
<Label id="tagline" />
|
||||
<Label id="overview" />
|
||||
|
|
|
@ -191,25 +191,25 @@ sub ShowMovieDetails(movie_id)
|
|||
scene.itemContent = content
|
||||
|
||||
buttons = scene.findNode("buttons")
|
||||
buttons.observeField("buttonSelected", port)
|
||||
for each b in buttons.getChildren(-1, 0)
|
||||
b.observeField("buttonSelected", port)
|
||||
end for
|
||||
|
||||
while true
|
||||
msg = wait(0, port)
|
||||
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
|
||||
return
|
||||
else if nodeEventQ(msg, "buttonSelected")
|
||||
button = msg.getROSGNode()
|
||||
' TODO - a better way to verify buttonSelected is in fact "play", etc
|
||||
if button.buttonSelected = 0 ' Play
|
||||
if msg.getNode() = "play-button"
|
||||
showVideoPlayer(movie_id)
|
||||
else if button.buttonSelected = 2 ' Watched
|
||||
else if msg.getNode() = "watched-button"
|
||||
if content.watched
|
||||
UnmarkItemWatched(movie_id)
|
||||
else
|
||||
MarkItemWatched(movie_id)
|
||||
end if
|
||||
content.watched = not content.watched
|
||||
else if button.buttonSelected = 3 ' Favorite
|
||||
else if msg.getNode() = "favorite-button"
|
||||
if content.favorite
|
||||
UnmarkItemFavorite(movie_id)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user