mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Option to disable keyboard flashing (#3050)
* Option to disable keyboard flashing
This commit is contained in:
@@ -38,6 +38,7 @@ common_settings.screen = {
|
||||
require("ui/elements/screen_eink_opt_menu_table"),
|
||||
require("ui/elements/screen_disable_double_tap_table"),
|
||||
require("ui/elements/refresh_menu_table"),
|
||||
require("ui/elements/flash_keyboard"),
|
||||
},
|
||||
}
|
||||
common_settings.save_document = {
|
||||
|
||||
12
frontend/ui/elements/flash_keyboard.lua
Normal file
12
frontend/ui/elements/flash_keyboard.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local _ = require("gettext")
|
||||
|
||||
return {
|
||||
text = _("Flash keyboard"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("flash_keyboard") ~= false
|
||||
end,
|
||||
callback = function()
|
||||
local disabled = G_reader_settings:readSetting("flash_keyboard") ~= false
|
||||
G_reader_settings:saveSetting("flash_keyboard", not disabled)
|
||||
end,
|
||||
}
|
||||
@@ -93,32 +93,45 @@ function VirtualKey:init()
|
||||
},
|
||||
}
|
||||
end
|
||||
self.flash_keyboard = G_reader_settings:readSetting("flash_keyboard") ~= false
|
||||
end
|
||||
|
||||
function VirtualKey:update_keyboard()
|
||||
UIManager:setDirty(self.keyboard, function()
|
||||
logger.dbg("update key region", self[1].dimen)
|
||||
return "ui", self[1].dimen
|
||||
return "fast", self[1].dimen
|
||||
end)
|
||||
end
|
||||
|
||||
function VirtualKey:onTapSelect()
|
||||
self[1].invert = true
|
||||
self:update_keyboard()
|
||||
if self.callback then
|
||||
self.callback()
|
||||
if self.flash_keyboard then
|
||||
self[1].invert = true
|
||||
self:update_keyboard()
|
||||
if self.callback then
|
||||
self.callback()
|
||||
end
|
||||
UIManager:scheduleIn(0.1, function() self:invert(false) end)
|
||||
else
|
||||
if self.callback then
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
UIManager:scheduleIn(0.1, function() self:invert(false) end)
|
||||
return true
|
||||
end
|
||||
|
||||
function VirtualKey:onHoldSelect()
|
||||
self[1].invert = true
|
||||
self:update_keyboard()
|
||||
if self.hold_callback then
|
||||
self.hold_callback()
|
||||
if self.flash_keyboard then
|
||||
self[1].invert = true
|
||||
self:update_keyboard()
|
||||
if self.hold_callback then
|
||||
self.hold_callback()
|
||||
end
|
||||
UIManager:scheduleIn(0.1, function() self:invert(false) end)
|
||||
else
|
||||
if self.hold_callback then
|
||||
self.hold_callback()
|
||||
end
|
||||
end
|
||||
UIManager:scheduleIn(0.1, function() self:invert(false) end)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user