Change playlist view cell to avoid execution timeout
This commit is contained in:
1 parent
9baa132ca3
commit
837386b6e0
2 files changed
+18
-20
No files matched your search
@@ -2,13 +2,6 @@ import "pkg:/source/utils/TimeUtils.bs"
|
|||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
FindChildren()
|
|
||||||
end function
|
|
||||||
|
|
||||||
function FindChildren()
|
|
||||||
m.titleLabel = m.top.findNode("titleLabel")
|
|
||||||
m.authorLabel = m.top.findNode("authorLabel")
|
|
||||||
m.thumbnail = m.top.findNode("thumbnail")
|
|
||||||
m.durationRect = m.top.FindNode("durationRect")
|
m.durationRect = m.top.FindNode("durationRect")
|
||||||
m.durationLabel = m.top.FindNode("durationLabel")
|
m.durationLabel = m.top.FindNode("durationLabel")
|
||||||
end function
|
end function
|
||||||
@@ -20,29 +13,29 @@ function OnContentSet() as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if m.titleLabel = invalid
|
m.top.title = content.title
|
||||||
FindChildren()
|
m.top.author = content.author
|
||||||
end if
|
m.top.thumbnailUri = content.thumbnail
|
||||||
|
|
||||||
m.titleLabel.text = content.title
|
|
||||||
m.authorLabel.text = content.author
|
|
||||||
|
|
||||||
m.thumbnail.uri = content.thumbnail
|
|
||||||
if ValidInt(content.lengthSeconds) <> 0
|
if ValidInt(content.lengthSeconds) <> 0
|
||||||
SetDurationText(content.lengthText)
|
SetDurationText(content.lengthText)
|
||||||
m.durationRect.visible = true
|
m.top.durationRectVisible = true
|
||||||
else
|
else
|
||||||
m.durationRect.visible = false
|
m.top.durationRectVisible = false
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function SetDurationText(text as string)
|
function SetDurationText(text as string) as void
|
||||||
|
m.top.duration = text
|
||||||
|
|
||||||
label = m.durationLabel
|
label = m.durationLabel
|
||||||
rect = m.durationRect
|
rect = m.durationRect
|
||||||
|
|
||||||
rectParent = rect.getParent()
|
if label = invalid or rect = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
label.text = text
|
rectParent = rect.getParent()
|
||||||
size = label.localBoundingRect()
|
size = label.localBoundingRect()
|
||||||
|
|
||||||
rect.width = size.width + 16
|
rect.width = size.width + 16
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
<component name="PlaylistViewCell" extends="Group">
|
<component name="PlaylistViewCell" extends="Group">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||||
|
<field id="title" type="string" alias="titleLabel.text" />
|
||||||
|
<field id="author" type="string" alias="authorLabel.text" />
|
||||||
|
<field id="thumbnailUri" type="uri" alias="thumbnailPoster.uri" />
|
||||||
|
<field id="duration" type="string" alias="durationLabel.text" />
|
||||||
|
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<Poster
|
<Poster
|
||||||
id="thumbnail"
|
id="thumbnailPoster"
|
||||||
loadDisplayMode="scaleToZoom"
|
loadDisplayMode="scaleToZoom"
|
||||||
width="190"
|
width="190"
|
||||||
height="106"
|
height="106"
|
||||||
|
|||||||
Reference in new issue
Block a user