Make it so resizing happens explicitly and more often

This commit is contained in:
Nick Bisby 2019-03-09 23:53:36 -06:00
parent d9c81a4da7
commit 62ece56456
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36
6 changed files with 53 additions and 22 deletions

View File

@ -13,11 +13,15 @@
m.itemText = m.top.findNode("itemText")
m.itemText.text = "Loading..."
updateSize()
end sub
sub updateSize()
m.itemText = m.top.findNode("itemText")
maxSize = m.top.getParent().itemSize
m.itemText.width = maxSize[0]
m.itemText.translation = [0, (maxSize[1] / 2) - 15]
end sub
function itemContentChanged() as void

View File

@ -12,6 +12,17 @@
m.top.itemComponentName = "LibItem"
m.top.content = getData()
m.top.rowFocusAnimationStyle = "floatingFocus"
m.top.vertFocusAnimationStyle = "floatingFocus"
m.top.showRowLabel = [false]
updateSize()
m.top.setfocus(true)
end sub
sub updateSize()
m.top.numrows = 1
m.top.rowSize = 5
@ -34,13 +45,6 @@
m.top.rowItemSize = [ itemWidth, itemHeight ]
' spacing between items in a row
m.top.rowItemSpacing = [ 0, 0 ]
m.top.rowFocusAnimationStyle = "floatingFocus"
m.top.vertFocusAnimationStyle = "floatingFocus"
m.top.showRowLabel = [false]
m.top.setfocus(true)
end sub
function setData()

View File

@ -15,10 +15,16 @@
<script type="text/brightscript">
<![CDATA[
sub Init()
sub init()
m.title = m.top.findNode("title")
m.poster = m.top.findNode("moviePoster")
updateSize()
end sub
sub updateSize()
m.title = m.top.findNode("title")
m.poster = m.top.findNode("moviePoster")
maxSize = m.top.getParent().itemSize
m.poster.width = int(maxSize[0]) - 4
@ -30,6 +36,8 @@
end sub
function itemContentChanged() as void
updateSize()
' re-declare this because init doesnt re-run
' when we come back from elsewhere
m.title = m.top.findNode("title")

View File

@ -5,6 +5,20 @@
<field id="posterUrl" type="string" />
<field id="movieID" type="string" />
<field id="description" type="string" />
<field id="full_data" type="associativearray" />
<field id="full_data" type="associativearray" onChange="setFields" />
<function name="getPoster" />
</interface>
<script type="text/brightscript" uri="pkg:/source/config.brs" />
<script type="text/brightscript" uri="pkg:/source/JellyfinAPI.brs" />
<script type="text/brightscript">
<![CDATA[
sub setFields()
datum = m.top.full_data
m.top.title = datum.name
m.top.movieID = datum.id
m.top.posterURL = ImageURL(datum.id)
m.top.description = datum.overview
end sub
]]>
</script>
</component>

View File

@ -4,7 +4,7 @@
<LayoutGroup id="main_group" layoutDirection="horiz" translation="[50, 50]">
<Poster id="moviePoster"
translation="[150,150]"
width="196" height="294" />
width="400" height="600" />
<LayoutGroup layoutDirection="vert" translation="[355, 150]" itemSpacings="[0, 10]">
<Label id="title" />
<LayoutGroup layoutDirection="horiz" itemSpacings="[10, 0]">

View File

@ -12,6 +12,18 @@
m.top.itemComponentName = "MovieItem"
m.top.content = getData()
m.top.rowFocusAnimationStyle = "floatingFocus"
'm.top.vertFocusAnimationStyle = "floatingFocus"
m.top.showRowLabel = [false]
updateSize()
m.top.setfocus(true)
end sub
sub updateSize()
m.top.numrows = 1
m.top.rowSize = 5
@ -36,13 +48,6 @@
m.top.rowItemSize = [ itemWidth, itemHeight ]
' spacing between items in a row
m.top.rowItemSpacing = [ 0, 0 ]
m.top.rowFocusAnimationStyle = "floatingFocus"
'm.top.vertFocusAnimationStyle = "floatingFocus"
m.top.showRowLabel = [false]
m.top.setfocus(true)
end sub
function setData()
@ -79,10 +84,6 @@
end if
datum = movieData.Items[index-1]
item = row.CreateChild("MovieItemData")
item.title = datum.name
item.movieID = datum.id
item.posterUrl = ImageURL(datum.id)
item.description = datum.overview
item.full_data = datum
end for
end for