use opacity for next episode check and hide button before it reaches 0
This commit is contained in:
parent
21b3fce266
commit
2fbf968901
|
@ -90,10 +90,13 @@ end sub
|
||||||
'
|
'
|
||||||
' Runs Next Episode button animation and sets focus to button
|
' Runs Next Episode button animation and sets focus to button
|
||||||
sub showNextEpisodeButton()
|
sub showNextEpisodeButton()
|
||||||
if m.global.session.user.configuration.EnableNextEpisodeAutoPlay and not m.nextEpisodeButton.visible
|
if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode"
|
||||||
|
if m.nextupbuttonseconds = 0 then return ' is the button disabled?
|
||||||
|
|
||||||
|
if m.nextEpisodeButton.opacity = 0 and m.global.session.user.configuration.EnableNextEpisodeAutoPlay
|
||||||
|
m.nextEpisodeButton.visible = true
|
||||||
m.showNextEpisodeButtonAnimation.control = "start"
|
m.showNextEpisodeButtonAnimation.control = "start"
|
||||||
m.nextEpisodeButton.setFocus(true)
|
m.nextEpisodeButton.setFocus(true)
|
||||||
m.nextEpisodeButton.visible = true
|
|
||||||
end if
|
end if
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
|
@ -117,13 +120,22 @@ end sub
|
||||||
|
|
||||||
' Checks if we need to display the Next Episode button
|
' Checks if we need to display the Next Episode button
|
||||||
sub checkTimeToDisplayNextEpisode()
|
sub checkTimeToDisplayNextEpisode()
|
||||||
if m.top.content.contenttype <> 4 then return
|
if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode"
|
||||||
if m.nextupbuttonseconds = 0 then return
|
if m.nextupbuttonseconds = 0 then return ' is the button disabled?
|
||||||
|
|
||||||
if int(m.top.position) >= (m.top.duration - m.nextupbuttonseconds)
|
if isValid(m.top.duration) and isValid(m.top.position)
|
||||||
showNextEpisodeButton()
|
nextEpisodeCountdown = Int(m.top.duration - m.top.position)
|
||||||
updateCount()
|
|
||||||
|
if nextEpisodeCountdown < 0 and m.nextEpisodeButton.opacity = 0.9
|
||||||
|
hideNextEpisodeButton()
|
||||||
return
|
return
|
||||||
|
else if nextEpisodeCountdown > 1 and int(m.top.position) >= (m.top.duration - m.nextupbuttonseconds - 1)
|
||||||
|
updateCount()
|
||||||
|
if m.nextEpisodeButton.opacity = 0
|
||||||
|
showNextEpisodeButton()
|
||||||
|
end if
|
||||||
|
return
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
|
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
|
||||||
|
@ -266,8 +278,8 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
'Hide Next Episode Button
|
'Hide Next Episode Button
|
||||||
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
|
if m.nextEpisodeButton.opacity > 0 or m.nextEpisodeButton.hasFocus()
|
||||||
m.nextEpisodeButton.visible = false
|
m.nextEpisodeButton.opacity = 0
|
||||||
m.nextEpisodeButton.setFocus(false)
|
m.nextEpisodeButton.setFocus(false)
|
||||||
m.top.setFocus(true)
|
m.top.setFocus(true)
|
||||||
end if
|
end if
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<Animation id="showNextEpisodeButton" duration="1.0" repeat="false" easeFunction="inQuad">
|
<Animation id="showNextEpisodeButton" duration="1.0" repeat="false" easeFunction="inQuad">
|
||||||
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[0.0, .9]" fieldToInterp="nextEpisode.opacity" />
|
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[0.0, .9]" fieldToInterp="nextEpisode.opacity" />
|
||||||
</Animation>
|
</Animation>
|
||||||
<Animation id="hideNextEpisodeButton" duration=".2" repeat="false" easeFunction="inQuad">
|
<Animation id="hideNextEpisodeButton" duration=".25" repeat="false" easeFunction="inQuad">
|
||||||
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[.9, 0]" fieldToInterp="nextEpisode.opacity" />
|
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[.9, 0]" fieldToInterp="nextEpisode.opacity" />
|
||||||
</Animation>
|
</Animation>
|
||||||
</children>
|
</children>
|
||||||
|
|
|
@ -41,6 +41,7 @@ sub init()
|
||||||
m.nextEpisodeButton = m.top.findNode("nextEpisode")
|
m.nextEpisodeButton = m.top.findNode("nextEpisode")
|
||||||
m.nextEpisodeButton.text = tr("Next Episode")
|
m.nextEpisodeButton.text = tr("Next Episode")
|
||||||
m.nextEpisodeButton.setFocus(false)
|
m.nextEpisodeButton.setFocus(false)
|
||||||
|
m.nextupbuttonseconds = m.global.session.user.settings["playback.nextupbuttonseconds"].ToInt()
|
||||||
|
|
||||||
m.showNextEpisodeButtonAnimation = m.top.findNode("showNextEpisodeButton")
|
m.showNextEpisodeButtonAnimation = m.top.findNode("showNextEpisodeButton")
|
||||||
m.hideNextEpisodeButtonAnimation = m.top.findNode("hideNextEpisodeButton")
|
m.hideNextEpisodeButtonAnimation = m.top.findNode("hideNextEpisodeButton")
|
||||||
|
@ -195,17 +196,24 @@ end sub
|
||||||
'
|
'
|
||||||
' Runs Next Episode button animation and sets focus to button
|
' Runs Next Episode button animation and sets focus to button
|
||||||
sub showNextEpisodeButton()
|
sub showNextEpisodeButton()
|
||||||
if m.global.session.user.configuration.EnableNextEpisodeAutoPlay and not m.nextEpisodeButton.visible
|
if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode"
|
||||||
|
if m.nextupbuttonseconds = 0 then return ' is the button disabled?
|
||||||
|
|
||||||
|
if m.nextEpisodeButton.opacity = 0 and m.global.session.user.configuration.EnableNextEpisodeAutoPlay
|
||||||
|
m.nextEpisodeButton.visible = true
|
||||||
m.showNextEpisodeButtonAnimation.control = "start"
|
m.showNextEpisodeButtonAnimation.control = "start"
|
||||||
m.nextEpisodeButton.setFocus(true)
|
m.nextEpisodeButton.setFocus(true)
|
||||||
m.nextEpisodeButton.visible = true
|
|
||||||
end if
|
end if
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
'
|
'
|
||||||
'Update count down text
|
'Update count down text
|
||||||
sub updateCount()
|
sub updateCount()
|
||||||
m.nextEpisodeButton.text = tr("Next Episode") + " " + Int(m.top.duration - m.top.position).toStr()
|
nextEpisodeCountdown = Int(m.top.duration - m.top.position)
|
||||||
|
if nextEpisodeCountdown < 0
|
||||||
|
nextEpisodeCountdown = 0
|
||||||
|
end if
|
||||||
|
m.nextEpisodeButton.text = tr("Next Episode") + " " + nextEpisodeCountdown.toStr()
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
'
|
'
|
||||||
|
@ -218,13 +226,22 @@ end sub
|
||||||
|
|
||||||
' Checks if we need to display the Next Episode button
|
' Checks if we need to display the Next Episode button
|
||||||
sub checkTimeToDisplayNextEpisode()
|
sub checkTimeToDisplayNextEpisode()
|
||||||
' only display the Next Episode button when the content is type "Episode"
|
if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode"
|
||||||
if m.top.content.contenttype <> 4 then return
|
if m.nextupbuttonseconds = 0 then return ' is the button disabled?
|
||||||
|
|
||||||
if int(m.top.position) >= (m.top.duration - 30)
|
if isValid(m.top.duration) and isValid(m.top.position)
|
||||||
showNextEpisodeButton()
|
nextEpisodeCountdown = Int(m.top.duration - m.top.position)
|
||||||
updateCount()
|
|
||||||
|
if nextEpisodeCountdown < 0 and m.nextEpisodeButton.opacity = 0.9
|
||||||
|
hideNextEpisodeButton()
|
||||||
return
|
return
|
||||||
|
else if nextEpisodeCountdown > 1 and int(m.top.position) >= (m.top.duration - m.nextupbuttonseconds - 1)
|
||||||
|
updateCount()
|
||||||
|
if m.nextEpisodeButton.opacity = 0
|
||||||
|
showNextEpisodeButton()
|
||||||
|
end if
|
||||||
|
return
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
|
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
|
||||||
|
@ -366,8 +383,8 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
'Hide Next Episode Button
|
'Hide Next Episode Button
|
||||||
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
|
if m.nextEpisodeButton.opacity > 0 or m.nextEpisodeButton.hasFocus()
|
||||||
m.nextEpisodeButton.visible = false
|
m.nextEpisodeButton.opacity = 0
|
||||||
m.nextEpisodeButton.setFocus(false)
|
m.nextEpisodeButton.setFocus(false)
|
||||||
m.top.setFocus(true)
|
m.top.setFocus(true)
|
||||||
end if
|
end if
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<Animation id="showNextEpisodeButton" duration="1.0" repeat="false" easeFunction="inQuad">
|
<Animation id="showNextEpisodeButton" duration="1.0" repeat="false" easeFunction="inQuad">
|
||||||
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[0.0, .9]" fieldToInterp="nextEpisode.opacity" />
|
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[0.0, .9]" fieldToInterp="nextEpisode.opacity" />
|
||||||
</Animation>
|
</Animation>
|
||||||
<Animation id="hideNextEpisodeButton" duration=".2" repeat="false" easeFunction="inQuad">
|
<Animation id="hideNextEpisodeButton" duration=".25" repeat="false" easeFunction="inQuad">
|
||||||
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[.9, 0]" fieldToInterp="nextEpisode.opacity" />
|
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[.9, 0]" fieldToInterp="nextEpisode.opacity" />
|
||||||
</Animation>
|
</Animation>
|
||||||
</children>
|
</children>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user