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]
|
## [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
|
## [0.18.0] - 2023-12-28
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
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.videoCountRect = m.top.FindNode("videoCountRect")
|
||||||
m.videoCountLabel = m.top.FindNode("videoCountLabel")
|
m.videoCountLabel = m.top.FindNode("videoCountLabel")
|
||||||
m.thumbnail = m.top.FindNode("thumbnail")
|
|
||||||
m.thumbnail.failedBitmapUri = "pkg:/images/thumbnail-missing.jpg"
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnContentSet() as void
|
function OnContentSet() as void
|
||||||
@@ -18,23 +12,28 @@ function OnContentSet() as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.titleLabel.text = content.title
|
m.top.title = content.title
|
||||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||||
m.authorLabel.text = content._author
|
m.top.author = content._author
|
||||||
m.updatedLabel.text = content.updatedText
|
m.top.updated = content.updatedText
|
||||||
|
|
||||||
m.thumbnail.uri = content.thumbnail
|
m.top.thumbnailUri = content.thumbnail
|
||||||
|
|
||||||
SetVideoCount(content.videoCountText)
|
SetVideoCount(content.videoCountText)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function SetVideoCount(videoCountText as string)
|
function SetVideoCount(videoCountText as string) as void
|
||||||
|
m.top.videoCount = videoCountText
|
||||||
|
|
||||||
label = m.videoCountLabel
|
label = m.videoCountLabel
|
||||||
rect = m.videoCountRect
|
rect = m.videoCountRect
|
||||||
|
|
||||||
|
if label = invalid or rect = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
rectParent = rect.getParent()
|
rectParent = rect.getParent()
|
||||||
|
|
||||||
label.text = videoCountText
|
|
||||||
size = label.localBoundingRect()
|
size = label.localBoundingRect()
|
||||||
|
|
||||||
rect.width = size.width + 16
|
rect.width = size.width + 16
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
<interface>
|
<interface>
|
||||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||||
<field id="type" type="string" value="playlist" />
|
<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>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<LayoutGroup
|
<LayoutGroup
|
||||||
@@ -10,7 +15,8 @@
|
|||||||
id="thumbnail"
|
id="thumbnail"
|
||||||
loadDisplayMode="scaleToZoom"
|
loadDisplayMode="scaleToZoom"
|
||||||
width="350"
|
width="350"
|
||||||
height="196">
|
height="196"
|
||||||
|
failedBitmapUri="pkg:/images/thumbnail-missing.jpg">
|
||||||
<Rectangle
|
<Rectangle
|
||||||
id="videoCountRect"
|
id="videoCountRect"
|
||||||
width="60"
|
width="60"
|
||||||
|
|||||||
@@ -3,19 +3,8 @@ 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()
|
|
||||||
' 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.durationRect = m.top.FindNode("durationRect")
|
||||||
m.durationLabel = m.top.FindNode("durationLabel")
|
m.durationLabel = m.top.FindNode("durationLabel")
|
||||||
m.thumbnail = m.top.FindNode("thumbnail")
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnContentSet() as void
|
function OnContentSet() as void
|
||||||
@@ -25,50 +14,51 @@ 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.titleLabel.text = content.title
|
|
||||||
m.authorLabel.text = content.author
|
|
||||||
|
|
||||||
if content.isUpcoming = true
|
if content.isUpcoming = true
|
||||||
m.viewCountDateLabel.text = content.premiereTimestampText
|
m.top.viewCountDate = content.premiereTimestampText
|
||||||
else if not StringUtils.IsNullOrEmpty(content.publishedText)
|
else if not StringUtils.IsNullOrEmpty(content.publishedText)
|
||||||
label = content.publishedText
|
label = content.publishedText
|
||||||
if not StringUtils.IsNullOrEmpty(content.viewCountText)
|
if not StringUtils.IsNullOrEmpty(content.viewCountText)
|
||||||
label = `${label} • ${content.viewCountText}`
|
label = `${label} • ${content.viewCountText}`
|
||||||
end if
|
end if
|
||||||
m.viewCountDateLabel.text = label
|
m.top.viewCountDate = label
|
||||||
else
|
else
|
||||||
m.viewCountDateLabel.text = ""
|
m.top.viewCountDate = ""
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.thumbnail.uri = content.thumbnail
|
m.top.thumbnailUri = content.thumbnail
|
||||||
|
|
||||||
m.durationRect.visible = false
|
m.top.durationRectVisible = false
|
||||||
m.upcomingRect.visible = false
|
m.top.upcomingRectVisible = false
|
||||||
m.liveRect.visible = false
|
m.top.liveRectVisible = false
|
||||||
|
|
||||||
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
|
||||||
if content.isUpcoming = true
|
if content.isUpcoming = true
|
||||||
m.upcomingRect.visible = true
|
m.top.upcomingRectVisible = true
|
||||||
else if content.liveNow
|
else if content.liveNow
|
||||||
m.liveRect.visible = true
|
m.top.liveRectVisible = true
|
||||||
end if
|
end if
|
||||||
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
|
||||||
|
|
||||||
|
if label = invalid or rect = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
rectParent = rect.getParent()
|
rectParent = rect.getParent()
|
||||||
|
|
||||||
label.text = text
|
|
||||||
size = label.localBoundingRect()
|
size = label.localBoundingRect()
|
||||||
|
|
||||||
rect.width = size.width + 16
|
rect.width = size.width + 16
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
<interface>
|
<interface>
|
||||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||||
<field id="type" type="string" value="video" />
|
<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>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<LayoutGroup
|
<LayoutGroup
|
||||||
|
|||||||
Reference in new issue
Block a user