Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
hugetv
Level 7

help roGridScreen fast open

as I can make my roGrid Screen open fast
Our system http://www.rokumanager.com
0 Kudos
14 Replies
hugetv
Level 7

Re: help roGridScreen fast open

I'm using the code where you want to make open much faster

Sub showMoviesScreen()
dlg = CreateObject("roOneLineDialog")
dlg.setTitle("Loading Collection")
dlg.showBusyAnimation()
dlg.show()
screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.SetGridStyle("flat-portrait")
screen.SetDescriptionVisible(true)
screen.SetBreadcrumbText("Movies", "Session")

categoryList = getCategoryListMovies()
categoryCount = categoryList.count()

seriesList = CreateObject("roList")

screen.SetupLists(categoryCount)
screen.setListNames(categoryList)


for i = 0 to categoryCount-1
tmpMoviesList = getMoviesByCategory(categoryList[i])
screen.SetContentList(i,tmpMoviesList)
seriesList.AddTail(tmpMoviesList)
end for

screen.show()
dlg.close()

while true
msg = wait(10, port)


if msg <> invalid and type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed() then
exit while
else if msg.isListItemSelected() then
selection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]

if selection.Title = "Search"
searchMovies()
else if selection.Title = "Favorites"
FavoritesMovies()
else
showSpringboardScreenMovies(selection)
end if

end if
end if
end while

End Sub

Function getCategoryListMovies() as object
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/category.php?t=movie")
json = ParseJson(jsonAsString.GetToString())
return json
End Function


Function getMoviesByCategory(category)
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/movie.php?cat="+spaceEscape(category))
json = ParseJson(jsonAsString.GetToString())
return json.Videos
End Function
Our system http://www.rokumanager.com
0 Kudos
hugetv
Level 7

Re: help roGridScreen fast open

someone could help
Our system http://www.rokumanager.com
0 Kudos
hugetv
Level 7

Re: help roGridScreen fast open

could have someone to help me with this please
Our system http://www.rokumanager.com
0 Kudos
TheEndless
Level 7

Re: help roGridScreen fast open

It's not entirely clear what you're asking. The GridScreen will open as soon as you call screen.show(). In your code, you're not calling screen.show() until after you've loaded the data. If you call screen.show() immediately after calling screen.setListNames(categoryList), it might do what you asking, but the speed of the show will still be dependent on how long your getCategoryListMovies() takes.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
hugetv
Level 7

Re: help roGridScreen fast open

"TheEndless" wrote:
It's not entirely clear what you're asking. The GridScreen will open as soon as you call screen.show(). In your code, you're not calling screen.show() until after you've loaded the data. If you call screen.show() immediately after calling screen.setListNames(categoryList), it might do what you asking, but the speed of the show will still be dependent on how long your getCategoryListMovies() takes.


and that I can do to get Movies Category List () to make it more Thin and care less data to enter
Our system http://www.rokumanager.com
0 Kudos
TheEndless
Level 7

Re: help roGridScreen fast open

"hugetv" wrote:
"TheEndless" wrote:
It's not entirely clear what you're asking. The GridScreen will open as soon as you call screen.show(). In your code, you're not calling screen.show() until after you've loaded the data. If you call screen.show() immediately after calling screen.setListNames(categoryList), it might do what you asking, but the speed of the show will still be dependent on how long your getCategoryListMovies() takes.


and that I can do to get Movies Category List () to make it more Thin and care less data to enter

It's possible, but that's hard to say without knowing what it's doing. Getting the category list, however, may not be that slow, so adding the screen.show() where I suggested above could still result in a much faster screen opening.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
hugetv
Level 7

Re: help roGridScreen fast open

this

    Sub showMoviesScreen()
dlg = CreateObject("roOneLineDialog")
dlg.setTitle("Loading Collection")
dlg.showBusyAnimation()
dlg.show()
screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.SetGridStyle("flat-portrait")
screen.SetDescriptionVisible(true)
screen.SetBreadcrumbText("Movies", "Session")

categoryList = getCategoryListMovies()
categoryCount = categoryList.count()

seriesList = CreateObject("roList")

screen.SetupLists(categoryCount)
screen.show()
screen.setListNames(categoryList)


for i = 0 to categoryCount-1
tmpMoviesList = getMoviesByCategory(categoryList[i])
screen.SetContentList(i,tmpMoviesList)
seriesList.AddTail(tmpMoviesList)
end for

dlg.close()

while true
msg = wait(10, port)


if msg <> invalid and type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed() then
exit while
else if msg.isListItemSelected() then
selection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]

if selection.Title = "Search"
searchMovies()
else if selection.Title = "Favorites"
FavoritesMovies()
else
showSpringboardScreenMovies(selection)
end if

end if
end if
end while

End Sub

Function getCategoryListMovies() as object
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/category.php?t=movie")
json = ParseJson(jsonAsString.GetToString())
return json
End Function


Function getMoviesByCategory(category)
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/movie.php?cat="+spaceEscape(category))
json = ParseJson(jsonAsString.GetToString())
return json.Videos
End Function


error

Our system http://www.rokumanager.com
0 Kudos
TheEndless
Level 7

Re: help roGridScreen fast open

That looks like you're getting a back index back from the event. You should add a null check...
Instead of
selection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]

Break it into multiple statements...
list = seriesList.GetEntry(msg.GetIndex())
if list <> invalid then
selection = list[msg.GetData()]
end if
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
hugetv
Level 7

Re: help roGridScreen fast open

"TheEndless" wrote:
That looks like you're getting a back index back from the event. You should add a null check...
Instead of
selection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]

Break it into multiple statements...
list = seriesList.GetEntry(msg.GetIndex())
if list <> invalid then
selection = list[msg.GetData()]
end if


I thank you very much worked
Our system http://www.rokumanager.com
0 Kudos