[UX] Implement hasFewKeys prototype (#6195)

This is a quick exploration into how the new Device:hasFewKeys() method could work to make things more usable on very limited devices.

In the reader, the right is repurposed to open the menu. Left in turn closes it.

The same principle is applied to ButtonDialog. This means you can select anything in principle, but once you go right you can't go back.

References <https://github.com/koreader/koreader/issues/4029>.
This commit is contained in:
Frans de Jonge
2020-06-04 13:26:18 +02:00
committed by GitHub
parent 879f8a7624
commit 4a65cc666b
7 changed files with 23 additions and 2 deletions

View File

@@ -59,10 +59,16 @@ function ReaderMenu:init()
if Device:hasKeys() then
if Device:isTouchDevice() then
self.key_events.TapShowMenu = { { "Menu" }, doc = "show menu", }
if Device:hasFewKeys() then
self.key_events.TapShowMenu = { { { "Menu", "Right" } }, doc = "show menu", }
end
else
-- map menu key to only top menu because bottom menu is only
-- designed for touch devices
self.key_events.ShowReaderMenu = { { "Menu" }, doc = "show menu", }
if Device:hasFewKeys() then
self.key_events.ShowReaderMenu = { { { "Menu", "Right" } }, doc = "show menu", }
end
end
end
self.activation_menu = G_reader_settings:readSetting("activate_menu")