Many widgets: similar size in portrait and landscape (#8238)

- ButtonTable, ButtonDialog, ButtonDialogTitle
- ConfirmBox, MultiConfirmBox, SkimToWidget
- KeyboardLayoutDialog (and initially move the dialog
  down to show the title in landscape mode)
- InputText's Clipboard dialog
Also: Notification: truncate long text
pull/8261/head
hius07 3 years ago committed by GitHub
parent 1e47cd7e5f
commit e3cf8eea56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -41,7 +41,6 @@ function ButtonDialog:init()
alpha = self.alpha,
FrameContainer:new{
ButtonTable:new{
width = math.floor(Screen:getWidth() * 0.9),
buttons = self.buttons,
show_parent = self,
},

@ -65,14 +65,13 @@ function ButtonDialogTitle:init()
bordersize = 0,
TextBoxWidget:new{
text = self.title,
width = math.floor(Screen:getWidth() * 0.8),
width = math.floor(math.min(Screen:getWidth(), Screen:getHeight()) * 0.8),
face = self.use_info_style and self.info_face or self.title_face,
alignment = self.title_align or "left",
},
},
VerticalSpan:new{ width = Size.span.vertical_default },
ButtonTable:new{
width = math.floor(Screen:getWidth() * 0.9),
buttons = self.buttons,
zero_sep = true,
show_parent = self,

@ -11,7 +11,7 @@ local Geom = require("ui/geometry")
local Screen = Device.screen
local ButtonTable = FocusManager:new{
width = Screen:getWidth(),
width = nil,
buttons = {
{
{text="OK", enabled=true, callback=nil},
@ -27,6 +27,7 @@ local ButtonTable = FocusManager:new{
}
function ButtonTable:init()
self.width = self.width or math.floor(math.min(Screen:getWidth(), Screen:getHeight()) * 0.9)
self.selected = { x = 1, y = 1 }
self.buttons_layout = {}
self.button_by_id = {}

@ -80,7 +80,7 @@ function ConfirmBox:init()
local text_widget = TextBoxWidget:new{
text = self.text,
face = self.face,
width = math.floor(Screen:getWidth() * 2/3),
width = math.floor(math.min(Screen:getWidth(), Screen:getHeight()) * 2/3),
}
local content = HorizontalGroup:new{
align = "center",

@ -178,8 +178,8 @@ if Device:isTouchDevice() or Device:hasDPad() then
title = _("Clipboard"),
text = is_clipboard_empty and _("(empty)") or clipboard_value,
fgcolor = is_clipboard_empty and Blitbuffer.COLOR_DARK_GRAY or Blitbuffer.COLOR_BLACK,
width = math.floor(Screen:getWidth() * 0.8),
height = math.floor(Screen:getHeight() * 0.4),
width = math.floor(math.min(Screen:getWidth(), Screen:getHeight()) * 0.8),
height = math.floor(math.max(Screen:getWidth(), Screen:getHeight()) * 0.4),
justified = false,
stop_events_propagation = true,
buttons_table = {
@ -522,7 +522,6 @@ function InputText:initKeyboard()
self.keyboard = Keyboard:new{
keyboard_layer = keyboard_layer,
inputbox = self,
width = Screen:getWidth(),
}
end

@ -29,7 +29,7 @@ local KeyboardLayoutDialog = InputContainer:new{
modal = true,
stop_events_propagation = true,
keyboard_state = nil,
width = math.floor(Screen:getWidth() * 0.8),
width = nil,
face = Font:getFace("cfont", 22),
title_face = Font:getFace("x_smalltfont"),
title_padding = Size.padding.default,
@ -40,6 +40,7 @@ local KeyboardLayoutDialog = InputContainer:new{
function KeyboardLayoutDialog:init()
self.width = self.width or math.floor(math.min(Screen:getWidth(), Screen:getHeight()) * 0.8)
-- Title & description
self.title_widget = FrameContainer:new{
padding = self.title_padding,
@ -158,7 +159,7 @@ function KeyboardLayoutDialog:init()
self[1] = CenterContainer:new{
dimen = Geom:new{
w = Screen:getWidth(),
h = Screen:getHeight(),
h = math.max(Screen:getHeight(), self.dialog_frame:getSize().h),
},
self.movable,
}

@ -86,7 +86,7 @@ function MultiConfirmBox:init()
TextBoxWidget:new{
text = self.text,
face = self.face,
width = math.floor(Screen:getWidth() * 2/3),
width = math.floor(math.min(Screen:getWidth(), Screen:getHeight()) * 2/3),
}
}

@ -91,6 +91,7 @@ function Notification:init()
local text_widget = TextWidget:new{
text = self.text,
face = self.face,
max_width = Screen:getWidth() - 2 * (self.margin + self.padding)
}
local widget_size = text_widget:getSize()
self.frame = FrameContainer:new{

@ -47,7 +47,7 @@ function SkimToWidget:init()
self.buttons_layout = {}
self.selected = { x = 1, y = 2 }
local frame_width = math.floor(screen_width * 0.95)
local frame_width = math.floor(math.min(screen_width, screen_height) * 0.95)
local frame_border_size = Size.border.window
local frame_padding = Size.padding.fullscreen -- large padding for airy feeling
local inner_width = frame_width - 2 * (frame_border_size + frame_padding)

@ -736,7 +736,6 @@ local VirtualKeyboard = FocusManager:new{
umlautmode = false,
layout = {},
width = Screen:scaleBySize(600),
height = nil,
bordersize = Size.border.default,
padding = 0,
@ -776,6 +775,7 @@ function VirtualKeyboard:init()
self.symbolmode_keys = keyboard.symbolmode_keys
self.utf8mode_keys = keyboard.utf8mode_keys
self.umlautmode_keys = keyboard.umlautmode_keys
self.width = Screen:getWidth()
local keys_height = G_reader_settings:isTrue("keyboard_key_compact") and 48 or 64
self.height = Screen:scaleBySize(keys_height * #self.KEYS)
self.min_layer = keyboard.min_layer

Loading…
Cancel
Save