Menu: Split off "Page Turns" submenu in two sections

The Kindle swipe animations & physical key inversion apply *everywhere*,
so we need this accessible in the FM, too.

Move it to Navigation, which is where it already was on !Touch devices.
reviewable/pr10821/r1
NiLuJe 9 months ago
parent 0db7509fe2
commit 6283674c47

@ -464,6 +464,9 @@ To:
self.menu_items[id] = common_setting
end
-- settings > Navigation; this mostly concerns platform-specific features or physical keys, and applies *everywhere*
self.menu_items.platform_navigation_features = require("ui/elements/platform_navigation")
-- settings tab - Document submenu
self.menu_items.document_metadata_location_move = {
text = _("Move book metadata"),

@ -237,11 +237,11 @@ function ReaderMenu:setUpdateItemTable()
end
if Device:isTouchDevice() then
-- 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")
else
-- Placed elsewhere than in Taps and gestures, with only a subset of menu items.
self.menu_items.page_turns_non_touch = require("ui/elements/page_turns")
end
-- While also related to page turns, this mostly concerns platform-specific features or physical keys, and applies *everywhere*
self.menu_items.platform_navigation_features = require("ui/elements/platform_navigation")
-- insert DjVu render mode submenu just before the last entry (show advanced)
-- this is a bit of a hack
if self.ui.document.is_djvu then

@ -70,6 +70,8 @@ local order = {
"back_in_reader",
"backspace_as_back",
"----------------------------",
"platform_navigation_features",
"----------------------------",
"android_volume_keys",
"android_haptic_feedback",
"android_back_button",

@ -1,4 +1,3 @@
local Device = require("device")
local Event = require("ui/event")
local ReaderUI = require("apps/reader/readerui")
local UIManager = require("ui/uimanager")
@ -171,38 +170,4 @@ When enabled the UI direction for the Table of Contents, Book Map, and Page Brow
}
}
if Device:canDoSwipeAnimation() then
table.insert(PageTurns.sub_item_table, {
text =_("Page turn animations"),
checked_func = function()
return G_reader_settings:isTrue("swipe_animations")
end,
callback = function()
UIManager:broadcastEvent(Event:new("TogglePageChangeAnimation"))
end,
separator = true,
})
end
if Device:hasKeys() then
table.insert(PageTurns.sub_item_table, {
text = _("Invert page turn buttons"),
checked_func = function()
return G_reader_settings:isTrue("input_invert_page_turn_keys")
end,
callback = function()
UIManager:broadcastEvent(Event:new("SwapPageTurnButtons"))
end,
})
end
if not Device:isTouchDevice() then
if Device:hasKeys() then
-- We just need the last item added above.
PageTurns = PageTurns.sub_item_table[#PageTurns.sub_item_table]
else
PageTurns = {} -- no menu item
end
end
return PageTurns

@ -0,0 +1,41 @@
local Device = require("device")
local Event = require("ui/event")
local UIManager = require("ui/uimanager")
local _ = require("gettext")
local PlatformNav = {
text = _("Page turn behavior"), -- Mainly so as to differentiate w/ "Page Turns" when in readermenu...
sub_item_table = {},
}
if Device:canDoSwipeAnimation() then
table.insert(PlatformNav.sub_item_table, {
text =_("Page turn animations"),
checked_func = function()
return G_reader_settings:isTrue("swipe_animations")
end,
callback = function()
UIManager:broadcastEvent(Event:new("TogglePageChangeAnimation"))
end,
separator = true,
})
end
if Device:hasKeys() then
table.insert(PlatformNav.sub_item_table, {
text = _("Invert page turn buttons"),
checked_func = function()
return G_reader_settings:isTrue("input_invert_page_turn_keys")
end,
callback = function()
UIManager:broadcastEvent(Event:new("SwapPageTurnButtons"))
end,
})
end
-- No menu item at all if it's empty
if #PlatformNav.sub_item_table == 0 then
return {}
end
return PlatformNav

@ -114,7 +114,8 @@ local order = {
"back_in_reader",
"backspace_as_back",
"----------------------------",
"page_turns_non_touch",
"platform_navigation_features",
"----------------------------",
"android_volume_keys",
"android_haptic_feedback",
"android_back_button",

Loading…
Cancel
Save