Hide overhang when not on 1st section

This commit is contained in:
1hitsong 2022-09-19 19:34:36 -04:00
parent e2976b8ed2
commit dbcc1ea45e
3 changed files with 49 additions and 24 deletions

View File

@ -18,6 +18,9 @@ sub init()
m.overlayRightGroup = m.top.findNode("overlayRightGroup") m.overlayRightGroup = m.top.findNode("overlayRightGroup")
m.overlayTimeGroup = m.top.findNode("overlayTimeGroup") m.overlayTimeGroup = m.top.findNode("overlayTimeGroup")
m.slideDownAnimation = m.top.findNode("slideDown")
m.slideUpAnimation = m.top.findNode("slideUp")
if not m.hideClock if not m.hideClock
' get system preference clock format (12/24hr) ' get system preference clock format (12/24hr)
di = CreateObject("roDeviceInfo") di = CreateObject("roDeviceInfo")
@ -40,6 +43,19 @@ sub init()
setClockVisibility() setClockVisibility()
end sub end sub
sub onVisibleChange()
if m.top.disableMoveAnimation
m.top.translation = [0, 0]
return
end if
if m.top.isVisible
m.slideDownAnimation.control = "start"
return
end if
m.slideUpAnimation.control = "start"
end sub
sub updateTitle() sub updateTitle()
leftSeperator = m.top.findNode("overlayLeftSeperator") leftSeperator = m.top.findNode("overlayLeftSeperator")
if m.top.title <> "" if m.top.title <> ""

View File

@ -1,26 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<component name="JFOverhang" extends="Group"> <component name="JFOverhang" extends="Group">
<children> <children>
<Poster id="overlayLogo" <Poster id="overlayLogo" uri="pkg:/images/logo.png" translation="[70, 53]" width="270" height="72" />
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="[375, 53]" itemSpacings="30">
<Rectangle <Rectangle id="overlayLeftSeperator" color="#666666" width="2" height="64"/>
id="overlayLeftSeperator"
color="#666666"
width="2"
height="64"/>
<ScrollingLabel id="overlayTitle" font="font:LargeSystemFont" vertAlign="center" height="64" maxWidth="1100" repeatCount="0" /> <ScrollingLabel id="overlayTitle" font="font:LargeSystemFont" vertAlign="center" height="64" maxWidth="1100" repeatCount="0" />
</LayoutGroup> </LayoutGroup>
<LayoutGroup id="overlayRightGroup" layoutDirection="horiz" itemSpacings="30" translation="[1820, 53]" horizAlignment="right"> <LayoutGroup id="overlayRightGroup" layoutDirection="horiz" itemSpacings="30" translation="[1820, 53]" horizAlignment="right">
<Label id="overlayCurrentUser" font="font:MediumSystemFont" width="300" horizAlign="right" vertAlign="center" height="64" /> <Label id="overlayCurrentUser" font="font:MediumSystemFont" width="300" horizAlign="right" vertAlign="center" height="64" />
<Rectangle <Rectangle id="overlayRightSeperator" color="#666666" width="2" height="64" visible="false"/>
id="overlayRightSeperator"
color="#666666"
width="2"
height="64"
visible="false"/>
<LayoutGroup id="overlayTimeGroup" layoutDirection="horiz" horizAlignment="right" itemSpacings="0"> <LayoutGroup id="overlayTimeGroup" layoutDirection="horiz" horizAlignment="right" itemSpacings="0">
<Label id="overlayHours" font="font:MediumSystemFont" vertAlign="center" height="64" /> <Label id="overlayHours" font="font:MediumSystemFont" vertAlign="center" height="64" />
<Label font="font:MediumSystemFont" text=":" vertAlign="center" height="64" /> <Label font="font:MediumSystemFont" text=":" vertAlign="center" height="64" />
@ -33,16 +21,23 @@
<Label id="overlayOptionsStar" font="font:LargeSystemFont" text="*" /> <Label id="overlayOptionsStar" font="font:LargeSystemFont" text="*" />
<Label id="overlayOptionsText" font="font:SmallSystemFont" text="Options" translation="[0,6]" /> <Label id="overlayOptionsText" font="font:SmallSystemFont" text="Options" translation="[0,6]" />
</LayoutGroup> </LayoutGroup>
<Timer <Timer id="currentTimeTimer" repeat="true" duration="60" />
id="currentTimeTimer"
repeat="true" <Animation id="slideUp" duration=".5" repeat="false">
duration="60" /> <Vector2DFieldInterpolator key="[0.0, .5]" keyValue="[[0, 0], [0, -200]]" fieldToInterp="overhang.translation" />
</Animation>
<Animation id="slideDown" delay=".2" duration=".5" repeat="false">
<Vector2DFieldInterpolator key="[0.0, .5]" keyValue="[[0, -200], [0, 0]]" fieldToInterp="overhang.translation" />
</Animation>
</children> </children>
<interface> <interface>
<field id="id" type="string" /> <field id="id" type="string" />
<field id="currentUser" type="string" onChange="updateUser" /> <field id="currentUser" type="string" onChange="updateUser" />
<field id="title" type="string" onChange="updateTitle" /> <field id="title" type="string" onChange="updateTitle" />
<field id="showOptions" value="true" type="boolean" onChange="updateOptions" /> <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="resetTime" /> <function name="resetTime" />
</interface> </interface>
<script type="text/brightscript" uri="JFOverhang.brs" /> <script type="text/brightscript" uri="JFOverhang.brs" />

View File

@ -19,6 +19,8 @@ sub init()
m.sectionNavigation.observeField("selected", "onSectionNavigationSelected") m.sectionNavigation.observeField("selected", "onSectionNavigationSelected")
m.sectionScroller = m.top.findNode("sectionScroller") m.sectionScroller = m.top.findNode("sectionScroller")
m.sectionScroller.observeField("displayedIndex", "onSectionScrollerChange")
m.overhang = m.top.getScene().findNode("overhang")
' Load background image ' Load background image
m.LoadBackdropImageTask = CreateObject("roSGNode", "LoadItemsTask") m.LoadBackdropImageTask = CreateObject("roSGNode", "LoadItemsTask")
@ -31,6 +33,18 @@ sub init()
createDialogPallete() createDialogPallete()
end sub end sub
sub onSectionScrollerChange()
m.overhang.isVisible = (m.sectionScroller.displayedIndex = 0)
end sub
sub OnScreenHidden()
if not m.overhang.isVisible
m.overhang.disableMoveAnimation = true
m.overhang.isVisible = true
m.overhang.disableMoveAnimation = false
end if
end sub
sub onAlbumsEscape() sub onAlbumsEscape()
if m.albums.escape = "up" if m.albums.escape = "up"
m.sectionNavigation.selected = m.sectionScroller.displayedIndex - 1 m.sectionNavigation.selected = m.sectionScroller.displayedIndex - 1