Update filter text color based on result

This commit is contained in:
Gabriel Tofvesson 2024-10-26 01:08:04 +02:00
parent 457d6d775c
commit 9dbc45e96e

View File

@ -419,7 +419,8 @@ local PAGES = {
local KEYBOARD_BG_COLOR = colors.gray
local KEYBOARD_KEY_COLOR = colors.gray
local KEYBOARD_FILTER_BG_COLOR = colors.lightGray
local KEYBOARD_FILTER_TEXT_COLOR = colors.red
local KEYBOARD_FILTER_TEXT_COLOR_SOME = colors.black
local KEYBOARD_FILTER_TEXT_COLOR_NONE = colors.red
local keyboardLines = {
lines = {
{ backspace = true, "1234567890" },
@ -479,15 +480,23 @@ local PAGES = {
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 }
element = Text:new{ id = ID_FILTER_DISPLAY, bgColor = KEYBOARD_FILTER_BG_COLOR }
}
table.insert(keyboardLines.elements, 1, paddedFilterText)
local keyboardList = Padding:new{ onClick = ignoreClick, bgColor = KEYBOARD_BG_COLOR, left = KEYBOARD_HPAD, right = KEYBOARD_HPAD, top = KEYBOARD_VPAD, bottom = KEYBOARD_VPAD, element = List:new{
local keyboardList = Padding:new{
onClick = ignoreClick,
bgColor = KEYBOARD_BG_COLOR,
left = KEYBOARD_HPAD,
right = KEYBOARD_HPAD,
top = KEYBOARD_VPAD,
bottom = KEYBOARD_VPAD,
element = List:new{
bgColor = KEYBOARD_BG_COLOR,
[Orientation:getId()] = Orientation.VERTICAL,
[Children:getId()] = keyboardLines.elements
}}
}
}
local screenContainer = Container:new{
[Children:getId()] = {
@ -563,6 +572,7 @@ local PAGES = {
local filterDisplayedText = fitText(pageState.filter, keyboardInnerWidth, true)
local filterText = keyboardList:findById(ID_FILTER_DISPLAY)
filterText:setText(filterDisplayedText)
filterText:setFgColor(#pageState.stacks == 0 and KEYBOARD_FILTER_TEXT_COLOR_NONE or KEYBOARD_FILTER_TEXT_COLOR_SOME)
local filterPadding = keyboardList:findById(ID_FILTER_PADDING)
filterPadding:setPadding{