hide overhang logo and user when viewing media

This commit is contained in:
Charles Ewert 2023-11-18 14:37:39 -05:00
parent 66b08400b7
commit b2b67ae923
7 changed files with 138 additions and 8 deletions

View File

@ -2,6 +2,10 @@ import "pkg:/source/utils/config.bs"
sub init()
m.top.id = "overhang"
m.top.translation = [54, 0]
m.leftGroup = m.top.findNode("overlayLeftGroup")
m.rightGroup = m.top.findNode("overlayRightGroup")
' hide seperators till they're needed
m.leftSeperator = m.top.findNode("overlayLeftSeperator")
m.leftSeperator.visible = "false"
@ -38,7 +42,7 @@ end sub
sub onVisibleChange()
if m.top.disableMoveAnimation
m.top.translation = [0, 0]
m.top.translation = [54, 0]
return
end if
if m.top.isVisible
@ -84,7 +88,9 @@ end sub
sub updateUser()
setRightSeperatorVisibility()
user = m.top.findNode("overlayCurrentUser")
user.text = m.top.currentUser
if isValid(user)
user.text = m.top.currentUser
end if
end sub
sub updateTime()
@ -145,3 +151,67 @@ sub updateOptions()
m.optionStar.visible = false
end if
end sub
' Ensure the Jellyfin logo is shown on the overhang.
sub showLogo()
scene = m.top.getScene()
logo = scene.findNode("overlayLogo")
leftSeperator = scene.findNode("overlayLeftSeperator")
if not isValid(leftSeperator)
seperator = createSeperator("overlayLeftSeperator")
m.leftGroup.insertChild(seperator, 0)
end if
if not isValid(logo)
posterLogo = createLogoPoster()
m.leftGroup.insertChild(posterLogo, 0)
end if
end sub
' Remove the Jellyfin logo from the overhang.
sub hideLogo()
scene = m.top.getScene()
logo = scene.findNode("overlayLogo")
leftSeperator = scene.findNode("overlayLeftSeperator")
if isValid(logo)
m.leftGroup.removeChild(logo)
end if
if isValid(leftSeperator)
m.leftGroup.removeChild(leftSeperator)
end if
end sub
' Ensure the current user is shown on the overhang.
sub showUser()
print "HELLO from showUser()"
scene = m.top.getScene()
currentUser = scene.findNode("overlayCurrentUser")
rightSeperator = scene.findNode("overlayRightSeperator")
if not isValid(rightSeperator)
seperator = createSeperator("overlayRightSeperator")
m.rightGroup.insertChild(seperator, 0)
end if
if not isValid(currentUser)
myUser = createOverhangUser()
myUser.text = m.top.currentUser
m.rightGroup.insertChild(myUser, 0)
end if
end sub
' Remove the Jellyfin logo from the overhang.
sub hideUser()
scene = m.top.getScene()
currentUser = scene.findNode("overlayCurrentUser")
rightSeperator = scene.findNode("overlayRightSeperator")
if isValid(currentUser)
m.rightGroup.removeChild(currentUser)
end if
if isValid(rightSeperator)
m.rightGroup.removeChild(rightSeperator)
end if
end sub

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="JFOverhang" extends="Group">
<children>
<Poster id="overlayLogo" uri="pkg:/images/logo.png" translation="[70, 53]" width="270" height="72" />
<LayoutGroup id="overlayLeftGroup" layoutDirection="horiz" translation="[375, 53]" itemSpacings="30">
<LayoutGroup id="overlayLeftGroup" layoutDirection="horiz" translation="[54, 54]" itemSpacings="30">
<Poster id="overlayLogo" uri="pkg:/images/logo.png" width="210" height="66" />
<Rectangle id="overlayLeftSeperator" color="#666666" width="2" height="64" />
<ScrollingLabel id="overlayTitle" font="font:LargeSystemFont" vertAlign="center" height="64" maxWidth="1100" repeatCount="0" />
</LayoutGroup>
<LayoutGroup id="overlayRightGroup" layoutDirection="horiz" itemSpacings="30" translation="[1820, 53]" horizAlignment="right">
<LayoutGroup id="overlayRightGroup" layoutDirection="horiz" itemSpacings="30" translation="[1766, 53]" horizAlignment="right">
<Label id="overlayCurrentUser" font="font:MediumSystemFont" width="300" horizAlign="right" vertAlign="center" height="64" />
<Rectangle id="overlayRightSeperator" color="#666666" width="2" height="64" visible="false" />
<LayoutGroup id="overlayTimeGroup" layoutDirection="horiz" horizAlignment="right" itemSpacings="0">
@ -17,7 +17,7 @@
</LayoutGroup>
</LayoutGroup>
<LayoutGroup layoutDirection="horiz" horizAlignment="right" translation="[1820, 125]" vertAlignment="custom">
<LayoutGroup layoutDirection="horiz" horizAlignment="right" translation="[1766, 125]" vertAlignment="custom">
<Label id="overlayOptionsStar" font="font:LargeSystemFont" text="*" />
<Label id="overlayOptionsText" font="font:SmallSystemFont" text="Options" translation="[0,6]" />
</LayoutGroup>
@ -38,6 +38,10 @@
<field id="showOptions" value="true" type="boolean" onChange="updateOptions" />
<field id="isVisible" value="true" type="boolean" onChange="onVisibleChange" />
<field id="disableMoveAnimation" value="false" type="boolean" />
<function name="showLogo" />
<function name="hideLogo" />
<function name="showUser" />
<function name="hideUser" />
<function name="resetTime" />
</interface>
</component>

View File

@ -30,9 +30,16 @@ sub loadLibraries()
m.fadeInFocusBitmap.control = "start"
end sub
' JFScreen hook that gets ran as needed.
' Used to update the focus, the state of the data, and tells the server about the device profile
' JFScreen hook.
' Used to show logo, update the focus, the state of the data, and tells the server about the device profile.
sub OnScreenShown()
scene = m.top.getScene()
overhang = scene.findNode("overhang")
' show the jellyfin logo
overhang.callFunc("showLogo")
overhang.callFunc("showUser")
if isValid(m.top.lastFocus)
m.top.lastFocus.setFocus(true)
else
@ -53,6 +60,17 @@ sub OnScreenShown()
end if
end sub
' JFScreen hook.
' Remove the Jellyfin logo and left seperator from the overhang
sub OnScreenHidden()
scene = m.top.getScene()
overhang = scene.findNode("overhang")
if isValid(overhang)
overhang.callFunc("hideLogo")
overhang.callFunc("hideUser")
end if
end sub
' Triggered by m.postTask after completing a post.
' Empty the task data when finished.
sub postFinished()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -507,3 +507,41 @@ function shuffleArray(array as object) as object
end for
return array
end function
' Create and return a Jellyfin logo poster node
function createLogoPoster()
logoPoster = createObject("roSGNode", "Poster")
logoPoster.id = "overlayLogo"
logoPoster.uri = "pkg:/images/logo.png"
logoPoster.translation = "[70, 53]"
logoPoster.width = "270"
logoPoster.height = "72"
return logoPoster
end function
' Create and return a rectangle node used as a seperator in the overhang
function createSeperator(id as string)
if not isValidAndNotEmpty(id) then return invalid
seperator = createObject("roSGNode", "Rectangle")
seperator.id = id
seperator.color = "#666666"
seperator.width = "2"
seperator.height = "64"
return seperator
end function
'
function createOverhangUser()
userLabel = createObject("roSGNode", "Label")
userLabel.id = "overlayCurrentUser"
userLabel.font = "font:MediumSystemFont"
userLabel.horizAlign = "right"
userLabel.vertAlign = "center"
userLabel.width = "300"
userLabel.height = "64"
return userLabel
end function