mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
[Readtimer] bug fix: fix focus when setting a timer (#14420)
This commit is contained in:
@@ -133,8 +133,9 @@ function DateTimeWidget:init()
|
||||
-- Actually the widget layout
|
||||
self:createLayout()
|
||||
|
||||
self.non_touch_with_action_dpad = Device:hasDPad() and Device:useDPadAsActionKeys() and not Device:isTouchDevice()
|
||||
-- Move focus to OK button on NT devices with key_events, saves time for users
|
||||
if Device:hasDPad() and Device:useDPadAsActionKeys() and not Device:isTouchDevice() then
|
||||
if self.non_touch_with_action_dpad then
|
||||
-- Since button table is the last row in our layout, and OK is the last button
|
||||
-- We need to set focus to both last row, and last column
|
||||
local last_row = #self.layout
|
||||
@@ -468,6 +469,13 @@ function DateTimeWidget:addWidget(widget)
|
||||
widget,
|
||||
}
|
||||
table.insert(self.date_frame[1], #self.date_frame[1], widget)
|
||||
if self.non_touch_with_action_dpad then
|
||||
-- We need to reset focus again, otherwise FocusManager will not know about the new additions
|
||||
-- and the cursor keys will become unresponsive.
|
||||
local last_row = #self.layout
|
||||
local last_col = #self.layout[last_row]
|
||||
self:moveFocusTo(last_col, last_row)
|
||||
end
|
||||
end
|
||||
|
||||
function DateTimeWidget:getAddedWidgetAvailableWidth()
|
||||
|
||||
@@ -93,8 +93,9 @@ function SpinWidget:init()
|
||||
-- Actually the widget layout
|
||||
self:update()
|
||||
|
||||
self.non_touch_with_action_dpad = Device:hasDPad() and Device:useDPadAsActionKeys() and not Device:isTouchDevice()
|
||||
-- Move focus to OK button on NT devices with key_events, saves time for users
|
||||
if Device:hasDPad() and Device:useDPadAsActionKeys() and not Device:isTouchDevice() then
|
||||
if self.non_touch_with_action_dpad then
|
||||
-- Since button table is the last row in our layout, and OK is the last button
|
||||
-- We need to set focus to both last row, and last column
|
||||
local last_row = #self.layout
|
||||
@@ -316,6 +317,13 @@ function SpinWidget:addWidget(widget, re_init)
|
||||
-- Insert widget before the bottom buttons and their previous vspan.
|
||||
-- This is different to InputDialog.
|
||||
table.insert(self.vgroup, #self.vgroup, widget)
|
||||
if self.non_touch_with_action_dpad then
|
||||
-- We need to reset focus again, otherwise FocusManager will not know about the new additions
|
||||
-- and the cursor keys will become unresponsive.
|
||||
local last_row = #self.layout
|
||||
local last_col = #self.layout[last_row]
|
||||
self:moveFocusTo(last_col, last_row)
|
||||
end
|
||||
end
|
||||
|
||||
function SpinWidget:getAddedWidgetAvailableWidth()
|
||||
|
||||
Reference in New Issue
Block a user