Replace API checkmarks for played items on home view

This commit is contained in:
1hitsong 2023-04-23 12:36:44 -04:00
parent eab0d22369
commit 7d477cc976
6 changed files with 35 additions and 11 deletions

View File

@ -0,0 +1,4 @@
sub init()
m.checkmark = m.top.findNode("checkmark")
m.checkmark.font.size = 35
end sub

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="PlayedCheckmark" extends="Rectangle">
<children>
<Label id="checkmark" width="60" height="42" font="font:SmallestBoldSystemFont" horizAlign="center" vertAlign="bottom" text="✓" />
</children>
<script type="text/brightscript" uri="PlayedCheckmark.brs" />
</component>

View File

@ -28,8 +28,9 @@ sub setData()
end if
else if datum.type = "Episode"
imgParams = { "AddPlayedIndicator": datum.UserData.Played }
m.top.watched = datum.UserData.Played
imgParams = {}
imgParams.Append({ "maxHeight": 261 })
imgParams.Append({ "maxWidth": 464 })
@ -68,8 +69,9 @@ sub setData()
end if
else if datum.type = "Movie"
imgParams = { AddPlayedIndicator: datum.UserData.Played }
m.top.watched = datum.UserData.Played
imgParams = {}
imgParams.Append({ "maxHeight": 261 })
imgParams.Append({ "maxWidth": 175 })
@ -92,8 +94,9 @@ sub setData()
end if
else if datum.type = "Video"
imgParams = { AddPlayedIndicator: datum.UserData.Played }
m.top.watched = datum.UserData.Played
imgParams = {}
imgParams.Append({ "maxHeight": 261 })
imgParams.Append({ "maxWidth": 175 })

View File

@ -13,6 +13,7 @@
<field id="imageWidth" type="integer" value="464" />
<field id="PlayedPercentage" type="float" value="0" />
<field id="usePoster" type="bool" value="false" />
<field id="watched" type="bool" value="false" />
</interface>
<script type="text/brightscript" uri="pkg:/source/api/baserequest.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />

View File

@ -9,6 +9,7 @@ sub init()
m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
m.playedIndicator = m.top.findNode("playedIndicator")
m.showProgressBarAnimation = m.top.findNode("showProgressBar")
m.showProgressBarField = m.top.findNode("showProgressBarField")
@ -37,6 +38,12 @@ sub itemContentChanged()
m.itemIcon.uri = itemData.iconUrl
end if
if itemData.watched
m.playedIndicator.visible = true
m.unplayedCount.visible = false
else
m.playedIndicator.visible = false
if LCase(itemData.type) = "series"
if get_user_setting("ui.tvshows.disableUnwatchedEpisodeCount", "false") = "false"
if isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
@ -47,6 +54,7 @@ sub itemContentChanged()
end if
end if
end if
end if
' Format the Data based on the type of Home Data
if itemData.type = "CollectionFolder" or itemData.type = "UserView" or itemData.type = "Channel"

View File

@ -7,6 +7,7 @@
<Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" translation="[375, 0]">
<Label id="unplayedEpisodeCount" width="90" height="60" font="font:SmallestBoldSystemFont" horizAlign="center" vertAlign="center" />
</Rectangle>
<PlayedCheckmark id="playedIndicator" color="#00a4dcFF" width="60" height="46" visible="false" translation="[405, 0]" />
</Poster>
<Rectangle id="progressBackground" visible="false" color="0x00000098" width="464" height="8" translation="[8,260]">
<Rectangle id="progress" color="#00a4dcFF" width="0" height="8" />