Here is the whole code for that screen, Please suggest if i am doing something wrong or it's bug in the platform itself.
function CreateMovieListingScreen(asset_type as String)
gridstyle = "mixed-aspect-ratio"
screenFacade=preShowMovieGridScreen(gridstyle)
screenFacade.show()
showMovieGridScreen(screenFacade, gridstyle, asset_type)
end function
Function preShowMovieGridScreen(style as string) As Object
m.movie_port=CreateObject("roMessagePort")
movie_screen = CreateObject("roGridScreen")
movie_screen.SetMessagePort(m.movie_port)
movie_screen.SetDisplayMode("scale-to-fill")
movie_screen.SetGridStyle(style)
'movie_screen.SetLoadingPoster("", "pkg:/images/Content_Tile_HD.png")
return movie_screen
End Function
Function showMovieGridScreen(screen As Object, gridstyle as string, asset_type as String) As string
movie_list_titles = ["Hollywood", "Jazwood", "Bollywood", "Genres", "Audio Language", "Subtitles"]
movie_list_params = ["hollywood", "jazwood", "bollywood"]
movie_list_sec_count = []
movie_list_genre_count = []
movie_list_audio_lang_count = []
movie_list_sub_lang_count = []
movie_list_items = CreateObject("roArray", 3, true)
movie_row_items = CreateObject("roArray", 3, true)
movie_row_items_holder = []
movie_row_style_list = []
tile_color = "31353B"
screen.setupLists(movie_list_titles.count())
screen.SetBreadcrumbEnabled(true)
brd_text = ""
if asset_type = "movie"
brd_text = "Movies"
else if asset_type = "tv_series"
brd_text = "TV Shows"
end if
subStatus = ""
if isUserLoggedin() = true
subStatus = getSubscriptionStatus()
end if
screen.SetBreadcrumbText("Home", brd_text)
screen.SetListNames(movie_list_titles)
for cnt = 0 to movie_list_titles.Count() -1
if movie_list_titles[cnt] <> "Genres"
movieList = getSearchList("eng",invalid,"0","10",movie_list_params[cnt],asset_type,invalid,invalid,invalid)
if movieList <> invalid
movie_list_items.Push(movieList)
if cnt = 0
movie_list_sec_count = movieList.facets.sections
movie_list_genre_count = movieList.facets.categories
movie_list_audio_lang_count = movieList.facets.audio_languages
movie_list_sub_lang_count = movieList.facets.subtitles_languages
sub_count = 0
for each slang in movie_list_sub_lang_count
if slang.iso_639_3 = "ara"
movie_list_sub_lang_count.Delete(sub_count)
end if
sub_count = sub_count + 1
end for
end if
else
print "internet connection problem"
ShowConnectionFailed()
return ""
end if
else
end if
end for
if movie_list_items.Count() > 2
for mcnt = 0 to movie_list_titles.Count() -1
movie_row_items.Clear()
lCount = 0
for each section in movie_list_sec_count
if movie_list_params[mcnt] = section.id
lCount = section.count
end if
end for
iCount = 0
if movie_list_titles[mcnt] <> "Genres" and movie_list_titles[mcnt] <> "Audio Language" and movie_list_titles[mcnt] <> "Subtitles"
movie_row_items[lCount-1] = invalid
movie_row_items_holder[mcnt] = []
movie_row_items_holder[mcnt][lCount-1] = invalid
for each asset in movie_list_items[mcnt].items
obj = CreateObject("roAssociativeArray")
mYear = itostr(asset.year)
obj.Title = asset.title
obj.Description = asset.description
hdposter = ""
sdposter = ""
for each image in asset.images
if image.type = "poster"
hdposter = image.link+"/192x274"
sdposter = image.link+"/140x180"
'print hdposter
end if
end for
obj.HDPosterUrl = hdposter
obj.SDPosterUrl = sdposter
obj.releaseDate = getYearData(asset.vod_model,subStatus,mYear,itostr(asset.duration))
obj.length = asset.duration
'movie_row_items.push(obj)
movie_row_items[iCount] = obj
movie_row_items_holder[mcnt][iCount] = obj
iCount = iCount+1
end for
movie_row_style_list.Push("portrait")
else if movie_list_titles[mcnt] = "Genres"
for each genre in movie_list_genre_count
obj = CreateObject("roAssociativeArray")
'obj.Title = genre.title
'obj.Description = asset.description
hdposter = "http://placeholdit.imgix.net/~text?txtsize=22&w=192&h=144&bg=" +tile_color+"&txtclr=fff&txtfont=bold&txt="+genre.title
sdposter = "http://placeholdit.imgix.net/~text?txtsize=22&w=140&h=94&bg=" +tile_color+"&txtclr=fff&txtfont=bold&txt="+genre.title
obj.HDPosterUrl = hdposter
obj.SDPosterUrl = sdposter
movie_row_items.push(obj)
end for
movie_row_style_list.Push("landscape")
else if movie_list_titles[mcnt] = "Audio Language"
for each alang in movie_list_audio_lang_count
atitle = ""
for each alang_iso_name in m.AvailableLangs
if alang_iso_name.iso_639_3 = alang.iso_639_3
atitle = alang_iso_name.name
end if
end for
obj = CreateObject("roAssociativeArray")
'obj.Title = atitle
'obj.Description = asset.description
hdposter = "http://placeholdit.imgix.net/~text?txtsize=22&w=192&h=144&bg=" +tile_color+"&txtclr=fff&txtfont=bold&txt="+atitle
sdposter = "http://placeholdit.imgix.net/~text?txtsize=22&w=140&h=94&bg=" +tile_color+"&txtclr=fff&txtfont=bold&txt="+atitle
obj.HDPosterUrl = hdposter
obj.SDPosterUrl = sdposter
movie_row_items.push(obj)
end for
movie_row_style_list.Push("landscape")
else if movie_list_titles[mcnt] = "Subtitles"
for each slang in movie_list_sub_lang_count
stitle = ""
for each sub_iso_name in m.AvailableLangs
if sub_iso_name.iso_639_3 = slang.iso_639_3
stitle = sub_iso_name.name
end if
end for
obj = CreateObject("roAssociativeArray")
'obj.Title = stitle
'obj.Description = asset.description
hdposter = "http://placeholdit.imgix.net/~text?txtsize=22&w=192&h=144&bg=" +tile_color+"&txtclr=fff&txtfont=bold&txt="+stitle
sdposter = "http://placeholdit.imgix.net/~text?txtsize=22&w=140&h=94&bg=" +tile_color+"&txtclr=fff&txtfont=bold&txt="+stitle
obj.HDPosterUrl = hdposter
obj.SDPosterUrl = sdposter
movie_row_items.push(obj)
end for
movie_row_style_list.Push("landscape")
end if
if movie_row_items.count() = 0
screen.SetListVisible(mcnt, false) ' Hide Empty Row
end if
screen.SetContentList(mcnt, movie_row_items)
end for
screen.SetListPosterStyles(movie_row_style_list)
while true
print "Waiting for message"
msg = wait(0, m.movie_port)
print "Got Message:";type(msg)
if type(msg) = "roGridScreenEvent" then
if msg.isListItemFocused() then
print"list item focused | current show = "; msg.GetData()
'data = movie_list_items[msg.GetIndex()]
row = msg.GetIndex()
selection = msg.GetData()
if movie_list_titles[row] <> "Genres" and movie_list_titles[row] <> "Audio Language" and movie_list_titles[row] <> "Subtitles"
screen.SetDescriptionVisible(true)
if row < 0 OR row >= movie_list_titles.Count() then
' Debug("Ignoring grid ListItemFocused event for bogus row: " + tostr(msg.GetIndex()))
else
if movie_row_items_holder[row][selection] = invalid or movie_row_items_holder[row][selection+1] = invalid or movie_row_items_holder[row][selection+2] = invalid or movie_row_items_holder[row][selection+3] = invalid or movie_row_items_holder[row][selection+4] = invalid
print "call the loadmore for row" ;row
LoadMoreContent(screen,row,selection,movie_row_items_holder[row],movie_list_items[row],asset_type,movie_list_params[row],subStatus)
else
print "there is some data for row" ;row
end if
end if
else
screen.SetDescriptionVisible(false)
end if
else if msg.isListItemSelected() then
row = msg.GetIndex()
selection = msg.getData()
print "list item selected row= "; row; " selection= "; selection
if movie_list_titles[row] = "Genres"
CreateFilterScreen(movie_list_genre_count[selection], asset_type, invalid, invalid, "Genres")
else if movie_list_titles[row] = "Audio Language"
CreateFilterScreen(invalid, asset_type, movie_list_audio_lang_count[selection].iso_639_3, invalid, "Audio Language")
else if movie_list_titles[row] = "Subtitles"
CreateFilterScreen(invalid, asset_type, invalid, movie_list_sub_lang_count[selection].iso_639_3, "Subtitles")
else if asset_type = "movie"
showSpringboardScreen(movie_list_items[row].items[selection], invalid)
else if asset_type = "tv_series"
createSeasonsScreen(movie_list_items[row].items[selection])
end if
else if msg.isScreenClosed() then
return ""
end if
end if
end while
else
return ""
end if
End Function