1 parent
93c1e48d39
commit
0f000590a0
5 files changed
+48
-43
No files matched your search
+3
-1
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Nothing worth mentioning yet.
|
||||
### Fixed
|
||||
|
||||
- A rare bug that causes the app to crash when displaying video cells
|
||||
|
||||
## [0.18.0] - 2023-12-28
|
||||
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
' TODO:P2 use component properties with alias instead of FindNode
|
||||
m.titleLabel = m.top.FindNode("titleLabel")
|
||||
m.authorLabel = m.top.FindNode("authorLabel")
|
||||
m.updatedLabel = m.top.FindNode("updatedLabel")
|
||||
m.videoCountRect = m.top.FindNode("videoCountRect")
|
||||
m.videoCountLabel = m.top.FindNode("videoCountLabel")
|
||||
m.thumbnail = m.top.FindNode("thumbnail")
|
||||
m.thumbnail.failedBitmapUri = "pkg:/images/thumbnail-missing.jpg"
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
@@ -18,23 +12,28 @@ function OnContentSet() as void
|
||||
return
|
||||
end if
|
||||
|
||||
m.titleLabel.text = content.title
|
||||
m.top.title = content.title
|
||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||
m.authorLabel.text = content._author
|
||||
m.updatedLabel.text = content.updatedText
|
||||
m.top.author = content._author
|
||||
m.top.updated = content.updatedText
|
||||
|
||||
m.thumbnail.uri = content.thumbnail
|
||||
m.top.thumbnailUri = content.thumbnail
|
||||
|
||||
SetVideoCount(content.videoCountText)
|
||||
end function
|
||||
|
||||
function SetVideoCount(videoCountText as string)
|
||||
function SetVideoCount(videoCountText as string) as void
|
||||
m.top.videoCount = videoCountText
|
||||
|
||||
label = m.videoCountLabel
|
||||
rect = m.videoCountRect
|
||||
|
||||
if label = invalid or rect = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
rectParent = rect.getParent()
|
||||
|
||||
label.text = videoCountText
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||
<field id="type" type="string" value="playlist" />
|
||||
<field id="title" type="string" alias="titleLabel.text" />
|
||||
<field id="author" type="string" alias="authorLabel.text" />
|
||||
<field id="updated" type="string" alias="updatedLabel.text" />
|
||||
<field id="thumbnailUri" type="uri" alias="thumbnail.uri" />
|
||||
<field id="videoCount" type="string" alias="videoCountLabel.text" />
|
||||
</interface>
|
||||
<children>
|
||||
<LayoutGroup
|
||||
@@ -10,7 +15,8 @@
|
||||
id="thumbnail"
|
||||
loadDisplayMode="scaleToZoom"
|
||||
width="350"
|
||||
height="196">
|
||||
height="196"
|
||||
failedBitmapUri="pkg:/images/thumbnail-missing.jpg">
|
||||
<Rectangle
|
||||
id="videoCountRect"
|
||||
width="60"
|
||||
|
||||
@@ -3,19 +3,8 @@ import "pkg:/source/utils/TimeUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
FindChildren()
|
||||
end function
|
||||
|
||||
function FindChildren()
|
||||
' TODO:P2 use component properties with alias instead of FindNode
|
||||
m.titleLabel = m.top.FindNode("titleLabel")
|
||||
m.authorLabel = m.top.FindNode("authorLabel")
|
||||
m.viewCountDateLabel = m.top.FindNode("viewCountDateLabel")
|
||||
m.liveRect = m.top.FindNode("liveRect")
|
||||
m.upcomingRect = m.top.FindNode("upcomingRect")
|
||||
m.durationRect = m.top.FindNode("durationRect")
|
||||
m.durationLabel = m.top.FindNode("durationLabel")
|
||||
m.thumbnail = m.top.FindNode("thumbnail")
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
@@ -25,50 +14,51 @@ function OnContentSet() as void
|
||||
return
|
||||
end if
|
||||
|
||||
if m.titleLabel = invalid
|
||||
FindChildren()
|
||||
end if
|
||||
|
||||
m.titleLabel.text = content.title
|
||||
m.authorLabel.text = content.author
|
||||
m.top.title = content.title
|
||||
m.top.author = content.author
|
||||
|
||||
if content.isUpcoming = true
|
||||
m.viewCountDateLabel.text = content.premiereTimestampText
|
||||
m.top.viewCountDate = content.premiereTimestampText
|
||||
else if not StringUtils.IsNullOrEmpty(content.publishedText)
|
||||
label = content.publishedText
|
||||
if not StringUtils.IsNullOrEmpty(content.viewCountText)
|
||||
label = `${label} • ${content.viewCountText}`
|
||||
end if
|
||||
m.viewCountDateLabel.text = label
|
||||
m.top.viewCountDate = label
|
||||
else
|
||||
m.viewCountDateLabel.text = ""
|
||||
m.top.viewCountDate = ""
|
||||
end if
|
||||
|
||||
m.thumbnail.uri = content.thumbnail
|
||||
m.top.thumbnailUri = content.thumbnail
|
||||
|
||||
m.durationRect.visible = false
|
||||
m.upcomingRect.visible = false
|
||||
m.liveRect.visible = false
|
||||
m.top.durationRectVisible = false
|
||||
m.top.upcomingRectVisible = false
|
||||
m.top.liveRectVisible = false
|
||||
|
||||
if ValidInt(content.lengthSeconds) <> 0
|
||||
SetDurationText(content.lengthText)
|
||||
m.durationRect.visible = true
|
||||
m.top.durationRectVisible = true
|
||||
else
|
||||
if content.isUpcoming = true
|
||||
m.upcomingRect.visible = true
|
||||
m.top.upcomingRectVisible = true
|
||||
else if content.liveNow
|
||||
m.liveRect.visible = true
|
||||
m.top.liveRectVisible = true
|
||||
end if
|
||||
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
|
||||
|
||||
if label = invalid or rect = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
rectParent = rect.getParent()
|
||||
|
||||
label.text = text
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||
<field id="type" type="string" value="video" />
|
||||
<field id="title" type="string" alias="titleLabel.text" />
|
||||
<field id="author" type="string" alias="authorLabel.text" />
|
||||
<field id="viewCountDate" type="string" alias="viewCountDateLabel.text" />
|
||||
<field id="liveRectVisible" type="boolean" alias="liveRect.visible" />
|
||||
<field id="upcomingRectVisible" type="boolean" alias="upcomingRect.visible" />
|
||||
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
|
||||
<field id="duration" type="string" alias="durationLabel.text" />
|
||||
<field id="thumbnailUri" type="string" alias="thumbnail.uri" />
|
||||
</interface>
|
||||
<children>
|
||||
<LayoutGroup
|
||||
|
||||
Reference in new issue
Block a user