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