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_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_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 = { local keyboardLines = {
lines = { lines = {
{ backspace = true, "1234567890" }, { backspace = true, "1234567890" },
@ -479,15 +480,23 @@ local PAGES = {
local paddedFilterText = Padding:new{ local paddedFilterText = Padding:new{
id = ID_FILTER_PADDING, id = ID_FILTER_PADDING,
bgColor = KEYBOARD_FILTER_BG_COLOR, 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) 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, bgColor = KEYBOARD_BG_COLOR,
[Orientation:getId()] = Orientation.VERTICAL, left = KEYBOARD_HPAD,
[Children:getId()] = keyboardLines.elements 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{ local screenContainer = Container:new{
[Children:getId()] = { [Children:getId()] = {
@ -563,6 +572,7 @@ local PAGES = {
local filterDisplayedText = fitText(pageState.filter, keyboardInnerWidth, true) local filterDisplayedText = fitText(pageState.filter, keyboardInnerWidth, true)
local filterText = keyboardList:findById(ID_FILTER_DISPLAY) local filterText = keyboardList:findById(ID_FILTER_DISPLAY)
filterText:setText(filterDisplayedText) 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) local filterPadding = keyboardList:findById(ID_FILTER_PADDING)
filterPadding:setPadding{ filterPadding:setPadding{