Restart KOReader: add a ConfirmBox instead of a plain InfoMessage (#9853)

This commit is contained in:
zwim
2022-12-03 21:29:13 +01:00
committed by GitHub
parent fa9f0acf5e
commit d1cd2a1c8d
15 changed files with 67 additions and 95 deletions

View File

@@ -10,16 +10,14 @@ local function dpi() return Screen:getDPI() end
local function custom() return G_reader_settings:readSetting("custom_screen_dpi") end
local function setDPI(dpi_val)
local InfoMessage = require("ui/widget/infomessage")
local UIManager = require("ui/uimanager")
UIManager:show(InfoMessage:new{
text = dpi_val and T(_("DPI set to %1. This will take effect after restarting."), dpi_val)
or _("DPI set to auto. This will take effect after restarting."),
})
local text = dpi_val and T(_("DPI set to %1. This will take effect after restarting."), dpi_val)
or _("DPI set to auto. This will take effect after restarting.")
-- If this is set to nil, reader.lua doesn't call setScreenDPI
G_reader_settings:saveSetting("screen_dpi", dpi_val)
-- Passing a nil properly resets to defaults/auto
Device:setScreenDPI(dpi_val)
UIManager:askForRestart(text)
end
local function spinWidgetSetDPI(touchmenu_instance)