Update all lables to hide if no data

This commit is contained in:
candry7731 2022-12-06 21:07:15 -06:00
parent 3755ade7e3
commit de05d2f515
4 changed files with 47 additions and 7 deletions

View File

@ -55,14 +55,14 @@ sub itemContentChanged()
' Handle all "As Is" fields
m.top.overhangTitle = itemData.name
setFieldText("releaseYear", itemData.productionYear)
setFieldText("officialRating", itemData.officialRating)
setFieldText("overview", itemData.overview)
if itemData.communityRating <> invalid
setFieldText("communityRating", int(itemData.communityRating * 10) / 10)
m.top.findNode("star").visible = "true"
else
' hide the star icon
m.top.findNode("communityRatingGroup").visible = false
m.top.findNode("infoGroup").removeChild(m.top.findNode("communityRatingGroup"))
end if
if itemData.CriticRating <> invalid
@ -86,6 +86,8 @@ sub itemContentChanged()
if itemData.genres.count() > 0
setFieldText("genres", tr("Genres") + ": " + itemData.genres.join(", "))
else
m.top.findNode("details").removeChild(m.top.findNode("genres"))
end if
' show tags if there are no genres to display
@ -101,6 +103,8 @@ sub itemContentChanged()
end for
if directors.count() > 0
setFieldText("director", tr("Director") + ": " + directors.join(", "))
else
m.top.findNode("details").removeChild(m.top.findNode("director"))
end if
if get_user_setting("ui.details.hidetagline") = "false"
@ -111,6 +115,15 @@ sub itemContentChanged()
m.details.removeChild(m.tagline)
end if
'set aired date if type is Episode
if itemData.PremiereDate <> invalid and itemData.Type = "Episode"
airDate = CreateObject("roDateTime")
airDate.FromISO8601String(itemData.PremiereDate)
m.top.findNode("aired").text = tr("Aired") + ": " + airDate.AsDateString("short-month-no-weekday")
'remove movie release year label
m.top.findNode("infoGroup").removeChild(m.top.findNode("releaseYear"))
end if
setFavoriteColor()
setWatchedColor()
SetUpVideoOptions(itemData.mediaSources)

View File

@ -7,9 +7,9 @@
<LayoutGroup layoutDirection="horiz" itemSpacings="[100]" id="infoGroup">
<Label id="releaseYear" />
<Label id="runtime" />
<Label id="officialRating" />
<MultiStyleLabel id="officialRating" />
<LayoutGroup id="communityRatingGroup" layoutDirection="horiz" itemSpacings="[-5]">
<Poster id="star" uri="pkg:/images/sharp_star_white_18dp.png" height="32" width="32" blendColor="#cb272a" />
<Poster id="star" uri="pkg:/images/sharp_star_white_18dp.png" height="32" width="32" blendColor="#cb272a" visible="false"/>
<Label id="communityRating" />
</LayoutGroup>
<LayoutGroup layoutDirection="horiz" itemSpacings="[-5]" id="criticRatingGroup">
@ -17,6 +17,7 @@
<Label id="criticRatingLabel" />
</LayoutGroup>
<Label id="ends-at" />
<Label id="aired" />
</LayoutGroup>
<Label id="genres" />
<Label id="director" />

View File

@ -17,14 +17,31 @@ sub itemContentChanged()
' Handle all "As Is" fields
m.top.overhangTitle = itemData.name
setFieldText("releaseYear", itemData.productionYear)
setFieldText("officialRating", itemData.officialRating)
'Check production year, if invalid remove label
if itemData.productionYear <> invalid
setFieldText("releaseYear", itemData.productionYear)
else
m.top.findNode("main_group").removeChild(m.top.findNode("releaseYear"))
end if
'Check officialRating, if invalid remove label
if itemData.officialRating <> invalid
setFieldText("officialRating", itemData.officialRating)
else
m.top.findNode("main_group").removeChild(m.top.findNode("officialRating"))
end if
'Check communityRating, if invalid remove label
if itemData.communityRating <> invalid
m.top.findNode("star").visible = true
setFieldText("communityRating", int(itemData.communityRating * 10) / 10)
else
m.top.findNode("main_group").removeChild(m.top.findNode("communityRating"))
m.top.findNode("main_group").removeChild(m.top.findNode("star"))
m.top.findNode("star").visible = false
end if
setFieldText("overview", itemData.overview)
@ -32,11 +49,17 @@ sub itemContentChanged()
setFieldText("runtime", stri(getRuntime()) + " mins")
end if
'History feild is set via the function getHistory()
setFieldText("history", getHistory())
'Check genres, if invalid remove label
if itemData.genres.count() > 0
setFieldText("genres", itemData.genres.join(", "))
else
m.top.findNode("main_group").removeChild(m.top.findNode("genres"))
end if
'We don't display Directors in the show page. Might want to remove this.
for each person in itemData.people
if person.type = "Director"
exit for
@ -44,6 +67,8 @@ sub itemContentChanged()
end for
if itemData.taglines.count() > 0
setFieldText("tagline", itemData.taglines[0])
else
m.top.findNode("main_group").removeChild(m.top.findNode("tagline"))
end if
end sub
@ -105,6 +130,7 @@ function getHistory() as string
end if
if studio = invalid and airwords = invalid
m.top.findNode("main_group").removeChild(m.top.findNode("history"))
return ""
end if

View File

@ -9,7 +9,7 @@
<Label id="releaseYear" />
<Label id="officialRating" />
<LayoutGroup layoutDirection="horiz" itemSpacings="[3]">
<Poster id="star" uri="pkg:/images/sharp_star_white_18dp.png" height="32" width="32" blendColor="#cb272a" />
<Poster id="star" uri="pkg:/images/sharp_star_white_18dp.png" height="32" width="32" blendColor="#cb272a" visible="false" />
<Label id="communityRating" />
</LayoutGroup>
</LayoutGroup>