[fix, UX] Ignore first hold release when keyboard opened with hold (#5011)

Fixes #4902.
pull/5012/head v2019.05
Frans de Jonge 5 years ago committed by GitHub
parent 1b24582a08
commit 2968f558eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -240,9 +240,9 @@ function Button:onHoldSelectButton()
if self.enabled and self.hold_callback then if self.enabled and self.hold_callback then
self.hold_callback() self.hold_callback()
elseif self.hold_input then elseif self.hold_input then
self:onInput(self.hold_input) self:onInput(self.hold_input, true)
elseif type(self.hold_input_func) == "function" then elseif type(self.hold_input_func) == "function" then
self:onInput(self.hold_input_func()) self:onInput(self.hold_input_func(), true)
end end
return true return true
end end

@ -264,7 +264,7 @@ function InputContainer:onGesture(ev)
end end
end end
function InputContainer:onInput(input) function InputContainer:onInput(input, ignore_first_hold_release)
local InputDialog = require("ui/widget/inputdialog") local InputDialog = require("ui/widget/inputdialog")
self.input_dialog = InputDialog:new{ self.input_dialog = InputDialog:new{
title = input.title or "", title = input.title or "",
@ -291,7 +291,7 @@ function InputContainer:onInput(input)
}, },
} }
UIManager:show(self.input_dialog) UIManager:show(self.input_dialog)
self.input_dialog:onShowKeyboard() self.input_dialog:onShowKeyboard(ignore_first_hold_release)
end end
function InputContainer:closeInputDialog() function InputContainer:closeInputDialog()

@ -466,9 +466,9 @@ function InputDialog:onCloseWidget()
end) end)
end end
function InputDialog:onShowKeyboard() function InputDialog:onShowKeyboard(ignore_first_hold_release)
if not self.readonly and not self.keyboard_hidden then if not self.readonly and not self.keyboard_hidden then
self._input_widget:onShowKeyboard() self._input_widget:onShowKeyboard(ignore_first_hold_release)
end end
end end

@ -396,7 +396,8 @@ function InputText:focus()
self._frame_textwidget.color = Blitbuffer.COLOR_BLACK self._frame_textwidget.color = Blitbuffer.COLOR_BLACK
end 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) UIManager:show(self.keyboard)
return true return true
end end

@ -185,6 +185,8 @@ function VirtualKey:onUnfocus()
end end
function VirtualKey:onTapSelect(skip_flash) 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 if self.flash_keyboard and not skip_flash and not self.skiptap then
self[1].inner_bordersize = self.focused_bordersize self[1].inner_bordersize = self.focused_bordersize
self:update_keyboard(false, true) self:update_keyboard(false, true)
@ -235,8 +237,21 @@ function VirtualKey:onSwipeKey(arg, ges)
return true return true
end end
VirtualKey.onHoldReleaseKey = VirtualKey.onTapSelect function VirtualKey:onHoldReleaseKey()
VirtualKey.onPanReleaseKey = VirtualKey.onTapSelect 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) function VirtualKey:invert(invert, hold)
if invert then if invert then

Loading…
Cancel
Save