Keep Roku remote focus on the tuner and guide
This commit is contained in:
@@ -13,7 +13,7 @@ sub showPanel(mode as string, title as string, status as string, titles as objec
|
||||
m.menu.jumpToItem = 0
|
||||
m.panel.visible = true
|
||||
if titles.Count() = 0
|
||||
m.top.SetFocus(true)
|
||||
m.remoteFocus.SetFocus(true)
|
||||
else
|
||||
m.menu.SetFocus(true)
|
||||
end if
|
||||
@@ -22,7 +22,7 @@ end sub
|
||||
sub closePanel()
|
||||
m.panelMode = ""
|
||||
m.panel.visible = false
|
||||
m.top.SetFocus(true)
|
||||
m.remoteFocus.SetFocus(true)
|
||||
end sub
|
||||
|
||||
sub onMenuSelect(event as object)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
sub init()
|
||||
for each id in ["video", "weather", "banner", "channelTitle", "clock", "nowTitle", "nextTitle", "progressTrack", "progress", "playbackStatus", "panel", "panelTitle", "panelStatus", "menu", "bannerTimer", "clockTimer", "retryTimer", "guideDetails", "guideChannelTitle", "guideNow", "guideNext", "guideLater"]
|
||||
for each id in ["video", "weather", "banner", "channelTitle", "clock", "nowTitle", "nextTitle", "progressTrack", "progress", "playbackStatus", "panel", "panelTitle", "panelStatus", "menu", "bannerTimer", "clockTimer", "retryTimer", "guideDetails", "guideChannelTitle", "guideNow", "guideNext", "guideLater", "remoteFocus"]
|
||||
m[id] = m.top.FindNode(id)
|
||||
end for
|
||||
m.channels = []
|
||||
@@ -189,6 +189,7 @@ sub playLinear(channel as object)
|
||||
m.video.content = content
|
||||
m.videoChannelId = channel.id
|
||||
m.video.control = "play"
|
||||
restoreRemoteFocus()
|
||||
end sub
|
||||
|
||||
sub refreshSchedule()
|
||||
@@ -288,7 +289,17 @@ sub setPlaybackStatus(message as string)
|
||||
m.playbackStatus.visible = true
|
||||
end sub
|
||||
|
||||
sub restoreRemoteFocus()
|
||||
if m.top.dialog <> invalid and m.top.dialog.IsInFocusChain() then return
|
||||
if m.panel.visible and m.menu.content <> invalid and m.menu.content.GetChildCount() > 0
|
||||
if not m.menu.HasFocus() then m.menu.SetFocus(true)
|
||||
else if not m.remoteFocus.HasFocus()
|
||||
m.remoteFocus.SetFocus(true)
|
||||
end if
|
||||
end sub
|
||||
|
||||
sub onVideoState()
|
||||
restoreRemoteFocus()
|
||||
if m.weather.visible
|
||||
if m.video.state = "error" or m.video.state = "finished" then hideWeatherPreview()
|
||||
return
|
||||
@@ -320,7 +331,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
closePanel()
|
||||
return true
|
||||
end if
|
||||
if key = "options" and m.channels.Count() > 0
|
||||
if key = "options" and (m.channelIndex >= 0 or m.panelMode = "guide" or m.panelMode = "options")
|
||||
if m.panelMode = "guide"
|
||||
showPanel("options", "retroLabs", m.server.name + " " + m.server.baseUrl, ["Program guide", "Refresh channels", "Change server"])
|
||||
else
|
||||
@@ -335,6 +346,9 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if key = "up" then direction = -1
|
||||
openGuide(direction)
|
||||
return true
|
||||
else if key = "right"
|
||||
openGuide()
|
||||
return true
|
||||
else if key = "left" or key = "replay"
|
||||
if m.previousIndex >= 0 then tune(m.previousIndex)
|
||||
return true
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
<script type="text/brightscript" uri="pkg:/components/Guide.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/Weather.brs" />
|
||||
<children>
|
||||
<Audio id="weatherAudio" loop="true" />
|
||||
<Group id="remoteFocus" focusable="true" />
|
||||
<Audio id="weatherAudio" focusable="false" loop="true" />
|
||||
<Group id="weather" visible="false">
|
||||
<Rectangle width="1280" height="720" color="0x21114FFF" />
|
||||
<Rectangle translation="[70,120]" width="1140" height="5" color="0xFFC45CFF" />
|
||||
@@ -63,7 +64,7 @@
|
||||
<Label id="weatherSource" translation="[70,646]" width="1140" height="32"
|
||||
font="font:SmallSystemFont" color="0xB7D4E9FF" />
|
||||
</Group>
|
||||
<Video id="video" width="1280" height="720" enableUI="false" />
|
||||
<Video id="video" focusable="false" width="1280" height="720" enableUI="false" />
|
||||
<Group id="banner" translation="[50,525]" visible="false">
|
||||
<Rectangle width="1180" height="145" color="0x101A32EF" />
|
||||
<Rectangle width="6" height="145" color="0x78E5EBFF" />
|
||||
|
||||
@@ -2,6 +2,7 @@ sub initWeather()
|
||||
for each id in ["weatherLocation", "weatherHeading", "weatherBody", "weatherAlerts", "weatherSource", "weatherRotation", "weatherRefresh", "weatherAudio", "weatherPreviewFrame", "weatherPreviewLabel", "forecastCards"]
|
||||
m[id] = m.top.FindNode(id)
|
||||
end for
|
||||
m.weatherAudio.ObserveField("state", "restoreRemoteFocus")
|
||||
m.weatherRotation.ObserveField("fire", "rotateWeather")
|
||||
m.weatherRefresh.ObserveField("fire", "refreshWeather")
|
||||
end sub
|
||||
@@ -166,6 +167,7 @@ sub updateWeatherMusic(path as dynamic)
|
||||
track.streamFormat = "mp3"
|
||||
m.weatherAudio.content = track
|
||||
m.weatherAudio.control = "play"
|
||||
restoreRemoteFocus()
|
||||
end sub
|
||||
|
||||
function showForecastCards(periods as object) as boolean
|
||||
|
||||
Reference in New Issue
Block a user