[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
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

Loading…
Cancel
Save