|
16 | 16 | m.infoGroup = m.top.findNode("infoGroup") |
17 | 17 |
|
18 | 18 | m.itemDescription = m.top.findNode("itemDescription") |
19 | | - m.tagline = m.top.findNode("tagline") |
20 | 19 |
|
21 | 20 | m.buttonGrp = m.top.findNode("buttons") |
22 | 21 | m.buttonGrp.callFunc("focus") |
|
43 | 42 | m.directorGenreGroup = m.top.findNode("directorGenreGroup") |
44 | 43 | m.infoDividerCount = 0 |
45 | 44 | 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 |
46 | 57 | end sub |
47 | 58 |
|
48 | 59 | ' OnScreenShown: Callback function when view is presented on screen |
|
223 | 234 | m.directorGenreGroup.appendChild(node) |
224 | 235 | end sub |
225 | 236 |
|
| 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 | + |
226 | 283 | ' populateInfoGroup: Dynamically populate info and director/genre groups |
227 | 284 | sub populateInfoGroup() |
228 | 285 | ' Clear existing nodes |
229 | 286 | m.infoGroup.removeChildrenIndex(m.infoGroup.getChildCount(), 0) |
230 | 287 | m.directorGenreGroup.removeChildrenIndex(m.directorGenreGroup.getChildCount(), 0) |
231 | 288 | m.infoDividerCount = 0 |
232 | 289 | m.directorGenreDividerCount = 0 |
| 290 | + m.endsAtNode = invalid |
233 | 291 |
|
234 | 292 | itemData = m.top.itemContent.json |
235 | 293 | userSettings = m.global.user.settings |
|
276 | 334 | displayInfoNode(runtimeNode) |
277 | 335 | end if |
278 | 336 |
|
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) |
284 | 342 | end if |
285 | 343 |
|
286 | 344 | ' 7. Aired (Episodes only) |
|
330 | 388 | end if |
331 | 389 |
|
332 | 390 | if isValid(item) and isValid(item.json) |
333 | | - userSettings = m.global.user.settings |
334 | 391 | itemData = item.json |
335 | 392 | m.top.id = itemData.id |
336 | 393 |
|
|
347 | 404 | ' Populate info rows dynamically |
348 | 405 | populateInfoGroup() |
349 | 406 |
|
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() |
353 | 409 |
|
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) |
361 | 412 |
|
362 | 413 | updateFavoriteButton() |
363 | 414 | updateWatchedButton() |
|
523 | 574 | return formatTime(date) |
524 | 575 | end function |
525 | 576 |
|
| 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 | + |
526 | 584 | sub updateFavoriteButton() |
527 | 585 | fave = m.top.itemContent.favorite |
528 | 586 | favoriteButton = m.top.findNode("favoriteButton") |
|
0 commit comments