Replace API checkmarks for played items on home view
This commit is contained in:
parent
eab0d22369
commit
7d477cc976
4
components/PlayedCheckmark.brs
Normal file
4
components/PlayedCheckmark.brs
Normal file
|
@ -0,0 +1,4 @@
|
|||
sub init()
|
||||
m.checkmark = m.top.findNode("checkmark")
|
||||
m.checkmark.font.size = 35
|
||||
end sub
|
7
components/PlayedCheckmark.xml
Normal file
7
components/PlayedCheckmark.xml
Normal 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>
|
|
@ -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 })
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<component name="HomeData" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="id" type="string" />
|
||||
|
@ -13,9 +13,10 @@
|
|||
<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" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/Image.brs" />
|
||||
<script type="text/brightscript" uri="HomeData.brs" />
|
||||
</component>
|
||||
</component>
|
|
@ -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,12 +38,19 @@ sub itemContentChanged()
|
|||
m.itemIcon.uri = itemData.iconUrl
|
||||
end if
|
||||
|
||||
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)
|
||||
if itemData.json.UserData.UnplayedItemCount > 0
|
||||
m.unplayedCount.visible = true
|
||||
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
|
||||
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)
|
||||
if itemData.json.UserData.UnplayedItemCount > 0
|
||||
m.unplayedCount.visible = true
|
||||
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
|
|
@ -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" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user