Skip to content

Commit 808542a

Browse files
committed
Update code docs
1 parent d75b205 commit 808542a

3 files changed

Lines changed: 77 additions & 19 deletions

File tree

docs/components_movies_MovieDetails.bs.html

Lines changed: 75 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
m.infoGroup = m.top.findNode("infoGroup")
1717

1818
m.itemDescription = m.top.findNode("itemDescription")
19-
m.tagline = m.top.findNode("tagline")
2019

2120
m.buttonGrp = m.top.findNode("buttons")
2221
m.buttonGrp.callFunc("focus")
@@ -43,6 +42,18 @@
4342
m.directorGenreGroup = m.top.findNode("directorGenreGroup")
4443
m.infoDividerCount = 0
4544
m.directorGenreDividerCount = 0
45+
46+
' Observe overhang clock for dynamic "Ends At" updates (only when clock is visible)
47+
m.endsAtNode = invalid
48+
if not m.global.user.settings.uiDesignHideClock
49+
overhang = m.top.getScene().findNode("overhang")
50+
if isValid(overhang)
51+
m.clock = overhang.findNode("clock")
52+
if isValid(m.clock)
53+
m.clock.observeField("minutes", "onClockMinuteChanged")
54+
end if
55+
end if
56+
end if
4657
end sub
4758

4859
' OnScreenShown: Callback function when view is presented on screen
@@ -223,13 +234,60 @@
223234
m.directorGenreGroup.appendChild(node)
224235
end sub
225236

237+
' createTaglineLabel: Create a tagline label node
238+
' @return Configured LabelSecondaryMedium node (bold)
239+
function createTaglineLabel() as object
240+
labelNode = CreateObject("roSGNode", "LabelSecondaryMedium")
241+
labelNode.id = "tagline"
242+
labelNode.bold = true
243+
return labelNode
244+
end function
245+
246+
' createOverviewLabel: Create an overview label node
247+
' @return Configured LabelSecondaryMedium node (wrapped, width-limited)
248+
function createOverviewLabel() as object
249+
labelNode = CreateObject("roSGNode", "LabelSecondaryMedium")
250+
labelNode.id = "overview"
251+
labelNode.wrap = true
252+
labelNode.width = 1100
253+
labelNode.maxLines = 2
254+
labelNode.lineSpacing = 3
255+
return labelNode
256+
end function
257+
258+
' populateDescriptionGroup: Dynamically populate tagline and overview labels
259+
sub populateDescriptionGroup()
260+
' Clear existing nodes
261+
m.itemDescription.removeChildrenIndex(m.itemDescription.getChildCount(), 0)
262+
263+
itemData = m.top.itemContent.json
264+
userSettings = m.global.user.settings
265+
266+
' 1. Tagline (if enabled in settings and data exists)
267+
if userSettings.uiDetailsHideTagline = false
268+
if isValid(itemData.taglines) and itemData.taglines.count() > 0 and isValidAndNotEmpty(itemData.taglines[0])
269+
taglineLabel = createTaglineLabel()
270+
taglineLabel.text = itemData.taglines[0]
271+
m.itemDescription.appendChild(taglineLabel)
272+
end if
273+
end if
274+
275+
' 2. Overview (if data exists)
276+
if isValid(itemData.overview) and isValidAndNotEmpty(itemData.overview)
277+
overviewLabel = createOverviewLabel()
278+
overviewLabel.text = itemData.overview
279+
m.itemDescription.appendChild(overviewLabel)
280+
end if
281+
end sub
282+
226283
' populateInfoGroup: Dynamically populate info and director/genre groups
227284
sub populateInfoGroup()
228285
' Clear existing nodes
229286
m.infoGroup.removeChildrenIndex(m.infoGroup.getChildCount(), 0)
230287
m.directorGenreGroup.removeChildrenIndex(m.directorGenreGroup.getChildCount(), 0)
231288
m.infoDividerCount = 0
232289
m.directorGenreDividerCount = 0
290+
m.endsAtNode = invalid
233291

234292
itemData = m.top.itemContent.json
235293
userSettings = m.global.user.settings
@@ -276,11 +334,11 @@
276334
displayInfoNode(runtimeNode)
277335
end if
278336

279-
' 6. Ends At
280-
if type(itemData.RunTimeTicks) = "LongInteger" and userSettings.uiDesignHideClock <> true
281-
endsAtNode = createInfoLabel("ends-at")
282-
endsAtNode.text = tr("Ends at %1").Replace("%1", getEndTime())
283-
displayInfoNode(endsAtNode)
337+
' 6. Ends At (only shown when clock is visible in overhang)
338+
if type(itemData.RunTimeTicks) = "LongInteger" and not userSettings.uiDesignHideClock
339+
m.endsAtNode = createInfoLabel("ends-at")
340+
m.endsAtNode.text = tr("Ends at %1").Replace("%1", getEndTime())
341+
displayInfoNode(m.endsAtNode)
284342
end if
285343

286344
' 7. Aired (Episodes only)
@@ -330,7 +388,6 @@
330388
end if
331389

332390
if isValid(item) and isValid(item.json)
333-
userSettings = m.global.user.settings
334391
itemData = item.json
335392
m.top.id = itemData.id
336393

@@ -347,17 +404,11 @@
347404
' Populate info rows dynamically
348405
populateInfoGroup()
349406

350-
' Handle all "As Is" fields
351-
setFieldText("videoTitle", itemData.name)
352-
setFieldText("overview", itemData.overview)
407+
' Populate description group (tagline and overview) dynamically
408+
populateDescriptionGroup()
353409

354-
if userSettings.uiDetailsHideTagline = false
355-
if itemData.taglines.count() > 0
356-
setFieldText("tagline", itemData.taglines[0])
357-
end if
358-
else
359-
m.itemDescription.removeChild(m.tagline)
360-
end if
410+
' Handle video title
411+
setFieldText("videoTitle", itemData.name)
361412

362413
updateFavoriteButton()
363414
updateWatchedButton()
@@ -523,6 +574,13 @@
523574
return formatTime(date)
524575
end function
525576

577+
' onClockMinuteChanged: Dynamically update "Ends At" time when overhang clock minute changes
578+
'
579+
sub onClockMinuteChanged()
580+
if not isValid(m.endsAtNode) then return
581+
m.endsAtNode.text = tr("Ends at %1").Replace("%1", getEndTime())
582+
end sub
583+
526584
sub updateFavoriteButton()
527585
fave = m.top.itemContent.favorite
528586
favoriteButton = m.top.findNode("favoriteButton")

docs/data/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/module-MovieDetails.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)