From 0f18add52376c1e403c5cfe771918f7efe93fb58 Mon Sep 17 00:00:00 2001 From: debmint Date: Sun, 13 Mar 2022 08:46:03 +0000 Subject: [PATCH] Movie extras (#520) --- components/ButtonGroupHoriz.brs | 4 +- components/ButtonGroupHoriz.xml | 2 +- components/ItemGrid/ItemGrid.brs | 2 +- components/OverviewDialog.xml | 35 + components/PersonDetails.brs | 164 + components/PersonDetails.xml | 45 + components/data/ExtrasData.xml | 26 + components/data/PersonData.brs | 32 + components/data/PersonData.xml | 12 + components/extras/ExtrasItem.xml | 37 + components/extras/ExtrasRowList.brs | 187 + components/extras/ExtrasRowList.xml | 12 + components/extras/ExtrasSlider.xml | 28 + components/home/LoadItemsTask.brs | 66 + components/home/LoadItemsTask.xml | 3 +- components/movies/MovieDetails.brs | 31 +- components/movies/MovieDetails.xml | 10 +- components/tvshows/TVShowDetails.brs | 26 + components/tvshows/TVShowDetails.xml | 1 + locale/en_US/translations.ts | 40 + package-lock.json | 6761 ++++++++++++++++++++++++-- package.json | 6 +- source/Main.brs | 8 + source/ShowScenes.brs | 33 + source/api/Items.brs | 5 + 25 files changed, 7040 insertions(+), 536 deletions(-) create mode 100644 components/OverviewDialog.xml create mode 100644 components/PersonDetails.brs create mode 100644 components/PersonDetails.xml create mode 100644 components/data/ExtrasData.xml create mode 100644 components/data/PersonData.brs create mode 100644 components/data/PersonData.xml create mode 100644 components/extras/ExtrasItem.xml create mode 100644 components/extras/ExtrasRowList.brs create mode 100644 components/extras/ExtrasRowList.xml create mode 100644 components/extras/ExtrasSlider.xml diff --git a/components/ButtonGroupHoriz.brs b/components/ButtonGroupHoriz.brs index 4c4a41b2..69bf0495 100644 --- a/components/ButtonGroupHoriz.brs +++ b/components/ButtonGroupHoriz.brs @@ -17,9 +17,9 @@ function onKeyEvent(key as string, press as boolean) as boolean m.top.focusButton = target return true else if key = "up" or key = "down" - m.top.escape = true + m.top.escape = key return true end if return false -end function \ No newline at end of file +end function diff --git a/components/ButtonGroupHoriz.xml b/components/ButtonGroupHoriz.xml index 1bf67e63..8646a3be 100644 --- a/components/ButtonGroupHoriz.xml +++ b/components/ButtonGroupHoriz.xml @@ -1,7 +1,7 @@ - + + + + + + + + \ No newline at end of file diff --git a/components/PersonDetails.brs b/components/PersonDetails.brs new file mode 100644 index 00000000..506102c8 --- /dev/null +++ b/components/PersonDetails.brs @@ -0,0 +1,164 @@ +sub init() + m.dscr = m.top.findNode("description") + m.vidsList = m.top.findNode("extrasGrid") + m.btnGrp = m.top.findNode("buttons") + m.btnGrp.observeField("escape", "onButtonGroupEscaped") + m.favBtn = m.top.findNode("favorite-button") + m.extrasGrp = m.top.findNode("extrasGrp") + m.top.findNode("VertSlider").keyValue = "[[30, 998], [30, 789], [30, 580], [30,371 ], [30, 162]]" + m.extrasGrp.opacity = 1.0 + m.extrasGrp.translation = "[30, 998]" + m.dscr.observeField("isTextEllipsized", "onEllipsisChanged") + createDialogPallete() + m.top.optionsAvailable = false +end sub + +sub loadPerson() + item = m.top.itemContent + itemData = item.json + m.top.Id = itemData.id + m.top.findNode("Name").Text = itemData.Name + if itemData.PremiereDate <> invalid and itemData.PremiereDate <> "" + birthDate = CreateObject("roDateTime") + birthDate.FromISO8601String(itemData.PremiereDate) + deathDate = CreateObject("roDatetime") + lifeString = tr("Born") + ": " + birthDate.AsDateString("short-month-no-weekday") + + if itemData.EndDate <> invalid and itemData.EndDate <> "" + deathDate.FromISO8601String(itemData.EndDate) + lifeString = lifeString + " * " + tr("Died") + ": " + deathDate.AsDateString("short-month-no-weekday") + + end if + ' Calculate age + age = deathDate.getYear() - birthDate.getYear() + if deathDate.getMonth() < birthDate.getMonth() + age-- + else if deathDate.getMonth() = birthDate.getMonth() + if deathDate.getDayOfMonth() < birthDate.getDayOfMonth() + age-- + end if + end if + lifeString = lifeString + " * " + tr("Age") + ": " + stri(age) + m.top.findNode("premierDate").Text = lifeString + end if + m.dscr.text = itemData.Overview + if item.posterURL <> invalid and item.posterURL <> "" + m.top.findnode("personImage").uri = item.posterURL + else + m.top.findnode("personImage").uri = "pkg:/images/baseline_person_white_48dp.png" + end if + m.vidsList.callFunc("loadPersonVideos", m.top.Id) + + setFavoriteColor() + m.favBtn.setFocus(true) +end sub + +sub onEllipsisChanged() + if m.dscr.isTextEllipsized + dscrShowFocus() + end if +end sub + +sub dscrShowFocus() + if m.dscr.isTextEllipsized + m.dscr.setFocus(true) + m.dscr.opacity = 1.0 + m.top.findNode("dscrBorder").color = "#d0d0d0ff" + end if +end sub + +sub onButtonGroupEscaped() + key = m.btnGrp.escape + if key = "down" + m.vidsList.setFocus(true) + m.top.findNode("VertSlider").reverse = false + m.top.findNode("pplAnime").control = "start" + else if key = "up" and m.dscr.isTextEllipsized + dscrShowFocus() + end if +end sub + +function onKeyEvent(key as string, press as boolean) as boolean + if not press then return false + + if key = "OK" + if m.dscr.hasFocus() and m.dscr.isTextEllipsized + createFullDscrDlg() + return true + end if + return false + end if + + if key = "back" + m.global.sceneManager.callfunc("popScene") + return true + end if + + if key = "down" + if m.dscr.hasFocus() + m.favBtn.setFocus(true) + m.dscr.opacity = 0.6 + m.top.findNode("dscrBorder").color = "#data202020ff" + return true + end if + else if key = "up" + if m.vidsList.isInFocusChain() and m.vidsList.itemFocused = 0 + m.top.findNode("VertSlider").reverse = true + m.top.findNode("pplAnime").control = "start" + m.favBtn.setFocus(true) + return true + end if + end if + return false +end function + +sub setFavoriteColor() + fave = m.top.itemContent.favorite + fave_button = m.top.findNode("favorite-button") + if fave <> invalid and fave + fave_button.textColor = "#00ff00ff" + fave_button.focusedTextColor = "#269926ff" + else + fave_button.textColor = "0xddddddff" + fave_button.focusedTextColor = "#262626ff" + end if +end sub + +sub createFullDscrDlg() + dlg = CreateObject("roSGNode", "OverviewDialog") + dlg.Title = tr("Press 'OK' to Close") + dlg.width = 1290 + dlg.palette = m.dlgPalette + dlg.overview = [m.dscr.text] + m.fullDscrDlg = dlg + m.top.getScene().dialog = dlg + border = createObject("roSGNode", "Poster") + border.uri = "pkg:/images/hd_focul_9.png" + border.blendColor = "#c9c9c9ff" + border.width = dlg.width + 6 + border.height = dlg.height + 6 + border.translation = [dlg.translation[0] - 3, dlg.translation[1] - 3] + border.visible = true +end sub + +sub createDialogPallete() + m.dlgPalette = createObject("roSGNode", "RSGPalette") + m.dlgPalette.colors = { + DialogBackgroundColor: "0x262828FF", + DialogItemColor: "0x00EF00FF", + DialogTextColor: "0xb0b0b0FF", + DialogFocusColor: "0xcececeFF", + DialogFocusItemColor: "0x202020FF", + DialogSecondaryTextColor: "0xf8f8f8ff", + DialogSecondaryItemColor: "0xcc7ecc4D", + DialogInputFieldColor: "0x80FF8080", + DialogKeyboardColor: "0x80FF804D", + DialogFootprintColor: "0x80FF804D" + } +end sub + +function shortDate(isoDate) as string + myDate = CreateObject("roDateTime") + myDate.FromISO8601String(isoDate) + return myDate.AsDateString("short-month-no-weekday") +end function diff --git a/components/PersonDetails.xml b/components/PersonDetails.xml new file mode 100644 index 00000000..8bbee922 --- /dev/null +++ b/components/PersonDetails.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + +