Fix dialog palette

This commit is contained in:
Brahim Hadriche committed 2023-12-22 15:19:19 -05:00
1 parent 8f1d3778d8
commit 242298911c
6 files changed
+22 -4

No files matched your search

+14
View File
@@ -1,6 +1,7 @@
function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object) function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object)
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later ' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
dialog = CreateObject("roSGNode", "StandardMessageDialog") dialog = CreateObject("roSGNode", "StandardMessageDialog")
SetPalette(dialog)
dialog.message = message dialog.message = message
dialog.bulletText = bulletText dialog.bulletText = bulletText
dialog.bottomMessage = bottomMessage dialog.bottomMessage = bottomMessage
@@ -15,6 +16,19 @@ function ShowErrorDialog(message as object, bulletText as object, bottomMessage
m.top.getScene().dialog = dialog m.top.getScene().dialog = dialog
end function end function
function SetPalette(dialog as object)
palette = createObject("roSGNode", "RSGPalette")
palette.colors = {
DialogBackgroundColor: "#242424FF",
DialogFocusColor: "#CECECEFF",
DialogFocusItemColor: "#202020FF",
DialogSecondaryTextColor: "#F8F8F8FF",
DialogSecondaryItemColor: "0xFF1C30FF",
DialogTextColor: "#EEEEEEFF"
}
dialog.palette = palette
end function
function OnButtonSelected() function OnButtonSelected()
m.top.getScene().dialog.close = true m.top.getScene().dialog.close = true
end function end function
@@ -1,4 +1,4 @@
function SetPalette() function SetPalette(dialog as object)
palette = createObject("roSGNode", "RSGPalette") palette = createObject("roSGNode", "RSGPalette")
palette.colors = { palette.colors = {
DialogBackgroundColor: "#242424FF", DialogBackgroundColor: "#242424FF",
@@ -8,5 +8,5 @@ function SetPalette()
DialogSecondaryItemColor: "0xFF1C30FF", DialogSecondaryItemColor: "0xFF1C30FF",
DialogTextColor: "#EEEEEEFF" DialogTextColor: "#EEEEEEFF"
} }
m.top.palette = palette dialog.palette = palette
end function end function
@@ -5,7 +5,7 @@ import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
function Init() function Init()
SetPalette() SetPalette(m.top)
m.urlLabel = m.top.findNode("urlLabel") m.urlLabel = m.top.findNode("urlLabel")
m.qrCode = m.top.findNode("QrCodePoster") m.qrCode = m.top.findNode("QrCodePoster")
@@ -2,7 +2,7 @@ import "DialogPalette.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
function Init() function Init()
SetPalette() SetPalette(m.top)
m.top.observeField("buttonSelected", FuncName(CloseDialog)) m.top.observeField("buttonSelected", FuncName(CloseDialog))
end function end function
@@ -1,6 +1,7 @@
import "pkg:/components/Navigation/Navigation.bs" import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs" import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
import "pkg:/components/Dialog/DialogPalette.bs"
function Init() function Init()
m.textEditBox = m.top.findNode("textEditBox") m.textEditBox = m.top.findNode("textEditBox")
@@ -77,6 +78,7 @@ end function
function OnEditButtonSelected() function OnEditButtonSelected()
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog") keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
SetPalette(keyboardDialog)
keyboardDialog.title = "Edit Instance" keyboardDialog.title = "Edit Instance"
keyboardDialog.message = [`Enter the instance url (e.g. ${Invidious.DEFAULT_INSTANCE})`] keyboardDialog.message = [`Enter the instance url (e.g. ${Invidious.DEFAULT_INSTANCE})`]
keyboardDialog.text = m.top.text keyboardDialog.text = m.top.text
@@ -1,5 +1,6 @@
import "pkg:/source/utils/FocusManagement.bs" import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
import "pkg:/components/Dialog/DialogPalette.bs"
function Init() function Init()
m.top.focusable = true m.top.focusable = true
@@ -65,6 +66,7 @@ end function
function ShowEditKeyboard() function ShowEditKeyboard()
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog") keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
SetPalette(keyboardDialog)
keyboardDialog.title = m.top.displayText keyboardDialog.title = m.top.displayText
keyboardDialog.message = [m.top.description] keyboardDialog.message = [m.top.description]
keyboardDialog.text = m.top.value keyboardDialog.text = m.top.value