Merge pull request #248 from neilsb/display-boxsets-in-itemgrid

Display boxsets in new Item Grid
This commit is contained in:
Anthony Lavado 2020-07-15 00:10:25 -04:00 committed by GitHub
commit 0a885a6725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 16 deletions

View File

@ -3,6 +3,7 @@ sub init()
m.itemGrid = m.top.findNode("itemGrid")
m.backdrop = m.top.findNode("backdrop")
m.newBackdrop = m.top.findNode("backdropTransition")
m.emptyText = m.top.findNode("emptyText")
m.swapAnimation = m.top.findNode("backroundSwapAnimation")
m.swapAnimation.observeField("state", "swapDone")
@ -30,6 +31,10 @@ end sub
'Load initial set of Data
sub loadInitialItems()
if m.top.parentItem.backdropUrl <> invalid then
SetBackground(m.top.parentItem.backdropUrl)
end if
m.loadItemsTask.itemId = m.top.parentItem.Id
m.loadItemsTask.observeField("content", "ItemDataLoaded")
@ -62,6 +67,15 @@ sub ItemDataLoaded(msg)
m.loadedItems = m.itemGrid.content.getChildCount()
m.loadedRows = m.loadedItems / m.itemGrid.numColumns
m.Loading = false
'If there are no items to display, show message
if m.loadedItems = 0 then
m.emptyText.text = tr("NO_ITEMS").Replace("%1", m.top.parentItem.Type)
m.emptyText.visible = true
end if
m.itemGrid.setFocus(true)
end sub
'
@ -83,9 +97,14 @@ sub onItemFocused()
focusedRow = CInt(m.itemGrid.itemFocused / m.itemGrid.numColumns) + 1
' Set Background
itemInt = m.itemGrid.itemFocused
' If no selected item, set background to parent backdrop
if itemInt = -1 then
return
end if
' Set Background to item backdrop
SetBackground(m.itemGrid.content.getChild(m.itemGrid.itemFocused).backdropUrl)
' Load more data if focus is within last 3 rows, and there are more items to load

View File

@ -23,6 +23,7 @@
itemSize = "[ 290, 425 ]"
itemSpacing = "[ 0, 45 ]"
drawFocusFeedback = "false" />
<Label translation="[0,540]" id="emptyText" font="font:LargeSystemFont" width="1920" horizAlign="center" vertAlign="center" height="64" visible="false" />
<OptionsSlider id="options" />
<Animation id="backroundSwapAnimation" duration="1" repeat="false" easeFunction="linear" >
<FloatFieldInterpolator id = "fadeinLoading" key="[0.0, 1.0]" keyValue="[ 0.00, 0.25 ]" fieldToInterp="backdropTransition.opacity" />

View File

@ -1,7 +1,8 @@
sub itemContentChanged()
itemData = m.top.itemContent
if itemData = invalid then return
itemData.Title = itemData.name ' Temporarily required while we move from "HomeItem" to "JFContentItem"
m.itemText = m.top.findNode("itemText")
itemPoster = m.top.findNode("itemPoster")
itemTextExtra = m.top.findNode("itemTextExtra")

View File

@ -252,5 +252,13 @@
<source>Unable to load Channel Data from the server</source>
<translation>Unable to load Channel Data from the server</translation>
</message>
<message>
<comment>Message displayed in Item Grid when no item to display. %1 is container type (e.g. Boxset, Collection, Folder, etc)</comment>
<source>NO_ITEMS</source>
<translation>This %1 contains no items</translation>
</message>
</context>
</TS>

View File

@ -253,5 +253,11 @@
<translation>Unable to load Channel Data from the server</translation>
</message>
<message>
<comment>Message displayed in Item Grid when no item to display. %1 is container type (e.g. Boxset, Collection, Folder, etc)</comment>
<source>NO_ITEMS</source>
<translation>This %1 contains no items</translation>
</message>
</context>
</TS>

View File

@ -86,36 +86,36 @@ sub Main()
group.lastFocus = group.focusedChild
group.setFocus(false)
group.visible = false
m.overhang.title = selectedItem.name
m.overhang.title = selectedItem.title
group = CreateMovieListGroup(selectedItem)
group.overhangTitle = selectedItem.name
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "tvshows"
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "tvshows"
group.lastFocus = group.focusedChild
group.setFocus(false)
group.visible = false
m.overhang.title = selectedItem.name
m.overhang.title = selectedItem.title
group = CreateSeriesListGroup(selectedItem)
group.overhangTitle = selectedItem.name
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "boxsets"
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "boxsets" OR selectedItem.type = "Boxset"
group.lastFocus = group.focusedChild
group.setFocus(false)
group.visible = false
m.overhang.title = selectedItem.name
m.overhang.title = selectedItem.title
group = CreateCollectionsList(selectedItem)
group.overhangTitle = selectedItem.name
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "livetv"
group.lastFocus = group.focusedChild
group.setFocus(false)
group.visible = false
m.overhang.title = selectedItem.name
m.overhang.title = selectedItem.title
group = CreateChannelList(selectedItem.Id)
group.overhangTitle = selectedItem.name
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if selectedItem.type = "Boxset" then
@ -148,11 +148,11 @@ sub Main()
group.setFocus(false)
group.visible = false
m.overhang.title = selectedItem.name
m.overhang.title = selectedItem.title
m.overhang.showOptions = false
m.scene.unobserveField("optionsPressed")
group = CreateSeriesDetailsGroup(selectedItem.json)
group.overhangTitle = selectedItem.name
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if selectedItem.type = "Movie" then
' open movie detail page
@ -160,11 +160,11 @@ sub Main()
group.setFocus(false)
group.visible = false
m.overhang.title = selectedItem.name
m.overhang.title = selectedItem.title
m.overhang.showOptions = false
m.scene.unobserveField("optionsPressed")
group = CreateMovieDetailsGroup(selectedItem)
group.overhangTitle = selectedItem.name
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if selectedItem.type = "Video" then
' play episode