Greetings is that I am trying to be able to make faster the entry of the section of the films I want to load the individual categories
ParseUrl.brs
Function GetDataCategory()
http = NewHttp(m.top.uri)
source = http.GetToStringWithRetry()
responseJSON = ParseJSON(source)
RowItems=createObject("RoSGNode","ContentNode")
For x=0 To numofcategories
row=createObject("RoSGNode","ContentNode")
row.Id=responseJSON[x].Id
row.Title=responseJSON[x].Title
RowItems.AppendChild(row) 'Add each individual category of items
Next
m.top.content=RowItems 'set top content field to the entire screen's content which will cause the content observer to notice
End Function
Function GetDataMovies()
readInternet=createObject("roUrlTransfer")
readInternet.setUrl(m.top.uri)
source=readInternet.GetToString()
responseJSON = ParseJSON(source)
RowItems=createObject("RoSGNode","ContentNode")
numofitems=responseJSON.Count()-1
For c=0 To numofitems
item=createObject("RoSGNode","ContentNode")
item.Title=responseJSON[c].Title
item.ContentType=responseJSON[c].ContentType
item.ContentId=responseJSON[c].MoviesId
item.Id=responseJSON[c].MoviesId
item.description=responseJSON[c].description
item.url=responseJSON[c].StreamUrls
item.Rating=responseJSON[c].Rating
item.SubtitleUrl=responseJSON[c].SubtitleUrl
item.Length=responseJSON[c].Length
item.streamFormat=responseJSON[c].StreamFormat
item.releasedate=responseJSON[c].ReleaseDate
item.HDPosterURL=m.app.poster + responseJSON[c].HDPosterURL
item.hdbackgroundimageurl=responseJSON[c].hdbackgroundimageurl
RowItems.AppendChild(item) 'Add each individual category of items
Next
m.top.content=RowItems 'set top content field to the entire screen's content which will cause the content observer to notice
End Function
GridScreen.brs
' ********** Copyright 2016 Roku Corp. All Rights Reserved. **********
'inits grid screen
'creates all children
'sets all observers
Function Init()
Print"[GridScreen] Init"
m.rowList=m.top.findNode("RowList")
m.description=m.top.findNode("Description")
m.background=m.top.findNode("Background")
m.top.observeField("visible","onVisibleChange")
m.top.observeField("focusedChild","OnFocusedChildChange")
m.ParseGrid=m.top.findnode("ParseUrl")
End Function
'handler of focused item in RowList
Sub OnItemFocused()
itemFocused=m.top.itemFocused
m.ParseGrid.uri="movies_items.php?cve="+m.top.content.getChild(itemFocused[0]).Id
m.ParseGrid.FunctionName="GetDataMovies"
m.parsegrid.observefield("content","Moviescontent")
m.ParseGrid.control="RUN"
itemAA=m.parsegrid.content
If itemFocused.Count()=2
focusedContent=m.parsegrid.content
If focusedContent<>invalid
print m.top.content.getChild(itemFocused[0]).getChild(itemFocused[1])
m.top.focusedContent=m.top.content.getChild(itemFocused[0]).getChild(itemFocused[1])
m.description.content=focusedContent
m.background.uri=focusedContent.hdBackgroundImageUrl
End If
End If
End Sub
'set proper focus to RowList in case if return from Details Screen
Sub onVisibleChange()
If m.top.visible=TRUE
m.rowList.setFocus(TRUE)
End If
End Sub
'set proper focus to RowList in case if return from Details Screen
Sub OnFocusedChildChange()
If m.top.isInFocusChain() And Not m.rowList.hasFocus()
m.rowList.setFocus(TRUE)
End If
End Sub
This contains all the movies
itemAA=m.parsegrid.content
Our system http://www.rokumanager.com