* Refactor long press * Lint fix * Queue UI, refactor PlayQueue to use ContentNode * Add queue notification hint * Play at index * Play queue with highlight * Priority * Comment --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
44 lines
1.0 KiB
Plaintext
44 lines
1.0 KiB
Plaintext
import "pkg:/source/utils/TimeUtils.bs"
|
|
import "pkg:/source/utils/Types.bs"
|
|
|
|
function Init()
|
|
m.durationRect = m.top.FindNode("durationRect")
|
|
m.durationLabel = m.top.FindNode("durationLabel")
|
|
end function
|
|
|
|
function OnContentSet() as void
|
|
content = m.top.itemContent
|
|
|
|
if content = invalid
|
|
return
|
|
end if
|
|
|
|
m.top.title = content.title
|
|
m.top.author = content.author
|
|
m.top.thumbnailUri = content.thumbnail
|
|
|
|
if ValidInt(content.lengthSeconds) <> 0
|
|
SetDurationText(content.lengthText)
|
|
m.top.durationRectVisible = true
|
|
else
|
|
m.top.durationRectVisible = false
|
|
end if
|
|
end function
|
|
|
|
function SetDurationText(text as string) as void
|
|
m.top.duration = text
|
|
|
|
label = m.durationLabel
|
|
rect = m.durationRect
|
|
|
|
if label = invalid or rect = invalid
|
|
return
|
|
end if
|
|
|
|
rectParent = rect.getParent()
|
|
size = label.localBoundingRect()
|
|
|
|
rect.width = size.width + 16
|
|
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
|
end function
|