2023-05-03 21:21:04 +00:00
|
|
|
import "pkg:/source/utils/config.brs"
|
|
|
|
|
2019-10-12 20:21:34 +00:00
|
|
|
sub init()
|
2021-07-09 20:08:32 +00:00
|
|
|
m.top.id = "overhang"
|
|
|
|
' hide seperators till they're needed
|
2023-03-22 12:41:26 +00:00
|
|
|
m.leftSeperator = m.top.findNode("overlayLeftSeperator")
|
|
|
|
m.leftSeperator.visible = "false"
|
2022-07-16 02:28:59 +00:00
|
|
|
m.rightSeperator = m.top.findNode("overlayRightSeperator")
|
2021-07-09 20:08:32 +00:00
|
|
|
' set font sizes
|
2023-03-22 12:41:26 +00:00
|
|
|
m.optionText = m.top.findNode("overlayOptionsText")
|
|
|
|
m.optionText.font.size = 20
|
|
|
|
m.optionStar = m.top.findNode("overlayOptionsStar")
|
|
|
|
m.optionStar.font.size = 58
|
|
|
|
' save node references
|
|
|
|
m.title = m.top.findNode("overlayTitle")
|
2022-07-16 02:28:59 +00:00
|
|
|
m.overlayRightGroup = m.top.findNode("overlayRightGroup")
|
|
|
|
m.overlayTimeGroup = m.top.findNode("overlayTimeGroup")
|
2022-09-19 23:34:36 +00:00
|
|
|
m.slideDownAnimation = m.top.findNode("slideDown")
|
|
|
|
m.slideUpAnimation = m.top.findNode("slideUp")
|
2023-03-22 12:41:26 +00:00
|
|
|
' show clock based on user setting
|
|
|
|
m.hideClock = get_user_setting("ui.design.hideclock") = "true"
|
2022-07-16 02:28:59 +00:00
|
|
|
if not m.hideClock
|
2023-03-22 12:41:26 +00:00
|
|
|
' save node references
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayHours = m.top.findNode("overlayHours")
|
|
|
|
m.overlayMinutes = m.top.findNode("overlayMinutes")
|
|
|
|
m.overlayMeridian = m.top.findNode("overlayMeridian")
|
2023-03-22 12:41:26 +00:00
|
|
|
m.overlayMeridian.font.size = 20
|
2022-07-16 02:28:59 +00:00
|
|
|
m.currentTimeTimer = m.top.findNode("currentTimeTimer")
|
2023-04-01 13:13:49 +00:00
|
|
|
' display current time
|
|
|
|
updateTime()
|
|
|
|
' start timer to update clock every minute
|
2022-07-16 02:28:59 +00:00
|
|
|
m.currentTimeTimer.control = "start"
|
|
|
|
m.currentTimeTimer.ObserveField("fire", "updateTime")
|
|
|
|
end if
|
|
|
|
|
|
|
|
setClockVisibility()
|
2019-10-12 20:21:34 +00:00
|
|
|
end sub
|
2020-02-26 22:55:47 +00:00
|
|
|
|
2022-09-19 23:34:36 +00:00
|
|
|
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
|
|
|
|
|
2021-06-26 10:18:09 +00:00
|
|
|
sub updateTitle()
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.top.title <> ""
|
2023-03-22 12:41:26 +00:00
|
|
|
m.leftSeperator.visible = "true"
|
2021-07-09 20:08:32 +00:00
|
|
|
else
|
2023-03-22 12:41:26 +00:00
|
|
|
m.leftSeperator.visible = "false"
|
2021-07-09 20:08:32 +00:00
|
|
|
end if
|
2023-03-22 12:41:26 +00:00
|
|
|
m.title.text = m.top.title
|
2022-07-16 02:28:59 +00:00
|
|
|
|
|
|
|
if not m.hideClock
|
|
|
|
resetTime()
|
|
|
|
end if
|
2021-06-26 10:18:09 +00:00
|
|
|
end sub
|
2020-02-26 22:55:47 +00:00
|
|
|
|
2022-07-16 02:28:59 +00:00
|
|
|
sub setClockVisibility()
|
|
|
|
if m.hideClock
|
|
|
|
m.overlayRightGroup.removeChild(m.overlayTimeGroup)
|
|
|
|
end if
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub setRightSeperatorVisibility()
|
|
|
|
if m.hideClock
|
|
|
|
m.top.removeChild(m.rightSeperator)
|
|
|
|
return
|
|
|
|
end if
|
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.top.currentUser <> ""
|
2022-07-16 02:28:59 +00:00
|
|
|
m.rightSeperator.visible = "true"
|
2021-07-09 20:08:32 +00:00
|
|
|
else
|
2022-07-16 02:28:59 +00:00
|
|
|
m.rightSeperator.visible = "false"
|
2021-07-09 20:08:32 +00:00
|
|
|
end if
|
2022-07-16 02:28:59 +00:00
|
|
|
end sub
|
|
|
|
|
|
|
|
sub updateUser()
|
|
|
|
setRightSeperatorVisibility()
|
2021-07-09 20:08:32 +00:00
|
|
|
user = m.top.findNode("overlayCurrentUser")
|
|
|
|
user.text = m.top.currentUser
|
2021-06-26 10:18:09 +00:00
|
|
|
end sub
|
2020-02-26 22:55:47 +00:00
|
|
|
|
2021-06-26 10:18:09 +00:00
|
|
|
sub updateTime()
|
2023-03-22 12:41:26 +00:00
|
|
|
currentTime = CreateObject("roDateTime")
|
|
|
|
currentTime.ToLocalTime()
|
|
|
|
m.currentTimeTimer.duration = 60 - currentTime.GetSeconds()
|
|
|
|
m.currentHours = currentTime.GetHours()
|
|
|
|
m.currentMinutes = currentTime.GetMinutes()
|
2021-07-09 20:08:32 +00:00
|
|
|
updateTimeDisplay()
|
2021-06-26 10:18:09 +00:00
|
|
|
end sub
|
2020-02-26 22:55:47 +00:00
|
|
|
|
2021-06-26 10:18:09 +00:00
|
|
|
sub resetTime()
|
2023-03-15 00:33:56 +00:00
|
|
|
if m.hideClock then return
|
2021-07-09 20:08:32 +00:00
|
|
|
m.currentTimeTimer.control = "stop"
|
|
|
|
m.currentTimeTimer.control = "start"
|
2022-10-29 11:27:01 +00:00
|
|
|
updateTime()
|
2021-06-26 10:18:09 +00:00
|
|
|
end sub
|
2020-02-26 22:55:47 +00:00
|
|
|
|
2021-06-26 10:18:09 +00:00
|
|
|
sub updateTimeDisplay()
|
2023-03-27 16:50:44 +00:00
|
|
|
if m.global.device.clockFormat = "24h"
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayMeridian.text = ""
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.currentHours < 10
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayHours.text = "0" + StrI(m.currentHours).trim()
|
2021-07-09 20:08:32 +00:00
|
|
|
else
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayHours.text = m.currentHours
|
2021-07-09 20:08:32 +00:00
|
|
|
end if
|
2020-02-26 22:55:47 +00:00
|
|
|
else
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.currentHours < 12
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayMeridian.text = "AM"
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.currentHours = 0
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayHours.text = "12"
|
2021-07-09 20:08:32 +00:00
|
|
|
else
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayHours.text = m.currentHours
|
2021-07-09 20:08:32 +00:00
|
|
|
end if
|
|
|
|
else
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayMeridian.text = "PM"
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.currentHours = 12
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayHours.text = "12"
|
2021-07-09 20:08:32 +00:00
|
|
|
else
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayHours.text = m.currentHours - 12
|
2021-07-09 20:08:32 +00:00
|
|
|
end if
|
|
|
|
end if
|
2020-02-26 22:55:47 +00:00
|
|
|
end if
|
2021-07-09 20:08:32 +00:00
|
|
|
|
|
|
|
if m.currentMinutes < 10
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayMinutes.text = "0" + StrI(m.currentMinutes).trim()
|
2020-02-26 22:55:47 +00:00
|
|
|
else
|
2022-10-29 11:27:01 +00:00
|
|
|
m.overlayMinutes.text = m.currentMinutes
|
2020-02-26 22:55:47 +00:00
|
|
|
end if
|
2021-06-26 10:18:09 +00:00
|
|
|
end sub
|
2020-02-26 22:55:47 +00:00
|
|
|
|
2021-06-26 10:18:09 +00:00
|
|
|
sub updateOptions()
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.top.showOptions = true
|
2023-03-22 12:41:26 +00:00
|
|
|
m.optionText.visible = true
|
|
|
|
m.optionStar.visible = true
|
2021-07-09 20:08:32 +00:00
|
|
|
else
|
2023-03-22 12:41:26 +00:00
|
|
|
m.optionText.visible = false
|
|
|
|
m.optionStar.visible = false
|
2021-07-09 20:08:32 +00:00
|
|
|
end if
|
2022-05-30 12:57:40 +00:00
|
|
|
end sub
|