InputDialog: tap outside to close dialog if keyboard is hidden (#11094)

pull/11088/merge
hius07 6 months ago committed by GitHub
parent 082ef9b545
commit da8e23c011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -484,6 +484,7 @@ function ReaderHandMade:addOrEditPageTocItem(pageno, when_updated_callback, sele
{
{
text = _("Cancel"),
id = "close",
callback = function()
UIManager:close(dialog)
end,

@ -267,16 +267,18 @@ function ButtonDialog:onCloseWidget()
end)
end
function ButtonDialog:onTapClose()
UIManager:close(self)
function ButtonDialog:onClose()
if self.tap_close_callback then
self.tap_close_callback()
end
UIManager:close(self)
return true
end
function ButtonDialog:onClose()
self:onTapClose()
function ButtonDialog:onTapClose(arg, ges)
if ges.pos:notIntersectWith(self.movable.dimen) then
self:onClose()
end
return true
end

@ -436,7 +436,10 @@ function InputDialog:init()
self.ges_events.Tap = {
GestureRange:new{
ges = "tap",
range = self[1].dimen, -- screen above the keyboard
range = Geom:new{
w = self.screen_width,
h = self.screen_height,
},
},
}
end
@ -478,13 +481,20 @@ function InputDialog:getAddedWidgetAvailableWidth()
return self._input_widget.width
end
-- Close the keyboard if we tap anywhere outside of the keyboard (that isn't an input field, where it would be caught via InputText:onTapTextBox)
function InputDialog:onTap()
-- Tap outside of inputbox to hide the keyboard (inside the inputbox it is caught via InputText:onTapTextBox).
-- If the keyboard is hidden, tap outside of the dialog to close the dialog.
function InputDialog:onTap(arg, ges)
-- This is slightly more fine-grained than VK's own visibility lock, hence the duplication...
if self.deny_keyboard_hiding then
return
end
self:onCloseKeyboard()
if self:isKeyboardVisible() then
self:onCloseKeyboard()
else
if ges.pos:notIntersectWith(self.dialog_frame.dimen) then
self:onCloseDialog()
end
end
end
function InputDialog:getInputText()

@ -724,6 +724,7 @@ function Menu:init()
{
{
text = _("Cancel"),
id = "close",
callback = function()
self.page_info_text:closeInputDialog()
end,

@ -441,6 +441,7 @@ function TextViewer:findDialog()
{
{
text = _("Cancel"),
id = "close",
callback = function()
UIManager:close(input_dialog)
end,

Loading…
Cancel
Save