Input dialogs: keep size in rotation (#8223)

pull/8218/head^2
hius07 3 years ago committed by GitHub
parent a4763a613f
commit 859327dea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,7 +7,6 @@ local MultiInputDialog = require("ui/widget/multiinputdialog")
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
local ReaderUI = require("apps/reader/readerui") local ReaderUI = require("apps/reader/readerui")
local util = require("util") local util = require("util")
local Screen = require("device").screen
local T = require("ffi/util").template local T = require("ffi/util").template
local _ = require("gettext") local _ = require("gettext")
@ -136,8 +135,6 @@ function DropBox:config(item, callback)
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.95),
height = math.floor(Screen:getHeight() * 0.2),
input_type = "text", input_type = "text",
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)

@ -5,7 +5,6 @@ local FtpApi = require("apps/cloudstorage/ftpapi")
local InfoMessage = require("ui/widget/infomessage") local InfoMessage = require("ui/widget/infomessage")
local MultiInputDialog = require("ui/widget/multiinputdialog") local MultiInputDialog = require("ui/widget/multiinputdialog")
local ReaderUI = require("apps/reader/readerui") local ReaderUI = require("apps/reader/readerui")
local Screen = require("device").screen
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
local ltn12 = require("ltn12") local ltn12 = require("ltn12")
local logger = require("logger") local logger = require("logger")
@ -160,8 +159,6 @@ Username and password are optional.]])
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.95),
height = math.floor(Screen:getHeight() * 0.2),
input_type = "text", input_type = "text",
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)

@ -8,7 +8,6 @@ local ReaderUI = require("apps/reader/readerui")
local WebDavApi = require("apps/cloudstorage/webdavapi") local WebDavApi = require("apps/cloudstorage/webdavapi")
local util = require("util") local util = require("util")
local _ = require("gettext") local _ = require("gettext")
local Screen = require("device").screen
local T = require("ffi/util").template local T = require("ffi/util").template
local WebDav = {} local WebDav = {}
@ -153,8 +152,6 @@ The start folder is appended to the server path.]])
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.95),
height = math.floor(Screen:getHeight() * 0.2),
input_type = "text", input_type = "text",
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)

@ -122,7 +122,6 @@ function FileSearcher:onShowFileSearch(search_string)
self.search_dialog = InputDialog:new{ self.search_dialog = InputDialog:new{
title = _("Enter filename to search for"), title = _("Enter filename to search for"),
input = search_string or self.search_value, input = search_string or self.search_value,
width = math.floor(Screen:getWidth() * 0.9),
buttons = { buttons = {
{ {
{ {

@ -56,6 +56,10 @@ function SetDefaults:ConfirmEdit()
end end
function SetDefaults:init() function SetDefaults:init()
self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight()
self.dialog_width = math.floor(math.min(self.screen_width, self.screen_height) * 0.95)
self.results = {} self.results = {}
local defaults = {} local defaults = {}
@ -90,8 +94,8 @@ function SetDefaults:init()
end end
self.defaults_menu = Menu:new{ self.defaults_menu = Menu:new{
width = Screen:getWidth() - (Size.margin.fullscreen_popout * 2), width = self.screen_width - (Size.margin.fullscreen_popout * 2),
height = Screen:getHeight() - (Size.margin.fullscreen_popout * 2), height = self.screen_height - (Size.margin.fullscreen_popout * 2),
cface = Font:getFace("smallinfofont"), cface = Font:getFace("smallinfofont"),
show_parent = menu_container, show_parent = menu_container,
_manager = self, _manager = self,
@ -157,7 +161,7 @@ function SetDefaults:init()
}, },
}, },
input_type = setting_type, input_type = setting_type,
width = math.floor(Screen:getWidth() * 0.95), width = self.dialog_width,
} }
UIManager:show(self.set_dialog) UIManager:show(self.set_dialog)
self.set_dialog:onShowKeyboard() self.set_dialog:onShowKeyboard()
@ -208,8 +212,7 @@ function SetDefaults:init()
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.95), width = self.dialog_width,
height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.set_dialog) UIManager:show(self.set_dialog)
self.set_dialog:onShowKeyboard() self.set_dialog:onShowKeyboard()
@ -247,7 +250,7 @@ function SetDefaults:init()
}, },
}, },
input_type = setting_type, input_type = setting_type,
width = math.floor(Screen:getWidth() * 0.95), width = self.dialog_width,
} }
UIManager:show(self.set_dialog) UIManager:show(self.set_dialog)
self.set_dialog:onShowKeyboard() self.set_dialog:onShowKeyboard()

@ -107,7 +107,7 @@ function ReaderSearch:onShowFulltextSearchInput()
end end
self.input_dialog = InputDialog:new{ self.input_dialog = InputDialog:new{
title = _("Enter text to search for"), title = _("Enter text to search for"),
width = math.floor(Screen:getWidth() * 0.9), width = math.floor(math.min(Screen:getWidth(), Screen:getHeight()) * 0.9),
input = self.last_search_text, input = self.last_search_text,
buttons = { buttons = {
{ {
@ -153,7 +153,10 @@ function ReaderSearch:onShowFulltextSearchInput()
self.check_button_regex:toggleCheck() self.check_button_regex:toggleCheck()
end, end,
hold_callback = function() hold_callback = function()
UIManager:show(InfoMessage:new{ text = help_text }) UIManager:show(InfoMessage:new{
text = help_text,
width = Screen:getWidth() * 0.9,
})
end, end,
} }
self.input_dialog:addWidget(self.check_button_regex) self.input_dialog:addWidget(self.check_button_regex)

@ -202,13 +202,15 @@ local InputDialog = InputContainer:new{
} }
function InputDialog:init() function InputDialog:init()
self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight()
if self.fullscreen then if self.fullscreen then
self.is_movable = false self.is_movable = false
self.border_size = 0 self.border_size = 0
self.width = Screen:getWidth() - 2*self.border_size self.width = self.screen_width - 2*self.border_size
self.covers_fullscreen = true -- hint for UIManager:_repaint() self.covers_fullscreen = true -- hint for UIManager:_repaint()
else else
self.width = self.width or math.floor(Screen:getWidth() * 0.8) self.width = self.width or math.floor(math.min(self.screen_width, self.screen_height) * 0.8)
end end
if self.condensed then if self.condensed then
self.text_width = self.width - 2*(self.border_size + self.input_padding + self.input_margin) self.text_width = self.width - 2*(self.border_size + self.input_padding + self.input_margin)
@ -334,7 +336,7 @@ function InputDialog:init()
end end
input_widget:onCloseWidget() -- free() textboxwidget and keyboard input_widget:onCloseWidget() -- free() textboxwidget and keyboard
-- Find out available height -- Find out available height
local available_height = Screen:getHeight() local available_height = self.screen_height
- 2*self.border_size - 2*self.border_size
- self.title_widget:getSize().h - self.title_widget:getSize().h
- self.title_bar:getSize().h - self.title_bar:getSize().h
@ -457,8 +459,8 @@ function InputDialog:init()
or self._input_widget:getKeyboardDimen().h or self._input_widget:getKeyboardDimen().h
self[1] = CenterContainer:new{ self[1] = CenterContainer:new{
dimen = Geom:new{ dimen = Geom:new{
w = Screen:getWidth(), w = self.screen_width,
h = Screen:getHeight() - keyboard_height, h = self.screen_height - keyboard_height,
}, },
frame frame
} }

@ -123,7 +123,8 @@ function MultiInputDialog:init()
self[1] = CenterContainer:new{ self[1] = CenterContainer:new{
dimen = Geom:new{ dimen = Geom:new{
w = Screen:getWidth(), w = Screen:getWidth(),
h = Screen:getHeight() - self._input_widget:getKeyboardDimen().h, h = math.max(Screen:getHeight() - self._input_widget:getKeyboardDimen().h,
self.dialog_frame:getSize().h),
}, },
self.dialog_frame, self.dialog_frame,
} }

@ -226,8 +226,6 @@ function CalibreSearch:ShowSearch()
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.8),
height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.search_dialog) UIManager:show(self.search_dialog)
self.search_dialog:onShowKeyboard() self.search_dialog:onShowKeyboard()

@ -161,8 +161,6 @@ function OPDSBrowser:addNewCatalog()
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.95),
height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.add_server_dialog) UIManager:show(self.add_server_dialog)
self.add_server_dialog:onShowKeyboard() self.add_server_dialog:onShowKeyboard()
@ -213,8 +211,6 @@ function OPDSBrowser:editCalibreServer()
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.95),
height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.add_server_dialog) UIManager:show(self.add_server_dialog)
self.add_server_dialog:onShowKeyboard() self.add_server_dialog:onShowKeyboard()
@ -890,8 +886,6 @@ function OPDSBrowser:editOPDSServer(item)
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.95),
height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.edit_server_dialog) UIManager:show(self.edit_server_dialog)
self.edit_server_dialog:onShowKeyboard() self.edit_server_dialog:onShowKeyboard()

@ -152,8 +152,6 @@ function PerceptionExpander:showSettingsDialog()
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.8),
height = math.floor(Screen:getHeight() * 0.3),
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)
self.settings_dialog:onShowKeyboard() self.settings_dialog:onShowKeyboard()

@ -226,7 +226,6 @@ function Terminal:editCommands(item)
edit_dialog = InputDialog:new{ edit_dialog = InputDialog:new{
title = T(_('Edit commands for "%1"'), item.text), title = T(_('Edit commands for "%1"'), item.text),
input = item.commands, input = item.commands,
width = Screen:getWidth() * 0.9,
para_direction_rtl = false, -- force LTR para_direction_rtl = false, -- force LTR
input_type = "string", input_type = "string",
allow_newline = true, allow_newline = true,
@ -262,7 +261,6 @@ function Terminal:editName(item)
edit_dialog = InputDialog:new{ edit_dialog = InputDialog:new{
title = _("Edit name"), title = _("Edit name"),
input = item.text, input = item.text,
width = Screen:getWidth() * 0.9,
para_direction_rtl = false, -- force LTR para_direction_rtl = false, -- force LTR
input_type = "string", input_type = "string",
allow_newline = false, allow_newline = false,

@ -30,7 +30,6 @@ local socketutil = require("socketutil")
local util = require("util") local util = require("util")
local _ = require("gettext") local _ = require("gettext")
local T = FFIUtil.template local T = FFIUtil.template
local Screen = require("device").screen
-- constants -- constants
local article_id_prefix = "[w-id_" local article_id_prefix = "[w-id_"
@ -973,8 +972,6 @@ Restart KOReader after editing the config file.]]), BD.dirpath(DataStorage:getSe
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.95),
height = math.floor(Screen:getHeight() * 0.2),
input_type = "string", input_type = "string",
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)
@ -1013,8 +1010,6 @@ function Wallabag:editClientSettings()
}, },
}, },
}, },
width = math.floor(Screen:getWidth() * 0.95),
height = math.floor(Screen:getHeight() * 0.2),
input_type = "string", input_type = "string",
} }
UIManager:show(self.client_settings_dialog) UIManager:show(self.client_settings_dialog)

Loading…
Cancel
Save