diff --git a/gfx/keyboard.lua b/gfx/keyboard.lua index a1a8f85..f9fb248 100644 --- a/gfx/keyboard.lua +++ b/gfx/keyboard.lua @@ -12,6 +12,9 @@ local DEFAULT_PADDING_H = 1 local DEFAULT_PADDING_V = 1 local HANDLER_IGNORE_CLICK = function() return true end +local ID_KEY_LIST = "$Keyboard$List" +local ID_PADDED_KEY = "$Keyboard$List$Padding" + local Keyboard = Padding:new{ bgColor = DEFAULT_COLOR_BG, keyColor = DEFAULT_COLOR_KEY, @@ -79,7 +82,7 @@ function Keyboard:setLayout(layout) return true end local keySlopFunc = this.keySlop and keyFunc or HANDLER_IGNORE_CLICK - + -- ((not backspace) and i == #keys and 0) or 1 table.insert(keysEntries, Padding:new{ onClick = keySlopFunc, bgColor = this.bgColor, right = 1, element = Text:new{ id = key, @@ -122,6 +125,7 @@ function Keyboard:setLayout(layout) }) end return List:new{ + id = ID_KEY_LIST, bgColor = this.colorBg, [Orientation:getId()] = Orientation.HORIZONTAL, [Children:getId()] = keysEntries @@ -135,7 +139,7 @@ function Keyboard:setLayout(layout) end self.element[Children:getId()] = keyboardLines - self.setDirty() + self:setDirty() end function Keyboard:setKeyColor(color) @@ -145,6 +149,19 @@ function Keyboard:setKeyColor(color) end end +function Keyboard:setDirty(fullInvalidate) + local keyList = self:findById(ID_KEY_LIST) + for _,key in pairs(keyList[Children:getId()]) do + if key:getId() == ID_PADDED_KEY then + key:setBgColor(self.bgColor) + key.element:setBgColor(self.keyColor) + else + key:setBgColor(self.keyColor) + end + end + Padding.setDirty(self, fullInvalidate) +end + local function layoutNumbers(layout) table.insert(layout, 1, { "1234567890" }) return layout diff --git a/gfx/textprogress.lua b/gfx/textprogress.lua index f0351fa..5023757 100644 --- a/gfx/textprogress.lua +++ b/gfx/textprogress.lua @@ -7,6 +7,7 @@ end function TextProgress:setProgress(progress) self.progress = progress + self:setDirty() end function TextProgress:draw()