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.menu.jumpToItem = 0
|
||||||
m.panel.visible = true
|
m.panel.visible = true
|
||||||
if titles.Count() = 0
|
if titles.Count() = 0
|
||||||
m.top.SetFocus(true)
|
m.remoteFocus.SetFocus(true)
|
||||||
else
|
else
|
||||||
m.menu.SetFocus(true)
|
m.menu.SetFocus(true)
|
||||||
end if
|
end if
|
||||||
@@ -22,7 +22,7 @@ end sub
|
|||||||
sub closePanel()
|
sub closePanel()
|
||||||
m.panelMode = ""
|
m.panelMode = ""
|
||||||
m.panel.visible = false
|
m.panel.visible = false
|
||||||
m.top.SetFocus(true)
|
m.remoteFocus.SetFocus(true)
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
sub onMenuSelect(event as object)
|
sub onMenuSelect(event as object)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
sub init()
|
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)
|
m[id] = m.top.FindNode(id)
|
||||||
end for
|
end for
|
||||||
m.channels = []
|
m.channels = []
|
||||||
@@ -189,6 +189,7 @@ sub playLinear(channel as object)
|
|||||||
m.video.content = content
|
m.video.content = content
|
||||||
m.videoChannelId = channel.id
|
m.videoChannelId = channel.id
|
||||||
m.video.control = "play"
|
m.video.control = "play"
|
||||||
|
restoreRemoteFocus()
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
sub refreshSchedule()
|
sub refreshSchedule()
|
||||||
@@ -288,7 +289,17 @@ sub setPlaybackStatus(message as string)
|
|||||||
m.playbackStatus.visible = true
|
m.playbackStatus.visible = true
|
||||||
end sub
|
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()
|
sub onVideoState()
|
||||||
|
restoreRemoteFocus()
|
||||||
if m.weather.visible
|
if m.weather.visible
|
||||||
if m.video.state = "error" or m.video.state = "finished" then hideWeatherPreview()
|
if m.video.state = "error" or m.video.state = "finished" then hideWeatherPreview()
|
||||||
return
|
return
|
||||||
@@ -320,7 +331,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
|||||||
closePanel()
|
closePanel()
|
||||||
return true
|
return true
|
||||||
end if
|
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"
|
if m.panelMode = "guide"
|
||||||
showPanel("options", "retroLabs", m.server.name + " " + m.server.baseUrl, ["Program guide", "Refresh channels", "Change server"])
|
showPanel("options", "retroLabs", m.server.name + " " + m.server.baseUrl, ["Program guide", "Refresh channels", "Change server"])
|
||||||
else
|
else
|
||||||
@@ -335,6 +346,9 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
|||||||
if key = "up" then direction = -1
|
if key = "up" then direction = -1
|
||||||
openGuide(direction)
|
openGuide(direction)
|
||||||
return true
|
return true
|
||||||
|
else if key = "right"
|
||||||
|
openGuide()
|
||||||
|
return true
|
||||||
else if key = "left" or key = "replay"
|
else if key = "left" or key = "replay"
|
||||||
if m.previousIndex >= 0 then tune(m.previousIndex)
|
if m.previousIndex >= 0 then tune(m.previousIndex)
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
<script type="text/brightscript" uri="pkg:/components/Guide.brs" />
|
<script type="text/brightscript" uri="pkg:/components/Guide.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/components/Weather.brs" />
|
<script type="text/brightscript" uri="pkg:/components/Weather.brs" />
|
||||||
<children>
|
<children>
|
||||||
<Audio id="weatherAudio" loop="true" />
|
<Group id="remoteFocus" focusable="true" />
|
||||||
|
<Audio id="weatherAudio" focusable="false" loop="true" />
|
||||||
<Group id="weather" visible="false">
|
<Group id="weather" visible="false">
|
||||||
<Rectangle width="1280" height="720" color="0x21114FFF" />
|
<Rectangle width="1280" height="720" color="0x21114FFF" />
|
||||||
<Rectangle translation="[70,120]" width="1140" height="5" color="0xFFC45CFF" />
|
<Rectangle translation="[70,120]" width="1140" height="5" color="0xFFC45CFF" />
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
<Label id="weatherSource" translation="[70,646]" width="1140" height="32"
|
<Label id="weatherSource" translation="[70,646]" width="1140" height="32"
|
||||||
font="font:SmallSystemFont" color="0xB7D4E9FF" />
|
font="font:SmallSystemFont" color="0xB7D4E9FF" />
|
||||||
</Group>
|
</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">
|
<Group id="banner" translation="[50,525]" visible="false">
|
||||||
<Rectangle width="1180" height="145" color="0x101A32EF" />
|
<Rectangle width="1180" height="145" color="0x101A32EF" />
|
||||||
<Rectangle width="6" height="145" color="0x78E5EBFF" />
|
<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"]
|
for each id in ["weatherLocation", "weatherHeading", "weatherBody", "weatherAlerts", "weatherSource", "weatherRotation", "weatherRefresh", "weatherAudio", "weatherPreviewFrame", "weatherPreviewLabel", "forecastCards"]
|
||||||
m[id] = m.top.FindNode(id)
|
m[id] = m.top.FindNode(id)
|
||||||
end for
|
end for
|
||||||
|
m.weatherAudio.ObserveField("state", "restoreRemoteFocus")
|
||||||
m.weatherRotation.ObserveField("fire", "rotateWeather")
|
m.weatherRotation.ObserveField("fire", "rotateWeather")
|
||||||
m.weatherRefresh.ObserveField("fire", "refreshWeather")
|
m.weatherRefresh.ObserveField("fire", "refreshWeather")
|
||||||
end sub
|
end sub
|
||||||
@@ -166,6 +167,7 @@ sub updateWeatherMusic(path as dynamic)
|
|||||||
track.streamFormat = "mp3"
|
track.streamFormat = "mp3"
|
||||||
m.weatherAudio.content = track
|
m.weatherAudio.content = track
|
||||||
m.weatherAudio.control = "play"
|
m.weatherAudio.control = "play"
|
||||||
|
restoreRemoteFocus()
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
function showForecastCards(periods as object) as boolean
|
function showForecastCards(periods as object) as boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user