Sub Main()
'initialize theme attributes like titles, logos and overhang color
initTheme()
'prepare the screen for display and get ready to begin
screen=preShowHomeScreen("", "")
if screen=invalid then
print "unexpected error in preShowHomeScreen"
return
end if
showWelcomeScreen()
showRegScreen()
'set to go, time to get started
showHomeScreen(screen)
End Sub
Function showWelcomeScreen() As Void
port = CreateObject("roMessagePort")
screen = CreateObject("roParagraphScreen")
screen.SetMessagePort(port)
screen.AddHeaderText("XYZ Channel")
screen.AddParagraph("blah")
screen.AddParagraph("blah blah")
screen.AddButton(1, "next")
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roParagraphScreenEvent" then
if msg.isButtonPressed() then
exit while
end if
end if
end while
screen.Close()
End Function
Function showRegScreen() As Void
port = CreateObject("roMessagePort")
screen = CreateObject("roCodeRegistrationScreen")
screen.SetMessagePort(port)
screen.AddParagraph("blah")
screen.AddFocalText(" ", "spacing-dense")
screen.AddFocalText("From your computer,", "spacing-dense")
screen.AddFocalText("go to www.xyz.com/roku", "spacing-dense")
screen.AddFocalText("and enter this code:", "spacing-dense")
screen.AddFocalText(" ", "spacing-dense")
screen.SetRegistrationCode("retrieving code..")
screen.AddParagraph("This screen will automatically update once your Roku player has been linked.")
screen.AddButton(0, "get a new code")
screen.AddButton(1, "back")
screen.Show()
sleep(10000)
screen.SetRegistrationCode("ABC7TG")
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roCodeRegistrationScreenEvent" then
exit while
end if
end while
screen.Close()
End Function
Sub Main()
'initialize theme attributes like titles, logos and overhang color
initTheme()
'display a fake screen while the real one initializes. this screen
'has to live for the duration of the whole app to prevent flashing
'back to the roku home screen.
screenFacade = CreateObject("roPosterScreen")
screenFacade.show()
showWelcomeScreen()
showRegScreen()
Items = [ {ContentType:"episode"
SDPosterUrl:"file://pkg:/images/DanGilbert.jpg"
HDPosterUrl:"file://pkg:/images/DanGilbert.jpg"
IsHD:true
HDBranded:true
ShortDescriptionLine1:"Dan Gilbert asks, Why are we happy?"
ShortDescriptionLine2:""
Description:"Harvard psychologist Dan Gilbert says our beliefs about what will make us happy are often wrong -- a premise he supports with intriguing research, and explains in his accessible and unexpectedly funny book, Stumbling on Happiness."
Rating:"NR"
StarRating:"80"
Length:1280
Categories:["Technology","Talk"]
Title:"Dan Gilbert asks, Why are we happy?"
},
{ContentType:"episode"
SDPosterUrl:"file://pkg:/images/DanGilbert.jpg"
HDPosterUrl:"file://pkg:/images/DanGilbert.jpg"
IsHD:true
HDBranded:true
ShortDescriptionLine1:"Dan Gilbert asks, Why are we happy?"
ShortDescriptionLine2:""
Description:"Harvard psychologist Dan Gilbert says our beliefs about what will make us happy are often wrong -- a premise he supports with intriguing research, and explains in his accessible and unexpectedly funny book, Stumbling on Happiness."
Rating:"NR"
StarRating:"80"
Length:1280
Categories:["Technology","Talk"]
Title:"Dan Gilbert asks, Why are we happy?"
}
]
port = CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
screen.SetBreadcrumbText("Roku", "FeatureTests")
Categories = [ "Category 1", "Category 2", "Category 3" ]
Categories2 = [ "Category A", "Category B", "Category C" ]
screen.SetListNames(Categories)
screen.SetContentList(Items)
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
print "Event: type: "; msg.GetType(); " Index: " ;msg.GetIndex(); " Data: " msg.GetData(); " msg: " msg.GetMessage()
if type(msg) = "roPosterScreenEvent"
if msg.isScreenClosed()
print "Screen closed"
exit while
endif
endif
end while
End Sub
'*************************************************************
'** Set the configurable theme attributes for the application
'**
'** Configure the custom overhang and Logo attributes
'*************************************************************
Sub initTheme()
app = CreateObject("roAppManager")
theme = CreateObject("roAssociativeArray")
theme.OverhangPrimaryLogoOffsetSD_X = "72"
theme.OverhangPrimaryLogoOffsetSD_Y = "15"
theme.OverhangSliceSD = "pkg:/images/Overhang_BackgroundSlice_SD43.png"
theme.OverhangPrimaryLogoSD = "pkg:/images/Logo_Overhang_SD43.png"
theme.OverhangPrimaryLogoOffsetHD_X = "123"
theme.OverhangPrimaryLogoOffsetHD_Y = "20"
theme.OverhangSliceHD = "pkg:/images/Overhang_BackgroundSlice_HD.png"
theme.OverhangPrimaryLogoHD = "pkg:/images/Logo_Overhang_HD.png"
app.SetTheme(theme)
End Sub
Function showWelcomeScreen() As Void
port = CreateObject("roMessagePort")
screen = CreateObject("roParagraphScreen")
screen.SetMessagePort(port)
screen.AddHeaderText("XYZ Channel")
screen.AddParagraph("blah")
screen.AddParagraph("blah blah")
screen.AddButton(1, "next")
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roParagraphScreenEvent" then
if msg.isButtonPressed() then
exit while
end if
end if
end while
screen.Close()
End Function
Function showRegScreen() As Void
port = CreateObject("roMessagePort")
screen = CreateObject("roCodeRegistrationScreen")
screen.SetMessagePort(port)
screen.AddParagraph("blah")
screen.AddFocalText(" ", "spacing-dense")
screen.AddFocalText("From your computer,", "spacing-dense")
screen.AddFocalText("go to www.xyz.com/roku", "spacing-dense")
screen.AddFocalText("and enter this code:", "spacing-dense")
screen.AddFocalText(" ", "spacing-dense")
screen.SetRegistrationCode("retrieving code..")
screen.AddParagraph("This screen will automatically update once your Roku player has been linked.")
screen.AddButton(0, "get a new code")
screen.AddButton(1, "back")
screen.Show()
sleep(10000)
screen.SetRegistrationCode("ABC7TG")
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roCodeRegistrationScreenEvent" then
exit while
end if
end while
screen.Close()
End Function
else if msg.isListItemSelected() then
print "list item selected | index = "; msg.GetIndex()