Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UX] VirtualKeyPopup: close on hold release #4891

Merged
merged 3 commits into from Apr 10, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -183,14 +183,16 @@ function VirtualKey:onUnfocus()
self[1].inner_bordersize = 0
end

function VirtualKey:onTapSelect()
function VirtualKey:onTapSelect(skip_flash)
if self.flash_keyboard and not self.skiptap then
self[1].inner_bordersize = self.focused_bordersize
self:update_keyboard(false, true)
if self.callback then
self.callback()
end
UIManager:tickAfterNext(function() self:invert(false) end)
if not skip_flash then
This conversation was marked as resolved by Frenzie

This comment has been minimized.

Copy link
@Frenzie

Frenzie Apr 10, 2019

Author Member

Seeing this in the diff made me realize it should just be part of the top condition.

The flashing behavior of this popup stuff isn't quite optimized in any case, with the whole keyboard refreshing and all.

UIManager:tickAfterNext(function() self:invert(false) end)
end
else
if self.callback then
self.callback()
@@ -259,7 +261,11 @@ function VirtualKeyPopup:onTapClose(arg, ges)
end

function VirtualKeyPopup:onClose()
local dimen = self.dimen
UIManager:close(self)
UIManager:setDirty(self, function()
return "partial", dimen
end)
return true
end

@@ -314,7 +320,14 @@ function VirtualKeyPopup:init()
width = parent_key.width,
height = parent_key.height,
}
-- don't open another popup on hold
virtual_key.hold_callback = nil
-- close popup on hold release
virtual_key.onHoldReleaseKey = function()
virtual_key:onTapSelect(true)
UIManager:close(self)
end
virtual_key.onPanReleaseKey = virtual_key.onHoldReleaseKey

if v == key_char_orig then
virtual_key[1].background = Blitbuffer.COLOR_LIGHT_GRAY
@@ -340,7 +353,7 @@ function VirtualKeyPopup:init()
end
end
table.insert(vertical_group, group)
table.insert(VirtualKeyPopup.layout, layout_horizontal)
table.insert(self.layout, layout_horizontal)
end
horizontalRow(extra_key_chars, horizontal_group_extra)
table.insert(vertical_group, v_key_padding)
@@ -359,14 +372,14 @@ function VirtualKeyPopup:init()
CenterContainer:new{
dimen = Geom:new{
w = parent_key.width*3 - 2*Size.border.default + 4*parent_key.keyboard.key_padding,
h = parent_key.height*4 - 2*Size.border.default + 5*parent_key.keyboard.key_padding,
h = parent_key.height*4 - 2*Size.border.default + 6*parent_key.keyboard.key_padding,
},
vertical_group,
}
}
keyboard_frame.dimen = keyboard_frame:getSize()

VirtualKeyPopup.ges_events = {
self.ges_events = {
TapClose = {
GestureRange:new{
ges = "tap",
@@ -375,10 +388,10 @@ function VirtualKeyPopup:init()
}

if Device:hasDPad() then
VirtualKeyPopup.key_events.PressKey = { {"Press"}, doc = "select key" }
self.key_events.PressKey = { {"Press"}, doc = "select key" }
end
if Device:hasKeys() then
VirtualKeyPopup.key_events.Close = { {"Back"}, doc = "close keyboard" }
self.key_events.Close = { {"Back"}, doc = "close keyboard" }
end

local position_container = WidgetContainer:new{
@@ -401,9 +414,9 @@ function VirtualKeyPopup:init()
position_container.dimen.y = Screen:getHeight() - keyboard_frame.dimen.h
end

VirtualKeyPopup[1] = position_container
self[1] = position_container

UIManager:show(VirtualKeyPopup)
UIManager:show(self)

UIManager:setDirty(self, function()
return "ui", keyboard_frame.dimen
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.