mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[fix, UX] Ignore first hold release when keyboard opened with hold (#5011)
Fixes #4902.
This commit is contained in:
@@ -240,9 +240,9 @@ function Button:onHoldSelectButton()
|
||||
if self.enabled and self.hold_callback then
|
||||
self.hold_callback()
|
||||
elseif self.hold_input then
|
||||
self:onInput(self.hold_input)
|
||||
self:onInput(self.hold_input, true)
|
||||
elseif type(self.hold_input_func) == "function" then
|
||||
self:onInput(self.hold_input_func())
|
||||
self:onInput(self.hold_input_func(), true)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -264,7 +264,7 @@ function InputContainer:onGesture(ev)
|
||||
end
|
||||
end
|
||||
|
||||
function InputContainer:onInput(input)
|
||||
function InputContainer:onInput(input, ignore_first_hold_release)
|
||||
local InputDialog = require("ui/widget/inputdialog")
|
||||
self.input_dialog = InputDialog:new{
|
||||
title = input.title or "",
|
||||
@@ -291,7 +291,7 @@ function InputContainer:onInput(input)
|
||||
},
|
||||
}
|
||||
UIManager:show(self.input_dialog)
|
||||
self.input_dialog:onShowKeyboard()
|
||||
self.input_dialog:onShowKeyboard(ignore_first_hold_release)
|
||||
end
|
||||
|
||||
function InputContainer:closeInputDialog()
|
||||
|
||||
@@ -466,9 +466,9 @@ function InputDialog:onCloseWidget()
|
||||
end)
|
||||
end
|
||||
|
||||
function InputDialog:onShowKeyboard()
|
||||
function InputDialog:onShowKeyboard(ignore_first_hold_release)
|
||||
if not self.readonly and not self.keyboard_hidden then
|
||||
self._input_widget:onShowKeyboard()
|
||||
self._input_widget:onShowKeyboard(ignore_first_hold_release)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -396,7 +396,8 @@ function InputText:focus()
|
||||
self._frame_textwidget.color = Blitbuffer.COLOR_BLACK
|
||||
end
|
||||
|
||||
function InputText:onShowKeyboard()
|
||||
function InputText:onShowKeyboard(ignore_first_hold_release)
|
||||
self.keyboard.ignore_first_hold_release = ignore_first_hold_release
|
||||
UIManager:show(self.keyboard)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -185,6 +185,8 @@ function VirtualKey:onUnfocus()
|
||||
end
|
||||
|
||||
function VirtualKey:onTapSelect(skip_flash)
|
||||
-- just in case it's not flipped to false on hold release where it's supposed to
|
||||
self.keyboard.ignore_first_hold_release = false
|
||||
if self.flash_keyboard and not skip_flash and not self.skiptap then
|
||||
self[1].inner_bordersize = self.focused_bordersize
|
||||
self:update_keyboard(false, true)
|
||||
@@ -235,8 +237,21 @@ function VirtualKey:onSwipeKey(arg, ges)
|
||||
return true
|
||||
end
|
||||
|
||||
VirtualKey.onHoldReleaseKey = VirtualKey.onTapSelect
|
||||
VirtualKey.onPanReleaseKey = VirtualKey.onTapSelect
|
||||
function VirtualKey:onHoldReleaseKey()
|
||||
if self.keyboard.ignore_first_hold_release then
|
||||
self.keyboard.ignore_first_hold_release = false
|
||||
return true
|
||||
end
|
||||
self:onTapSelect()
|
||||
end
|
||||
|
||||
function VirtualKey:onPanReleaseKey()
|
||||
if self.keyboard.ignore_first_hold_release then
|
||||
self.keyboard.ignore_first_hold_release = false
|
||||
return true
|
||||
end
|
||||
self:onTapSelect()
|
||||
end
|
||||
|
||||
function VirtualKey:invert(invert, hold)
|
||||
if invert then
|
||||
|
||||
Reference in New Issue
Block a user