Kindle4NT improvements (#3745)

* [device][kindle4] add fake event to kindle4

* modify focusmanager to allow for more complex layout

The focusmanager now naviguate the layout by avoiding nil value
instead of relying on table lenght. It should be completely backward
compatible

* add Dpad naviguation to the touchmenu

* fix crash because virtualkeyboard on non touch device

the kindle4NT has no keyboard nor touch, the fix open the virtual
keyboard so koreader dont crash but it's not useable

* Enable device with keys to use the touchmenu

* Don't get stuck in reader progress statistics plugin

* [underlinecontainer] Fix and remove unused function

References #1898.
This commit is contained in:
onde2rock
2018-03-14 22:16:38 +01:00
committed by Frans de Jonge
parent 9849d89f0e
commit e8aab49ee9
12 changed files with 148 additions and 69 deletions

View File

@@ -53,7 +53,6 @@ function ReaderMenu:init()
self.registered_widgets = {}
if Device:hasKeys() then
self.key_events = { Close = { { "Back" }, doc = "close menu" }, }
if Device:isTouchDevice() then
self.key_events.TapShowMenu = { { "Menu" }, doc = "show menu", }
else
@@ -241,7 +240,7 @@ function ReaderMenu:onShowReaderMenu(tab_index)
}
local main_menu
if Device:isTouchDevice() then
if Device:isTouchDevice() or Device:hasDPad() then
local TouchMenu = require("ui/widget/touchmenu")
main_menu = TouchMenu:new{
width = Screen:getWidth(),
@@ -294,8 +293,10 @@ function ReaderMenu:_getTabIndexFromLocation(ges)
if self.tab_item_table == nil then
self:setUpdateItemTable()
end
if not ges then
return self.last_tab_index
-- if the start position is far right
if ges.pos.x > 2 * Screen:getWidth() / 3 then
elseif ges.pos.x > 2 * Screen:getWidth() / 3 then
return #self.tab_item_table
-- if the start position is far left
elseif ges.pos.x < Screen:getWidth() / 3 then