android: add an option to ignore volume keys or use them to turn pages

pull/5165/head
Martín Fernández 5 years ago
parent 53adb9d0e1
commit 91b2faae6a

@ -1 +1 @@
Subproject commit 9ee0e9ebe7f4c0f52dd14ebe1198bffcff43e4c5
Subproject commit 6301277ce89adf6350a0956444610d5f715598ab

@ -182,6 +182,11 @@ function Device:init()
self:toggleFullscreen()
end
-- check if we ignore volume keys and then they're forwarded to system services.
if G_reader_settings:isTrue("android_ignore_volume_keys") then
android.setVolumeKeysIgnored(true);
end
Generic.init(self)
end

@ -175,6 +175,17 @@ if Device:isAndroid() then
-- screen timeout options, disabled if device needs wakelocks.
common_settings.screen_timeout = require("ui/elements/screen_android"):getTimeoutMenuTable()
-- volume key events
common_settings.android_volume_keys = {
text = _("Volume key page turning"),
checked_func = function() return not android.getVolumeKeysIgnored() end,
callback = function()
local is_ignored = android.getVolumeKeysIgnored()
android.setVolumeKeysIgnored(not is_ignored)
G_reader_settings:saveSetting("android_ignore_volume_keys", not is_ignored)
end,
}
-- fullscreen toggle on devices with compatible fullscreen methods (apis 14-18)
if Device.firmware_rev < 19 then
common_settings.fullscreen = {

@ -49,6 +49,7 @@ local order = {
"back_to_exit",
"back_in_filemanager",
"enable_back_history",
"android_volume_keys",
"----------------------------",
"invert_page_turn_buttons",
},

@ -68,6 +68,7 @@ local order = {
"back_to_exit",
"back_in_filemanager",
"enable_back_history",
"android_volume_keys",
"----------------------------",
"invert_page_turn_buttons",
},

@ -1 +1 @@
Subproject commit e4dd25e10b678c4303989b9db1bbd10d5008b1ea
Subproject commit c82631d29f0d7e8e87cdd6bad0503369513b320c
Loading…
Cancel
Save