mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Misc: Review pass on the previous commits
* Unbreak the Device test * Rename a few things * Tweak a few comments
This commit is contained in:
@@ -464,9 +464,9 @@ To:
|
||||
self.menu_items[id] = common_setting
|
||||
end
|
||||
|
||||
-- settings > Navigation; this mostly concerns platform-specific features or physical keys, and applies *everywhere*
|
||||
-- Settings > Navigation; this mostly concerns physical keys, and applies *everywhere*
|
||||
if Device:hasKeys() then
|
||||
self.menu_items.platform_navigation_features = require("ui/elements/platform_navigation")
|
||||
self.menu_items.physical_buttons_setup = require("ui/elements/physical_buttons")
|
||||
end
|
||||
|
||||
-- settings tab - Document submenu
|
||||
|
||||
@@ -240,9 +240,9 @@ function ReaderMenu:setUpdateItemTable()
|
||||
-- Mostly concern about touch related page turn stuff, which only applies to Reader; ends up in Taps & Gestures
|
||||
self.menu_items.page_turns = require("ui/elements/page_turns")
|
||||
end
|
||||
-- While also related to page turns, this mostly concerns platform-specific features or physical keys, and applies *everywhere*
|
||||
-- Settings > Navigation; while also related to page turns, this mostly concerns physical keys, and applies *everywhere*
|
||||
if Device:hasKeys() then
|
||||
self.menu_items.platform_navigation_features = require("ui/elements/platform_navigation")
|
||||
self.menu_items.physical_buttons_setup = require("ui/elements/physical_buttons")
|
||||
end
|
||||
-- insert DjVu render mode submenu just before the last entry (show advanced)
|
||||
-- this is a bit of a hack
|
||||
|
||||
@@ -319,13 +319,13 @@ end
|
||||
|
||||
function DeviceListener:onToggleKeyRepeat(toggle)
|
||||
if toggle == true then
|
||||
G_reader_settings:makeFalse("input_no_key_repeats")
|
||||
G_reader_settings:makeFalse("input_no_key_repeat")
|
||||
elseif toggle == false then
|
||||
G_reader_settings:makeTrue("input_no_key_repeats")
|
||||
G_reader_settings:makeTrue("input_no_key_repeat")
|
||||
else
|
||||
G_reader_settings:flipNilOrFalse("input_no_key_repeats")
|
||||
G_reader_settings:flipNilOrFalse("input_no_key_repeat")
|
||||
end
|
||||
Device:toggleKeyRepeat(G_reader_settings:nilOrFalse("input_no_key_repeats"))
|
||||
Device:toggleKeyRepeat(G_reader_settings:nilOrFalse("input_no_key_repeat"))
|
||||
end
|
||||
|
||||
function DeviceListener:onRestart()
|
||||
|
||||
@@ -525,9 +525,11 @@ function Device:enableCPUCores(amount) end
|
||||
function Device:getKeyRepeat() end
|
||||
-- Device specific method to disable key repeat
|
||||
function Device:disableKeyRepeat() end
|
||||
-- Device specific method to restore key repeat
|
||||
-- Device specific method to restore the initial key repeat config
|
||||
function Device:restoreKeyRepeat() end
|
||||
-- Device specific method to toggle key repeat (between off and a hard-coded delay/period combo)
|
||||
-- NOTE: This one is for the user-facing toggle, it *ignores* the stock delay/period combo,
|
||||
-- opting instead for a hard-coded one (as we can't guarantee that key repeat is actually setup properly or at all).
|
||||
-- Device specific method to toggle key repeat
|
||||
function Device:toggleKeyRepeat(toggle) end
|
||||
|
||||
--[[
|
||||
|
||||
@@ -890,8 +890,8 @@ function Kobo:init()
|
||||
self.hasIRGridSysfsKnob = "/sys/devices/platform/imx-i2c.1/i2c-1/1-0050/neocmd"
|
||||
end
|
||||
|
||||
-- Disable key repeats if requested
|
||||
if G_reader_settings:isTrue("input_no_key_repeats") then
|
||||
-- Disable key repeat if requested
|
||||
if G_reader_settings:isTrue("input_no_key_repeat") then
|
||||
self:toggleKeyRepeat(false)
|
||||
end
|
||||
|
||||
@@ -901,7 +901,7 @@ function Kobo:init()
|
||||
end
|
||||
|
||||
function Kobo:exit()
|
||||
-- Re-enable key repeats on exit, that's the default state
|
||||
-- Re-enable key repeat on exit, that's the default state
|
||||
self:toggleKeyRepeat(true)
|
||||
|
||||
Generic.exit(self)
|
||||
|
||||
@@ -70,7 +70,7 @@ local order = {
|
||||
"back_in_reader",
|
||||
"backspace_as_back",
|
||||
"----------------------------",
|
||||
"platform_navigation_features",
|
||||
"physical_buttons_setup",
|
||||
"----------------------------",
|
||||
"android_volume_keys",
|
||||
"android_haptic_feedback",
|
||||
|
||||
@@ -4,8 +4,8 @@ local UIManager = require("ui/uimanager")
|
||||
local _ = require("gettext")
|
||||
|
||||
-- This whole menu is hidden behind a hasKeys device cap.
|
||||
local PlatformNav = {
|
||||
text = _("Page turn behavior"), -- Mainly so as to differentiate w/ "Page Turns" when in readermenu...
|
||||
local PhysicalButtons = {
|
||||
text = _("Physical buttons"), -- Mainly so as to differentiate w/ "Page Turns" when in readermenu...
|
||||
sub_item_table = {
|
||||
{
|
||||
text = _("Invert page turn buttons"),
|
||||
@@ -20,11 +20,11 @@ local PlatformNav = {
|
||||
}
|
||||
|
||||
if Device:canKeyRepeat() then
|
||||
table.insert(PlatformNav.sub_item_table, {
|
||||
text = _("Disable key repeats"),
|
||||
table.insert(PhysicalButtons.sub_item_table, {
|
||||
text = _("Disable key repeat"),
|
||||
help_text = _("Useful if you don't like the behavior or if your device has faulty switches"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("input_no_key_repeats")
|
||||
return G_reader_settings:isTrue("input_no_key_repeat")
|
||||
end,
|
||||
callback = function()
|
||||
UIManager:broadcastEvent(Event:new("ToggleKeyRepeat"))
|
||||
@@ -33,4 +33,4 @@ if Device:canKeyRepeat() then
|
||||
})
|
||||
end
|
||||
|
||||
return PlatformNav
|
||||
return PhysicalButtons
|
||||
@@ -114,7 +114,7 @@ local order = {
|
||||
"back_in_reader",
|
||||
"backspace_as_back",
|
||||
"----------------------------",
|
||||
"platform_navigation_features",
|
||||
"physical_buttons_setup",
|
||||
"----------------------------",
|
||||
"android_volume_keys",
|
||||
"android_haptic_feedback",
|
||||
|
||||
@@ -25,6 +25,8 @@ describe("device module", function()
|
||||
scaleBySize = fb.scaleBySize,
|
||||
setWindowTitle = function() end,
|
||||
refreshFull = function() end,
|
||||
getHWNightmode = function() return false end,
|
||||
setupDithering = function() end,
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user