android: add a toggle to ignore back button events (#6269)

Requires koreader/android-luajit-launcher#233
Requires koreader/koreader-base#1117

It is a workaround for #6263 but can be useful on some devices with erratic back key behaviour too (yep, Onyx)
reviewable/pr6271/r1
Martín Fernández 4 years ago committed by GitHub
parent b23af97914
commit 765b35a7bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 21ac242ab2d536c9923dcb263830fd204b100960
Subproject commit 2210b65f5af6895e516cc7e672e42c43269da45f

@ -224,6 +224,11 @@ function Device:init()
android.setVolumeKeysIgnored(true)
end
-- check if we ignore the back button completely
if G_reader_settings:isTrue("android_ignore_back_button") then
android.setBackButtonIgnored(true)
end
-- check if we enable a custom light level for this activity
local last_value = G_reader_settings:readSetting("fl_last_level")
if type(last_value) == "number" and last_value >= 0 then

@ -239,6 +239,16 @@ if Device:isAndroid() then
callback = function() G_reader_settings:flipNilOrFalse("camera_key_toggles_touchscreen") end,
}
common_settings.android_back_button = {
text = _("Ignore back button completely"),
checked_func = function() return android.isBackButtonIgnored() end,
callback = function()
local is_ignored = android.isBackButtonIgnored()
android.setBackButtonIgnored(not is_ignored)
G_reader_settings:saveSetting("android_ignore_back_button", not is_ignored)
end,
}
-- fullscreen toggle on devices with compatible fullscreen methods (apis 14-18)
if Device.firmware_rev < 19 then
common_settings.fullscreen = {

@ -55,6 +55,7 @@ local order = {
"android_volume_keys",
"android_camera_key",
"android_haptic_feedback",
"android_back_button",
"----------------------------",
"invert_page_turn_buttons",
},

@ -75,6 +75,7 @@ local order = {
"android_volume_keys",
"android_camera_key",
"android_haptic_feedback",
"android_back_button",
"----------------------------",
"invert_page_turn_gestures",
"invert_page_turn_buttons",

@ -1 +1 @@
Subproject commit fc4982b4afd50d2b86ae56e97b3bf09d191c81bb
Subproject commit b6eaf1e50fbb193c499882763d302b8a854044c1
Loading…
Cancel
Save