Switch virtual keyboard default to false on hasKeyboard (#15057)

This commit is contained in:
David authored and GitHub committed 2026-03-07 08:24:16 +01:00
1 parent 42aaa2031e
commit bed8f558fa
5 files changed
+22 -11

No files matched your search

+12 -1
View File
@@ -12,7 +12,7 @@ local util = require("util")
local _ = require("gettext")
-- Date at which the last migration snippet was added
local CURRENT_MIGRATION_DATE = 20250929
local CURRENT_MIGRATION_DATE = 20260306
-- Retrieve the date of the previous migration, if any
local last_migration_date = G_reader_settings:readSetting("last_migration_date", 0)
@@ -945,5 +945,16 @@ if last_migration_date < 20250929 then
end
end
-- 20260306, Screensaver message position refactor: top/middle/bottom -> banner/box with custom positioning
-- https://github.com/koreader/koreader/pull/15057
if last_migration_date < 20260306 then
logger.info("Performing one-time migration for 20260306")
local Device = require("device")
if Device:hasScreenKB() and G_reader_settings:hasNot("virtual_keyboard_enabled") then
G_reader_settings:makeTrue("virtual_keyboard_enabled")
end
end
-- We're done, store the current migration date
G_reader_settings:saveSetting("last_migration_date", CURRENT_MIGRATION_DATE)
@@ -164,7 +164,7 @@ local sub_item_table = {
text = _("Keyboard appearance settings"),
keep_menu_open = true,
enabled_func = function()
return G_reader_settings:nilOrTrue("virtual_keyboard_enabled")
return G_reader_settings:isTrue("virtual_keyboard_enabled") or (Device:isTouchDevice() and not Device:hasKeyboard())
end,
callback = function(touchmenu_instance)
local InputDialog = require("ui/widget/inputdialog")
@@ -233,11 +233,11 @@ if Device:hasKeyboard() or Device:hasScreenKB() then
text = _("Show virtual keyboard"),
help_text = _("Enable this setting to always display the virtual keyboard within a text input field. When a field is selected (in focus), you can temporarily toggle the keyboard on/off by pressing 'Shift' (or 'ScreenKB') + 'Home'."),
checked_func = function()
return G_reader_settings:nilOrTrue("virtual_keyboard_enabled")
return G_reader_settings:isTrue("virtual_keyboard_enabled")
end,
callback = function()
G_reader_settings:flipNilOrTrue("virtual_keyboard_enabled")
if G_reader_settings:isFalse("virtual_keyboard_enabled") then
G_reader_settings:flipNilOrFalse("virtual_keyboard_enabled")
if G_reader_settings:nilOrFalse("virtual_keyboard_enabled") then
local keyboard_infomessage
if Device:hasScreenKB() then
keyboard_infomessage = _("When a text field is selected (in focus), you can temporarily bring up the virtual keyboard by pressing 'ScreenKB' + 'Home'.")
+2 -2
View File
@@ -223,7 +223,7 @@ function InputDialog:init()
if self.fullscreen or self.add_nav_bar then
self.deny_keyboard_hiding = true
end
if (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:isFalse("virtual_keyboard_enabled") then
if (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:nilOrFalse("virtual_keyboard_enabled") then
self.keyboard_visible = false
self.skip_first_show_keyboard = true
end
@@ -642,7 +642,7 @@ function InputDialog:isKeyboardVisible()
end
function InputDialog:lockKeyboard(toggle)
if (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:isFalse("virtual_keyboard_enabled") then
if (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:nilOrFalse("virtual_keyboard_enabled") then
-- do not lock the virtual keyboard when user is hiding it, we still *might* want to activate it via shortcuts ("Shift" + "Home") when in need of special characters or symbols
return
end
+2 -2
View File
@@ -142,7 +142,7 @@ local function initTouchEvents()
if self.parent.onSwitchFocus then
self.parent:onSwitchFocus(self)
else
if not ((Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:isFalse("virtual_keyboard_enabled")) then
if not ((Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:nilOrFalse("virtual_keyboard_enabled")) then
self:onShowKeyboard()
end
Device:startTextInput()
@@ -209,7 +209,7 @@ local function initDPadEvents()
-- Event sent by focusmanager
if self.parent.onSwitchFocus then
self.parent:onSwitchFocus(self)
elseif (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:isFalse("virtual_keyboard_enabled") then
elseif (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:nilOrFalse("virtual_keyboard_enabled") then
do end -- luacheck: ignore 541
else
if not self:isKeyboardVisible() then
+2 -2
View File
@@ -112,7 +112,7 @@ function MultiInputDialog:init()
-- Reset self.keyboard_visible because InputDialog:onCloseKeyboard sets it to false, which can lead to an incorrect keyboard
-- visibility state since we still might want our very own virtual keyboard.
if (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:isFalse("virtual_keyboard_enabled") then
if (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:nilOrFalse("virtual_keyboard_enabled") then
do end -- luacheck: ignore 541
elseif self.readonly then
do end -- luacheck: ignore 541
@@ -263,7 +263,7 @@ function MultiInputDialog:onSwitchFocus(inputbox)
self._input_widget:focus()
self.focused_field_idx = inputbox.idx
if (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:isFalse("virtual_keyboard_enabled") then
if (Device:hasKeyboard() or Device:hasScreenKB()) and G_reader_settings:nilOrFalse("virtual_keyboard_enabled") then
-- do not load virtual keyboard when user is hiding it.
return
end