New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: disable exit menu & disable wakelocks by default. #4493

Merged
merged 2 commits into from Jan 22, 2019

Conversation

Projects
None yet
2 participants
@pazos
Copy link
Contributor

pazos commented Jan 18, 2019

Fix #4421, thanks to @Frenzie for the code!
Fix #4492 , until I or somebody have time to implement configurable screen timeout.

Requires koreader/android-luajit-launcher#95

@Frenzie

This comment has been minimized.

Copy link
Member

Frenzie commented Jan 18, 2019

Perhaps something like this:

diff --git a/frontend/apps/filemanager/filemanagermenu.lua b/frontend/apps/filemanager/filemanagermenu.lua
index 3c7d3c58..7edaaebc 100644
--- a/frontend/apps/filemanager/filemanagermenu.lua
+++ b/frontend/apps/filemanager/filemanagermenu.lua
@@ -285,12 +285,10 @@ function FileManagerMenu:setUpdateItemTable()
             self:exitOrRestart()
         end,
     }
-    self.menu_items.restart_koreader = {
-        text = _("Restart KOReader"),
-        callback = function()
-            self:exitOrRestart(function() UIManager:restartKOReader() end)
-        end,
-    }
+    -- if Android
+    self.menu_items.exit_menu = self.menu_items.exit
+    self.menu_items.exit = nil
     if not Device:isTouchDevice() then
         --add a shortcut on non touch-device
         --because this menu is not accessible otherwise
diff --git a/frontend/ui/elements/filemanager_menu_order.lua b/frontend/ui/elements/filemanager_menu_order.lua
index eaf800e3..cc0adc8d 100644
--- a/frontend/ui/elements/filemanager_menu_order.lua
+++ b/frontend/ui/elements/filemanager_menu_order.lua
@@ -119,4 +119,7 @@ local order = {
     }
 }
 
+-- if Android
+order.exit_menu = nil
+
 return order

@Frenzie Frenzie added the Android label Jan 18, 2019

@pazos pazos force-pushed the pazos:android-exit branch from 7a255ae to cc42c66 Jan 18, 2019

@pazos pazos changed the title Android: disable restart in exit menu Android: disable exit menu Jan 18, 2019

@pazos

This comment has been minimized.

Copy link
Contributor Author

pazos commented Jan 18, 2019

Your suggestion works great!

@Frenzie

This comment has been minimized.

Copy link
Member

Frenzie commented Jan 19, 2019

The way you wrote it now, the remaining menu entry restart_koreader should be auto-added to the left-most menu. You'll still need to conditionally add or nil it like before. ;-)

@pazos pazos force-pushed the pazos:android-exit branch from cc42c66 to 48ab151 Jan 21, 2019

@pazos pazos changed the title Android: disable exit menu Android: disable exit menu & disable wakelocks by default. Jan 21, 2019

@pazos pazos requested a review from Frenzie Jan 21, 2019

@Frenzie Frenzie merged commit 6b3158e into koreader:master Jan 22, 2019

1 check passed

ci/circleci Your tests passed on CircleCI!
Details
@Frenzie

This comment has been minimized.

Copy link
Member

Frenzie commented Jan 22, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment