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"
|
||||
|
||||
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.durationLabel = m.top.FindNode("durationLabel")
|
||||
end function
|
||||
@@ -20,29 +13,29 @@ function OnContentSet() as void
|
||||
return
|
||||
end if
|
||||
|
||||
if m.titleLabel = invalid
|
||||
FindChildren()
|
||||
end if
|
||||
m.top.title = content.title
|
||||
m.top.author = content.author
|
||||
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
|
||||
SetDurationText(content.lengthText)
|
||||
m.durationRect.visible = true
|
||||
m.top.durationRectVisible = true
|
||||
else
|
||||
m.durationRect.visible = false
|
||||
m.top.durationRectVisible = false
|
||||
end if
|
||||
end function
|
||||
|
||||
function SetDurationText(text as string)
|
||||
function SetDurationText(text as string) as void
|
||||
m.top.duration = text
|
||||
|
||||
label = m.durationLabel
|
||||
rect = m.durationRect
|
||||
|
||||
rectParent = rect.getParent()
|
||||
if label = invalid or rect = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
label.text = text
|
||||
rectParent = rect.getParent()
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
|
||||
Reference in new issue
Block a user