Skip to content

Commit

Permalink
Enable scrolling on Item Text on home screen (#210)
Browse files Browse the repository at this point in the history
* Enable scrolling on Item Text on home screen

* Removing change to loadDisplayMode - added to wrong PR

* Apply scrolling to secondary text on home screen

* Revert "Apply scrolling to secondary text on home screen"

This reverts commit 30ab382.
  • Loading branch information
neilsb authored May 13, 2020
1 parent 86d4b2d commit 8b82d2a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
36 changes: 24 additions & 12 deletions components/home/HomeItem.brs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sub itemContentChanged()
itemData = m.top.itemContent
if itemData = invalid then return

itemText = m.top.findNode("itemText")
m.itemText = m.top.findNode("itemText")
itemPoster = m.top.findNode("itemPoster")
itemTextExtra = m.top.findNode("itemTextExtra")

Expand All @@ -13,7 +13,7 @@ sub itemContentChanged()
end if

itemPoster.width = imageWidth
itemText.width = imageWidth
m.itemText.maxWidth = imageWidth
itemTextExtra.width = imageWidth

' Whether to use WidePoster or Thumbnail in this row
Expand All @@ -23,7 +23,7 @@ sub itemContentChanged()
' Format the Data based on the type of Home Data

if itemData.type = "CollectionFolder" OR itemData.type = "UserView" then
itemText.text = itemData.name
m.itemText.text = itemData.name
itemPoster.uri = itemData.widePosterURL
return
end if
Expand All @@ -32,22 +32,22 @@ sub itemContentChanged()
itemPoster.width = "96"
itemPoster.height = "96"
itemPoster.translation = "[192, 88]"
itemText.text = itemData.name
m.itemText.text = itemData.name
itemPoster.uri = itemData.widePosterURL
return
end if


itemText.height = 34
itemText.font.size = 25
itemText.horizAlign = "left"
itemText.vertAlign = "bottom"
m.itemText.height = 34
m.itemText.font.size = 25
m.itemText.horizAlign = "left"
m.itemText.vertAlign = "bottom"
itemTextExtra.visible = true
itemTextExtra.font.size = 22


if itemData.type = "Episode" then
itemText.text = itemData.json.SeriesName
m.itemText.text = itemData.json.SeriesName

if usePoster = true then
itemPoster.uri = itemData.widePosterURL
Expand All @@ -72,7 +72,7 @@ sub itemContentChanged()
end if

if itemData.type = "Movie" then
itemText.text = itemData.name
m.itemText.text = itemData.name

if imageWidth = 180
itemPoster.uri = itemData.posterURL
Expand All @@ -99,7 +99,7 @@ sub itemContentChanged()

if itemData.type = "Series" then

itemText.text = itemData.name
m.itemText.text = itemData.name

if usePoster = true then
itemPoster.uri = itemData.widePosterURL
Expand All @@ -124,7 +124,7 @@ sub itemContentChanged()
end if

if itemData.type = "MusicAlbum" then
itemText.text = itemData.name
m.itemText.text = itemData.name
itemTextExtra.text = itemData.json.AlbumArtist
itemPoster.uri = itemData.posterURL
return
Expand All @@ -133,3 +133,15 @@ sub itemContentChanged()
print "Unhandled Item Type: " + itemData.type

end sub

'
' Enable title scrolling based on item Focus
sub focusChanged()

if m.top.itemHasFocus = true then
m.itemText.repeatCount = -1
else
m.itemText.repeatCount = 0
end if

end sub
3 changes: 2 additions & 1 deletion components/home/HomeItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<component name="HomeItem" extends="Group">
<children>
<Poster id="itemPoster" width="464" height="261" translation="[8,5]" />
<Label id="itemText" horizAlign="center" vertAlign="center" font="font:SmallBoldSystemFont" height="64" width="456" translation="[8,267]" />
<ScrollingLabel id="itemText" horizAlign="center" vertAlign="center" font="font:SmallBoldSystemFont" height="64" maxWidth="456" translation="[8,267]" repeatCount="0" />
<Label id="itemTextExtra" horizAlign="left" vertAlign="center" font="font:SmallBoldSystemFont" height="32" width="456" translation="[8,300]" visible="false" color="#777777FF" />
</children>
<interface>
<field id="itemContent" type="node" onChange="itemContentChanged" />
<field id="itemHasFocus" type="boolean" onChange="focusChanged" />
</interface>
<script type="text/brightscript" uri="HomeItem.brs" />
</component>

0 comments on commit 8b82d2a

Please sign in to comment.