Set filter text line colors

This commit is contained in:
Gabriel Tofvesson 2024-10-26 00:23:52 +02:00
parent b219cebb32
commit abbe22f949

View File

@ -406,8 +406,11 @@ local PAGES = {
local KEY_BACKSPACE = "backspace" local KEY_BACKSPACE = "backspace"
local ID_FILTER_DISPLAY = "display_filter" local ID_FILTER_DISPLAY = "display_filter"
local ID_FILTER_PADDING = "display_filter_pad"
local KEYBOARD_BG_COLOR = colors.gray local KEYBOARD_BG_COLOR = colors.gray
local KEYBOARD_KEY_COLOR = colors.gray local KEYBOARD_KEY_COLOR = colors.gray
local KEYBOARD_FILTER_BG_COLOR = colors.lightGray
local KEYBOARD_FILTER_TEXT_COLOR = colors.red
local keyboardLines = { local keyboardLines = {
lines = { lines = {
{ backspace = true, "1234567890" }, { backspace = true, "1234567890" },
@ -463,7 +466,12 @@ local PAGES = {
-- TODO: Pad elements properly -- TODO: Pad elements properly
table.insert(keyboardLines.elements, 1, Text:new{ id = ID_FILTER_DISPLAY }) local paddedFilterText = Padding:new{
id = ID_FILTER_PADDING,
bgColor = KEYBOARD_FILTER_BG_COLOR,
element = Text:new{ id = ID_FILTER_DISPLAY, bgColor = KEYBOARD_FILTER_BG_COLOR, fgColor = KEYBOARD_FILTER_TEXT_COLOR }
}
table.insert(keyboardLines.elements, 1, paddedFilterText)
local keyboardList = Padding:new{ bgColor = KEYBOARD_BG_COLOR, left = KEYBOARD_HPAD, right = KEYBOARD_HPAD, element = List:new{ local keyboardList = Padding:new{ bgColor = KEYBOARD_BG_COLOR, left = KEYBOARD_HPAD, right = KEYBOARD_HPAD, element = List:new{
bgColor = KEYBOARD_BG_COLOR, bgColor = KEYBOARD_BG_COLOR,
@ -543,7 +551,11 @@ local PAGES = {
local filterDisplayedText = fitText(pageState.filter, keyboardList:getWidth() - 2) local filterDisplayedText = fitText(pageState.filter, keyboardList:getWidth() - 2)
local filterText = keyboardList:findById(ID_FILTER_DISPLAY) local filterText = keyboardList:findById(ID_FILTER_DISPLAY)
filterText:setText(filterDisplayedText) filterText:setText(filterDisplayedText)
filterText:setX(1)
local filterPadding = keyboardLines:findById(ID_FILTER_PADDING)
filterPadding:setPadding{
right = keyboardLines:getWidth() - filterText:getWidth()
}
keyboardList:setVisible(pageState.displayKeyboard) keyboardList:setVisible(pageState.displayKeyboard)