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] Keyboard character selection popup #4886

Merged
merged 13 commits into from Apr 9, 2019

minor presentability cleanup

  • Loading branch information...
Frenzie committed Apr 9, 2019
commit c3b8dd617c1d9932d23654fe11dd7ca0ac0602e1
@@ -82,22 +82,13 @@ function VirtualKey:init()
key_padding = Size.padding.default,
}

function popup_focus_manager:onTapClose(arg, ges)
if ges.pos:notIntersectWith(self.dimen) then
UIManager:close(self)
-- Allow ReaderLink to check if our dismiss tap
-- was itself on another footnote, and display
-- it. This avoids having to tap 2 times to
-- see another footnote.
if self.on_tap_close_callback then
self.on_tap_close_callback(arg, ges, self.height)
elseif self.close_callback then
self.close_callback(self.height)
end
return true
end
return false
end
function popup_focus_manager:onTapClose(arg, ges)
if ges.pos:notIntersectWith(self.dimen) then
UIManager:close(self)
return true
end
return false
end

function popup_focus_manager:onClose()
UIManager:close(self)
@@ -110,8 +101,7 @@ end
end

local key_chars = self.key_chars
--logger.dbg(key_chars)
--error()

local extra_key_chars = {}

This comment has been minimized.

Copy link
@Frenzie

Frenzie Apr 9, 2019

Author Member

This here is the basic principle on which it's based: a 12-key grid of 4*3, manually assigned. 9 of those are directly accessible through a tap and 8 swipe directions.

It could be made to expand further on top, but that doesn't seem like the best idea as far as ease of use goes.

This comment has been minimized.

Copy link
@poire-z

poire-z Apr 9, 2019

Contributor

Not sure while just reading the code: do all these keys are also tap'able (so, the whole thing works without swipe)? Or it's just showing what's available?
I guess so, if there are these extra keys.
Do the extra_key row shows when there is none defined for that key?

Also, if this is shown on Hold, you might want to handle HoldPan/HoldPanRelase to support a swipe started from a Hold :)

This comment has been minimized.

Copy link
@Frenzie

Frenzie Apr 9, 2019

Author Member

These are only tappable. I suppose making swiping possible could be an idea.

extra_key_chars[1] = key_chars[2]
extra_key_chars[2] = key_chars[3]
@@ -158,64 +148,52 @@ end
table.insert(group, blank)
end
end
table.insert(vertical_group, group)
table.insert(popup_focus_manager.layout, layout_horizontal)

This comment has been minimized.

Copy link
@Frenzie

Frenzie Apr 9, 2019

Author Member

It works well with the keyboard, go me! ;-) (Okay, just for thinking of it.)

end
horizontalRow(extra_key_chars, horizontal_group_extra)
horizontalRow(top_key_chars, horizontal_group_top)
horizontalRow(middle_key_chars, horizontal_group_middle)
horizontalRow(bottom_key_chars, horizontal_group_bottom)

table.insert(vertical_group, horizontal_group_extra)
table.insert(vertical_group, horizontal_group_top)
table.insert(vertical_group, horizontal_group_middle)
table.insert(vertical_group, horizontal_group_bottom)

local keyboard_frame = FrameContainer:new{
margin = 0,
bordersize = Size.border.default,
background = Blitbuffer.COLOR_WHITE,
radius = 0,
padding = self.keyboard.padding,
CenterContainer:new{
dimen = Geom:new{
w = self.width*3 - 2*Size.border.default - 2*self.keyboard.padding,
h = self.height*4 - 2*Size.border.default - 2*self.keyboard.padding,
},
vertical_group,
}
}
--self[1] = BottomContainer:new{
-- dimen = Screen:getSize(),
-- keyboard_frame,
--}
--self.dimen = keyboard_frame:getSize()
local keyboard_frame = FrameContainer:new{
margin = 0,
bordersize = Size.border.default,
background = Blitbuffer.COLOR_WHITE,
radius = 0,
padding = self.keyboard.padding,
CenterContainer:new{
dimen = Geom:new{
w = self.width*3 - 2*Size.border.default - 2*self.keyboard.padding,
h = self.height*4 - 2*Size.border.default - 2*self.keyboard.padding,
},
vertical_group,
}
}

popup_focus_manager[1]=keyboard_frame
popup_focus_manager[1] = keyboard_frame

popup_focus_manager.ges_events = {
TapClose = {
GestureRange:new{
ges = "tap",
range = range,
}
},
}
popup_focus_manager.ges_events = {
TapClose = {
GestureRange:new{
ges = "tap",
range = range,
}
},
}

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

--self:_refresh()
--UIManager:show(keyboard_frame)
UIManager:show(popup_focus_manager)
--error()
UIManager:show(popup_focus_manager)

UIManager:setDirty(self, function()
return "ui", keyboard_frame:getSize()
end)
UIManager:setDirty(self, function()
return "ui", keyboard_frame:getSize()
end)

end
self.swipe_callback = function(ges)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.