mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
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)
This commit is contained in:
2
base
2
base
Submodule base updated: 21ac242ab2...2210b65f5a
@@ -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",
|
||||
|
||||
Submodule platform/android/luajit-launcher updated: fc4982b4af...b6eaf1e50f
Reference in New Issue
Block a user