|
25 | 25 | m.buttonGrp.setFocus(true) |
26 | 26 | m.top.lastFocus = m.buttonGrp |
27 | 27 |
|
28 | | - ' Movie logo - positioned in bottom right |
| 28 | + ' Movie logo - positioned at fixed Y position |
29 | 29 | m.movieLogo = m.top.findNode("movieLogo") |
30 | 30 | m.movieLogo.observeField("loadStatus", "onLogoLoadStatusChanged") |
31 | 31 |
|
| 32 | + ' Date added label - positioned at bottom right |
| 33 | + m.dateCreatedLabel = m.top.findNode("dateCreatedLabel") |
| 34 | + |
32 | 35 | ' Gradient overlay - dynamically sized to span from itemDetails to extrasSlider |
33 | 36 | m.itemTextGradient = m.top.findNode("itemTextGradient") |
34 | 37 | m.itemDetails = m.top.findNode("itemDetails") |
|
410 | 413 | ' Set movie logo if available |
411 | 414 | setMovieLogo(itemData) |
412 | 415 |
|
| 416 | + ' Set date added label if available |
| 417 | + setDateAdded(itemData) |
| 418 | + |
413 | 419 | ' Set default video source if user hasn't selected one yet |
414 | 420 | if m.top.selectedVideoStreamId = "" and isValid(itemData.MediaSources) |
415 | 421 | m.top.selectedVideoStreamId = itemData.MediaSources[0].id |
|
631 | 637 | ' Check if logo image tag exists |
632 | 638 | if isValid(itemData.ImageTags) and isValidAndNotEmpty(itemData.ImageTags.Logo) |
633 | 639 | imgParams = { |
634 | | - maxHeight: 300, |
| 640 | + maxHeight: 212, |
635 | 641 | maxWidth: 500, |
636 | 642 | quality: 90, |
637 | 643 | tag: itemData.ImageTags.Logo |
|
640 | 646 | m.movieLogo.uri = logoUrl |
641 | 647 | else |
642 | 648 | ' No logo available, hide the poster |
| 649 | + m.movieLogo.visible = false |
643 | 650 | m.movieLogo.uri = "" |
| 651 | + |
| 652 | + end if |
| 653 | +end sub |
| 654 | + |
| 655 | +' setDateAdded: Set date added label text and position |
| 656 | +' Positions label at bottom right corner of screen with 96px padding |
| 657 | +' @param itemData - The item JSON data containing DateCreated |
| 658 | +' |
| 659 | +sub setDateAdded(itemData as object) |
| 660 | + if not isValid(m.dateCreatedLabel) then return |
| 661 | + |
| 662 | + if isValid(itemData.DateCreated) |
| 663 | + ' Set the date and time text |
| 664 | + dateAdded = CreateObject("roDateTime") |
| 665 | + dateAdded.FromISO8601String(itemData.DateCreated) |
| 666 | + dateAdded.toLocalTime() |
| 667 | + m.dateCreatedLabel.text = tr("Added") + " " + dateAdded.AsDateString("short-month-no-weekday") + " " + formatTime(dateAdded) |
| 668 | + |
| 669 | + ' Position at bottom right: screen is 1920x1080, with 96px padding |
| 670 | + ' Label has fixed width with horizAlign="right" for text alignment |
| 671 | + ' Translation is left edge, so: rightEdge - padding - width |
| 672 | + buttonRect = m.buttonGrp.boundingRect() |
| 673 | + buttonBottom = buttonRect.y + buttonRect.height |
| 674 | + |
| 675 | + m.dateCreatedLabel.translation = [1920 - 96 - 450, buttonBottom - 30] |
| 676 | + m.dateCreatedLabel.visible = true |
| 677 | + else |
| 678 | + ' Hide label if no date data available |
| 679 | + m.dateCreatedLabel.visible = false |
644 | 680 | end if |
645 | 681 | end sub |
646 | 682 |
|
647 | | -' onLogoLoadStatusChanged: Position the logo after it loads |
648 | | -' Positions logo 5% from right edge, bottom-aligned with button group |
| 683 | +' onLogoLoadStatusChanged: Position the logo with fixed Y coordinate and make it visible |
| 684 | +' Positions logo 5% from right edge at fixed Y=648 |
649 | 685 | ' |
650 | 686 | sub onLogoLoadStatusChanged() |
651 | 687 | if not isValid(m.movieLogo) then return |
|
661 | 697 | rightEdge = 1920 * 0.95 |
662 | 698 | logoX = rightEdge - logoWidth |
663 | 699 |
|
664 | | - ' Calculate Y position: bottom-aligned with button group |
665 | | - ' Button group is at Y=800, get its actual height using boundingRect |
666 | | - buttonRect = m.buttonGrp.boundingRect() |
667 | | - buttonBottom = 800 + buttonRect.height |
668 | | - logoY = buttonBottom - logoHeight |
| 700 | + ' Fixed Y position |
| 701 | + logoY = 648 |
669 | 702 |
|
| 703 | + ' Position logo before making it visible to prevent glitches |
670 | 704 | m.movieLogo.translation = [logoX, logoY] |
| 705 | + m.movieLogo.visible = true |
671 | 706 | end if |
672 | 707 | else if m.movieLogo.loadStatus = "failed" |
673 | 708 | ' Logo failed to load, ensure it's hidden |
674 | 709 | m.movieLogo.uri = "" |
| 710 | + m.movieLogo.visible = false |
675 | 711 | end if |
676 | 712 | end sub |
677 | 713 |
|
|
0 commit comments