mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Floor dimension computations (mul/div). (#6264)
* floor most every dimension computations involving MUL or DIV Should avoid passing nonsensical floating point coordinates/dimensions to the UI code. * Update base * https://github.com/koreader/koreader-base/pull/1113 * https://github.com/koreader/koreader-base/pull/1114 * https://github.com/koreader/koreader-base/pull/1115 * Bump android-luajit-launcher https://github.com/koreader/android-luajit-launcher/pull/230 https://github.com/koreader/android-luajit-launcher/pull/231
This commit is contained in:
2
base
2
base
Submodule base updated: 7b5568a3c4...3c3b7ca24b
@@ -130,8 +130,8 @@ function DropBox:config(item, callback)
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
input_type = "text",
|
||||
}
|
||||
UIManager:show(self.settings_dialog)
|
||||
|
||||
@@ -146,8 +146,8 @@ function Ftp:config(item, callback)
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
input_type = "text",
|
||||
}
|
||||
UIManager:show(self.settings_dialog)
|
||||
|
||||
@@ -139,8 +139,8 @@ The start folder is appended to the server path.]])
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
input_type = "text",
|
||||
}
|
||||
UIManager:show(self.settings_dialog)
|
||||
|
||||
@@ -114,7 +114,7 @@ function FileSearcher:onShowFileSearch(search_path)
|
||||
self.search_dialog = InputDialog:new{
|
||||
title = _("Search for books by filename"),
|
||||
input = self.search_value,
|
||||
width = Screen:getWidth() * 0.9,
|
||||
width = math.floor(Screen:getWidth() * 0.9),
|
||||
buttons = {
|
||||
{
|
||||
{
|
||||
|
||||
@@ -143,7 +143,7 @@ function FileManagerMenu:setUpdateItemTable()
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local curr_items = G_reader_settings:readSetting("items_per_page") or 14
|
||||
local items = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = curr_items,
|
||||
value_min = 6,
|
||||
value_max = 24,
|
||||
@@ -166,7 +166,7 @@ function FileManagerMenu:setUpdateItemTable()
|
||||
local default_font_size = math.floor(24 - ((curr_items - 6)/ 18) * 10 )
|
||||
local curr_font_size = G_reader_settings:readSetting("items_font_size") or default_font_size
|
||||
local items_font = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = curr_font_size,
|
||||
value_min = 10,
|
||||
value_max = 72,
|
||||
|
||||
@@ -206,8 +206,8 @@ function Search:ShowSearch()
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.8,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.8),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
}
|
||||
UIManager:show(self.search_dialog)
|
||||
self.search_dialog:onShowKeyboard()
|
||||
|
||||
@@ -157,7 +157,7 @@ function SetDefaults:init()
|
||||
},
|
||||
},
|
||||
input_type = setting_type,
|
||||
width = Screen:getWidth() * 0.95,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
}
|
||||
UIManager:show(self.set_dialog)
|
||||
self.set_dialog:onShowKeyboard()
|
||||
@@ -208,8 +208,8 @@ function SetDefaults:init()
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
}
|
||||
UIManager:show(self.set_dialog)
|
||||
self.set_dialog:onShowKeyboard()
|
||||
@@ -247,7 +247,7 @@ function SetDefaults:init()
|
||||
},
|
||||
},
|
||||
input_type = setting_type,
|
||||
width = Screen:getWidth() * 0.95,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
}
|
||||
UIManager:show(self.set_dialog)
|
||||
self.set_dialog:onShowKeyboard()
|
||||
|
||||
@@ -42,15 +42,15 @@ function PageCropDialog:init()
|
||||
show_parent = self,
|
||||
}
|
||||
local ok_container = RightContainer:new{
|
||||
dimen = Geom:new{ w = Screen:getWidth()*0.33, h = Screen:getHeight()/12},
|
||||
dimen = Geom:new{ w = math.floor(Screen:getWidth()*0.33), h = math.floor(Screen:getHeight()/12)},
|
||||
ok_button,
|
||||
}
|
||||
local cancel_container = LeftContainer:new{
|
||||
dimen = Geom:new{ w = Screen:getWidth()*0.33, h = Screen:getHeight()/12},
|
||||
dimen = Geom:new{ w = math.floor(Screen:getWidth()*0.33), h = math.floor(Screen:getHeight()/12)},
|
||||
cancel_button,
|
||||
}
|
||||
table.insert(horizontal_group, ok_container)
|
||||
table.insert(horizontal_group, HorizontalSpan:new{ width = Screen:getWidth()*0.34})
|
||||
table.insert(horizontal_group, HorizontalSpan:new{ width = math.floor(Screen:getWidth()*0.34)})
|
||||
table.insert(horizontal_group, cancel_container)
|
||||
self[2] = FrameContainer:new{
|
||||
horizontal_group,
|
||||
|
||||
@@ -79,7 +79,7 @@ function ReaderDeviceStatus:addToMainMenu(menu_items)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local curr_items = G_reader_settings:readSetting("low_battery_threshold") or 20
|
||||
local battery_spin = SpinWidget:new {
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = curr_items,
|
||||
value_min = 5,
|
||||
value_max = 90,
|
||||
|
||||
@@ -308,7 +308,7 @@ If you'd like to change the order in which dictionaries are queried (and their r
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local font_size = G_reader_settings:readSetting("dict_font_size") or 20
|
||||
local items_font = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = font_size,
|
||||
value_min = 8,
|
||||
value_max = 32,
|
||||
|
||||
@@ -897,7 +897,7 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local font_size = self.settings.text_font_size
|
||||
local items_font = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = font_size,
|
||||
value_min = 8,
|
||||
value_max = 36,
|
||||
@@ -951,7 +951,7 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local container_height = self.settings.container_height
|
||||
local items_font = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = container_height,
|
||||
value_min = 7,
|
||||
value_max = 98,
|
||||
@@ -978,7 +978,7 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local container_bottom_padding = self.settings.container_bottom_padding
|
||||
local items_font = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = container_bottom_padding,
|
||||
value_min = 0,
|
||||
value_max = 49,
|
||||
@@ -1007,7 +1007,7 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
callback = function(touchmenu_instance)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local items = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = self.settings.book_title_max_width_pct,
|
||||
value_min = 10,
|
||||
value_step = 5,
|
||||
@@ -1033,7 +1033,7 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
callback = function(touchmenu_instance)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local items = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = self.settings.book_chapter_max_width_pct,
|
||||
value_min = 10,
|
||||
value_step = 5,
|
||||
@@ -1409,7 +1409,7 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
end
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local items = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = value,
|
||||
value_min = value_min,
|
||||
value_step = 1,
|
||||
@@ -1585,7 +1585,7 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
callback = function(touchmenu_instance)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local items = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = self.settings.progress_bar_min_width_pct,
|
||||
value_min = 5,
|
||||
value_step = 5,
|
||||
|
||||
@@ -489,7 +489,7 @@ function ReaderGesture:addToMainMenu(menu_items)
|
||||
Set double tap interval in milliseconds.
|
||||
The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds).
|
||||
Default value: %1]]), GestureDetector.DOUBLE_TAP_INTERVAL/1000),
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = GestureDetector:getInterval("ges_double_tap_interval")/1000,
|
||||
value_min = 100,
|
||||
value_max = 2000,
|
||||
@@ -516,7 +516,7 @@ Default value: %1]]), GestureDetector.DOUBLE_TAP_INTERVAL/1000),
|
||||
Set two finger tap duration in milliseconds.
|
||||
The duration value can range from 100 (0.1 seconds) to 2000 (2 seconds).
|
||||
Default value: %1]]), GestureDetector.TWO_FINGER_TAP_DURATION/1000),
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = GestureDetector:getInterval("ges_two_finger_tap_duration")/1000,
|
||||
value_min = 100,
|
||||
value_max = 2000,
|
||||
@@ -543,7 +543,7 @@ Default value: %1]]), GestureDetector.TWO_FINGER_TAP_DURATION/1000),
|
||||
Set hold interval in milliseconds.
|
||||
The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds).
|
||||
Default value: %1]]), GestureDetector.HOLD_INTERVAL/1000),
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = GestureDetector:getInterval("ges_hold_interval")/1000,
|
||||
value_min = 100,
|
||||
value_max = 2000,
|
||||
@@ -570,7 +570,7 @@ Default value: %1]]), GestureDetector.HOLD_INTERVAL/1000),
|
||||
Set pan delay interval in milliseconds.
|
||||
The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds).
|
||||
Default value: %1]]), GestureDetector.PAN_DELAYED_INTERVAL/1000),
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = GestureDetector:getInterval("ges_pan_delayed_interval")/1000,
|
||||
value_min = 100,
|
||||
value_max = 2000,
|
||||
@@ -597,7 +597,7 @@ Default value: %1]]), GestureDetector.PAN_DELAYED_INTERVAL/1000),
|
||||
Set swipe interval in milliseconds.
|
||||
The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds).
|
||||
Default value: %1]]), GestureDetector.SWIPE_INTERVAL/1000),
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = GestureDetector:getInterval("ges_swipe_interval")/1000,
|
||||
value_min = 100,
|
||||
value_max = 2000,
|
||||
|
||||
@@ -250,7 +250,7 @@ From the footnote popup, you can jump to the footnote location in the book by sw
|
||||
callback = function()
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
UIManager:show(SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.75,
|
||||
width = math.floor(Screen:getWidth() * 0.75),
|
||||
value = G_reader_settings:readSetting("footnote_popup_relative_font_size") or -2,
|
||||
value_min = -10,
|
||||
value_max = 5,
|
||||
|
||||
@@ -392,7 +392,7 @@ function ReaderPageMap:addToMainMenu(menu_items)
|
||||
callback = function(touchmenu_instance)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local spin_w = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = self.label_font_size,
|
||||
value_min = 8,
|
||||
value_max = 20,
|
||||
|
||||
@@ -453,7 +453,7 @@ You can set how many lines are shown.]])
|
||||
callback = function(touchmenu_instance)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
UIManager:show(SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.75,
|
||||
width = math.floor(Screen:getWidth() * 0.75),
|
||||
value = G_reader_settings:readSetting("copt_overlap_lines") or 1,
|
||||
value_min = 1,
|
||||
value_max = 10,
|
||||
|
||||
@@ -412,7 +412,7 @@ When the book's language tag is not among our presets, no specific features will
|
||||
right_default = alg_right_hyphen_min,
|
||||
-- let room on the widget sides so we can see
|
||||
-- the hyphenation changes happening
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
default_values = true,
|
||||
default_text = _("Use language defaults"),
|
||||
title_text = _("Hyphenation limits"),
|
||||
|
||||
@@ -37,12 +37,12 @@ function SkimToWidget:init()
|
||||
self.screen_width = Screen:getWidth()
|
||||
self.screen_height = Screen:getHeight()
|
||||
self.span = math.ceil(self.screen_height * 0.01)
|
||||
self.width = self.screen_width * 0.95
|
||||
self.width = math.floor(self.screen_width * 0.95)
|
||||
self.button_bordersize = Size.border.button
|
||||
-- the buttons need some kind of separation but maybe I should just implement
|
||||
-- margin_left and margin_right…
|
||||
self.button_margin = self.button_bordersize
|
||||
self.button_width = self.screen_width * 0.16 - (2*self.button_margin)
|
||||
self.button_width = math.floor(self.screen_width * 0.16) - (2*self.button_margin)
|
||||
if Device:hasKeys() then
|
||||
self.key_events = {
|
||||
Close = { {"Back"}, doc = "close skimto page" }
|
||||
@@ -93,12 +93,12 @@ function SkimToWidget:init()
|
||||
text = dialog_title,
|
||||
face = self.title_face,
|
||||
bold = true,
|
||||
max_width = self.screen_width * 0.95,
|
||||
max_width = math.floor(self.screen_width * 0.95),
|
||||
},
|
||||
}
|
||||
|
||||
self.progress_bar = ProgressWidget:new{
|
||||
width = self.screen_width * 0.9,
|
||||
width = math.floor(self.screen_width * 0.9),
|
||||
height = Size.item.height_big,
|
||||
percentage = self.curr_page / self.page_count,
|
||||
ticks = self.ticks_candidates,
|
||||
@@ -181,7 +181,7 @@ function SkimToWidget:init()
|
||||
radius = 0,
|
||||
padding = 0,
|
||||
enabled = true,
|
||||
width = self.screen_width * 0.2 - (2*self.button_margin),
|
||||
width = math.floor(self.screen_width * 0.2) - (2*self.button_margin),
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
self.callback_switch_to_goto()
|
||||
@@ -268,7 +268,7 @@ function SkimToWidget:init()
|
||||
end,
|
||||
}
|
||||
|
||||
local horizontal_span_up = HorizontalSpan:new{ width = self.screen_width * 0.2 }
|
||||
local horizontal_span_up = HorizontalSpan:new{ width = math.floor(self.screen_width * 0.2) }
|
||||
local button_table_up = HorizontalGroup:new{
|
||||
align = "center",
|
||||
button_chapter_prev,
|
||||
|
||||
@@ -19,7 +19,7 @@ end
|
||||
local function spinWidgetSetRefresh(touchmenu_instance, refresh_rate_num)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local items = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = custom(refresh_rate_num),
|
||||
value_min = 0,
|
||||
value_max = 200,
|
||||
|
||||
@@ -24,7 +24,7 @@ local function spinWidgetSetDPI(touchmenu_instance)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local items = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = custom() or dpi(),
|
||||
value_min = 90,
|
||||
value_max = 900,
|
||||
|
||||
@@ -280,7 +280,7 @@ end
|
||||
|
||||
function BookStatusWidget:genBookInfoGroup()
|
||||
local screen_width = Screen:getWidth()
|
||||
local split_span_width = screen_width * 0.05
|
||||
local split_span_width = math.floor(screen_width * 0.05)
|
||||
|
||||
local img_width, img_height
|
||||
if Screen:getScreenMode() == "landscape" then
|
||||
@@ -330,7 +330,7 @@ function BookStatusWidget:genBookInfoGroup()
|
||||
-- progress bar
|
||||
local read_percentage = self.view.state.page / self.total_pages
|
||||
local progress_bar = ProgressWidget:new{
|
||||
width = width * 0.7,
|
||||
width = math.floor(width * 0.7),
|
||||
height = Screen:scaleBySize(10),
|
||||
percentage = read_percentage,
|
||||
ticks = nil,
|
||||
@@ -478,7 +478,7 @@ function BookStatusWidget:genSummaryGroup(width)
|
||||
text = self.summary.note,
|
||||
face = self.medium_font_face,
|
||||
width = width - self.padding * 3,
|
||||
height = height * 0.75,
|
||||
height = math.floor(height * 0.75),
|
||||
scroll = true,
|
||||
bordersize = Size.border.default,
|
||||
focused = false,
|
||||
@@ -547,7 +547,7 @@ function BookStatusWidget:generateSwitchGroup(width)
|
||||
end
|
||||
|
||||
local switch = ToggleSwitch:new{
|
||||
width = width * 0.6,
|
||||
width = math.floor(width * 0.6),
|
||||
default_value = config.default_value,
|
||||
name = config.name,
|
||||
name_text = config.name_text,
|
||||
|
||||
@@ -43,7 +43,7 @@ function ButtonDialog:init()
|
||||
alpha = self.alpha,
|
||||
FrameContainer:new{
|
||||
ButtonTable:new{
|
||||
width = Screen:getWidth()*0.9,
|
||||
width = math.floor(Screen:getWidth() * 0.9),
|
||||
buttons = self.buttons,
|
||||
show_parent = self,
|
||||
},
|
||||
|
||||
@@ -65,14 +65,14 @@ function ButtonDialogTitle:init()
|
||||
bordersize = 0,
|
||||
TextBoxWidget:new{
|
||||
text = self.title,
|
||||
width = Screen:getWidth() * 0.8 ,
|
||||
width = math.floor(Screen:getWidth() * 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 = Screen:getWidth() * 0.9,
|
||||
width = math.floor(Screen:getWidth() * 0.9),
|
||||
buttons = self.buttons,
|
||||
zero_sep = true,
|
||||
show_parent = self,
|
||||
|
||||
@@ -1103,7 +1103,7 @@ function ConfigDialog:onConfigMoreChoose(values, name, event, args, name_text, d
|
||||
-- (No support for value_table - add it if needed)
|
||||
local curr_values = self.configurable[name]
|
||||
widget = DoubleSpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
left_text = more_options_param.left_text,
|
||||
right_text = more_options_param.right_text,
|
||||
left_value = curr_values[1],
|
||||
@@ -1181,7 +1181,7 @@ function ConfigDialog:onConfigMoreChoose(values, name, event, args, name_text, d
|
||||
end
|
||||
end
|
||||
widget = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = curr_items,
|
||||
value_index = value_index,
|
||||
value_table = more_options_param.value_table,
|
||||
|
||||
@@ -37,7 +37,7 @@ function DateWidget:init()
|
||||
self.light_bar = {}
|
||||
self.screen_width = Screen:getWidth()
|
||||
self.screen_height = Screen:getHeight()
|
||||
self.width = self.screen_width * 0.95
|
||||
self.width = math.floor(self.screen_width * 0.95)
|
||||
if Device:hasKeys() then
|
||||
self.key_events = {
|
||||
Close = { {"Back"}, doc = "close date widget" }
|
||||
@@ -62,7 +62,7 @@ end
|
||||
function DateWidget:update()
|
||||
local year_widget = NumberPickerWidget:new{
|
||||
show_parent = self,
|
||||
width = self.screen_width * 0.2,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
value = self.year,
|
||||
value_min = 2017,
|
||||
value_max = 2037,
|
||||
@@ -71,7 +71,7 @@ function DateWidget:update()
|
||||
}
|
||||
local month_widget = NumberPickerWidget:new{
|
||||
show_parent = self,
|
||||
width = self.screen_width * 0.2,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
value = self.month,
|
||||
value_min = 1,
|
||||
value_max = 12,
|
||||
@@ -80,7 +80,7 @@ function DateWidget:update()
|
||||
}
|
||||
local day_widget = NumberPickerWidget:new{
|
||||
show_parent = self,
|
||||
width = self.screen_width * 0.2,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
value = self.day,
|
||||
value_min = 1,
|
||||
value_max = 31,
|
||||
@@ -94,7 +94,7 @@ function DateWidget:update()
|
||||
alignment = "center",
|
||||
face = self.title_face,
|
||||
bold = true,
|
||||
width = self.screen_width * 0.1,
|
||||
width = math.floor(self.screen_width * 0.1),
|
||||
}
|
||||
local date_group = HorizontalGroup:new{
|
||||
align = "center",
|
||||
@@ -113,7 +113,7 @@ function DateWidget:update()
|
||||
text = self.title_text,
|
||||
face = self.title_face,
|
||||
bold = true,
|
||||
width = self.screen_width * 0.95,
|
||||
width = math.floor(self.screen_width * 0.95),
|
||||
},
|
||||
}
|
||||
local date_line = LineWidget:new{
|
||||
@@ -172,8 +172,8 @@ function DateWidget:update()
|
||||
date_line,
|
||||
CenterContainer:new{
|
||||
dimen = Geom:new{
|
||||
w = self.screen_width * 0.95,
|
||||
h = date_group:getSize().h * 1.2,
|
||||
w = math.floor(self.screen_width * 0.95),
|
||||
h = math.floor(date_group:getSize().h * 1.2),
|
||||
},
|
||||
date_group
|
||||
},
|
||||
|
||||
@@ -247,7 +247,7 @@ function DictQuickLookup:update()
|
||||
self.align = "bottom"
|
||||
end
|
||||
end
|
||||
self.height = math.min(self.region.h*0.7, Screen:getHeight()*0.5)
|
||||
self.height = math.floor(math.min(self.region.h*0.7, Screen:getHeight()*0.5))
|
||||
end
|
||||
-- dictionary title
|
||||
local close_button = CloseButton:new{ window = self, padding_top = self.title_margin, }
|
||||
@@ -310,7 +310,7 @@ function DictQuickLookup:update()
|
||||
css = self:getHtmlDictionaryCss(),
|
||||
default_font_size = Screen:scaleBySize(G_reader_settings:readSetting("dict_font_size") or 20),
|
||||
width = self.width,
|
||||
height = self.is_fullpage and self.height*0.75 or self.height*0.7,
|
||||
height = self.is_fullpage and math.floor(self.height*0.75) or math.floor(self.height*0.7),
|
||||
dialog = self,
|
||||
html_link_tapped_callback = function(link)
|
||||
self.html_dictionary_link_tapped_callback(self.dictionary, link)
|
||||
@@ -322,7 +322,7 @@ function DictQuickLookup:update()
|
||||
face = self.content_face,
|
||||
width = self.width,
|
||||
-- get a bit more height for definition as wiki has one less button raw
|
||||
height = self.is_fullpage and self.height*0.75 or self.height*0.7,
|
||||
height = self.is_fullpage and math.floor(self.height*0.75) or math.floor(self.height*0.7),
|
||||
dialog = self,
|
||||
-- allow for disabling justification
|
||||
justified = G_reader_settings:nilOrTrue("dict_justify"),
|
||||
|
||||
@@ -54,8 +54,8 @@ function DoubleSpinWidget:init()
|
||||
self.medium_font_face = Font:getFace("ffont")
|
||||
self.screen_width = Screen:getWidth()
|
||||
self.screen_height = Screen:getHeight()
|
||||
self.width = self.width or self.screen_width * 0.8
|
||||
self.picker_width = self.screen_width * 0.25
|
||||
self.width = self.width or math.floor(self.screen_width * 0.8)
|
||||
self.picker_width = math.floor(self.screen_width * 0.25)
|
||||
if Device:hasKeys() then
|
||||
self.key_events = {
|
||||
Close = { {"Back"}, doc = "close time widget" }
|
||||
@@ -174,7 +174,7 @@ function DoubleSpinWidget:update()
|
||||
TextBoxWidget:new{
|
||||
text = self.info_text or "",
|
||||
face = Font:getFace("x_smallinfofont"),
|
||||
width = self.width * 0.9,
|
||||
width = math.floor(self.width * 0.9),
|
||||
}
|
||||
}
|
||||
local buttons = {
|
||||
|
||||
@@ -291,7 +291,7 @@ function FootnoteWidget:init()
|
||||
local added_bottom_pad = 0
|
||||
-- See if needed:
|
||||
-- Add a bit to bottom padding, as getSinglePageHeight() cut can be rough
|
||||
-- added_bottom_pad = font_size * 0.2
|
||||
-- added_bottom_pad = math.floor(font_size * 0.2)
|
||||
local reduced_height = single_page_height + top_border_size + padding_top + padding_bottom + added_bottom_pad
|
||||
vgroup = CenterContainer:new{
|
||||
dimen = Geom:new{
|
||||
|
||||
@@ -46,7 +46,7 @@ function FrontLightWidget:init()
|
||||
self.screen_width = Screen:getWidth()
|
||||
self.screen_height = Screen:getHeight()
|
||||
self.span = math.ceil(self.screen_height * 0.01)
|
||||
self.width = self.screen_width * 0.95
|
||||
self.width = math.floor(self.screen_width * 0.95)
|
||||
self.powerd = Device:getPowerDevice()
|
||||
self.fl_min = self.powerd.fl_min
|
||||
self.fl_max = self.powerd.fl_max
|
||||
@@ -155,7 +155,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
|
||||
end
|
||||
|
||||
self.fl_group = ProgressWidget:new{
|
||||
width = self.screen_width * 0.9,
|
||||
width = math.floor(self.screen_width * 0.9),
|
||||
height = Size.item.height_big,
|
||||
percentage = self.fl_cur / self.fl_max,
|
||||
ticks = ticks,
|
||||
@@ -167,14 +167,14 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
|
||||
face = self.medium_font_face,
|
||||
bold = true,
|
||||
alignment = "center",
|
||||
width = self.screen_width * 0.95
|
||||
width = math.floor(self.screen_width * 0.95),
|
||||
}
|
||||
local button_minus = Button:new{
|
||||
text = "-1",
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = enable_button_minus and not self.light_fallback,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function() self:setProgress(self.fl_cur - 1, step) end,
|
||||
}
|
||||
@@ -183,7 +183,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = enable_button_plus and not self.light_fallback,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function() self:setProgress(self.fl_cur + 1, step) end,
|
||||
}
|
||||
@@ -191,14 +191,14 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
|
||||
text = self.fl_cur,
|
||||
face = self.medium_font_face,
|
||||
alignment = "center",
|
||||
width = self.screen_width * 0.95 - 1.275 * button_minus.width - 1.275 * button_plus.width,
|
||||
width = math.floor(self.screen_width * 0.95 - 1.275 * button_minus.width - 1.275 * button_plus.width),
|
||||
}
|
||||
local button_min = Button:new{
|
||||
text = _("Min"),
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = not self.light_fallback,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function() self:setProgress(self.fl_min+1, step) end, -- min is 1 (use toggle for 0)
|
||||
}
|
||||
@@ -207,7 +207,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = not self.light_fallback,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function() self:setProgress(self.fl_max, step) end,
|
||||
}
|
||||
@@ -216,14 +216,14 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = not self.light_fallback,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
self:setProgress(self.fl_min, step)
|
||||
end,
|
||||
}
|
||||
local empty_space = HorizontalSpan:new{
|
||||
width = (self.screen_width * 0.95 - 1.2 * button_minus.width - 1.2 * button_plus.width - 1.2 * button_toggle.width) / 2,
|
||||
width = math.floor((self.screen_width * 0.95 - 1.2 * button_minus.width - 1.2 * button_plus.width - 1.2 * button_toggle.width) / 2),
|
||||
}
|
||||
local button_table_up = HorizontalGroup:new{
|
||||
align = "center",
|
||||
@@ -280,7 +280,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
|
||||
text = _("Configure"),
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
enabled = not self.nl_configure_open,
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
@@ -357,14 +357,14 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
|
||||
face = self.medium_font_face,
|
||||
bold = true,
|
||||
alignment = "center",
|
||||
width = self.screen_width * 0.95
|
||||
width = math.floor(self.screen_width * 0.95),
|
||||
}
|
||||
local button_minus = Button:new{
|
||||
text = "-" .. (1 * self.nl_scale),
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = enable_button_minus,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function() self:setProgress(self.fl_cur, step, (num_warmth - (1 * self.nl_scale))) end,
|
||||
}
|
||||
@@ -373,7 +373,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = enable_button_plus,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function() self:setProgress(self.fl_cur, step, (num_warmth + (1 * self.nl_scale))) end,
|
||||
}
|
||||
@@ -381,14 +381,14 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
|
||||
text = num_warmth,
|
||||
face = self.medium_font_face,
|
||||
alignment = "center",
|
||||
width = self.screen_width * 0.95 - 1.275 * button_minus.width - 1.275 * button_plus.width,
|
||||
width = math.floor(self.screen_width * 0.95 - 1.275 * button_minus.width - 1.275 * button_plus.width),
|
||||
}
|
||||
local button_min = Button:new{
|
||||
text = _("Min"),
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = not self.powerd.auto_warmth,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function() self:setProgress(self.fl_cur, step, self.nl_min) end,
|
||||
}
|
||||
@@ -397,12 +397,12 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = not self.powerd.auto_warmth,
|
||||
width = self.screen_width * 0.20,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function() self:setProgress(self.fl_cur, step, (self.nl_max * self.nl_scale)) end,
|
||||
}
|
||||
local empty_space = HorizontalSpan:new{
|
||||
width = (self.screen_width * 0.95 - 1.2 * button_minus.width - 1.2 * button_plus.width) / 2,
|
||||
width = math.floor((self.screen_width * 0.95 - 1.2 * button_minus.width - 1.2 * button_plus.width) / 2),
|
||||
}
|
||||
local button_table_up = HorizontalGroup:new{
|
||||
align = "center",
|
||||
@@ -437,7 +437,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
|
||||
alignment = "right",
|
||||
fgcolor = self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or
|
||||
Blitbuffer.COLOR_DARK_GRAY,
|
||||
width = self.screen_width * 0.3
|
||||
width = math.floor(self.screen_width * 0.3),
|
||||
}
|
||||
local text_hour = TextBoxWidget:new{
|
||||
text = " " .. math.floor(self.powerd.max_warmth_hour) .. ":" ..
|
||||
@@ -446,14 +446,14 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
|
||||
alignment = "center",
|
||||
fgcolor =self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or
|
||||
Blitbuffer.COLOR_DARK_GRAY,
|
||||
width = self.screen_width * 0.15
|
||||
width = math.floor(self.screen_width * 0.15),
|
||||
}
|
||||
local button_minus_one_hour = Button:new{
|
||||
text = "−",
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = self.powerd.auto_warmth,
|
||||
width = self.screen_width * 0.1,
|
||||
width = math.floor(self.screen_width * 0.1),
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
self.powerd.max_warmth_hour =
|
||||
@@ -473,7 +473,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
enabled = self.powerd.auto_warmth,
|
||||
width = self.screen_width * 0.1,
|
||||
width = math.floor(self.screen_width * 0.1),
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
self.powerd.max_warmth_hour =
|
||||
@@ -542,14 +542,14 @@ function FrontLightWidget:update()
|
||||
text = _("Frontlight"),
|
||||
face = self.title_face,
|
||||
bold = true,
|
||||
width = self.screen_width * 0.95,
|
||||
width = math.floor(self.screen_width * 0.95),
|
||||
},
|
||||
}
|
||||
local light_level = FrameContainer:new{
|
||||
padding = Size.padding.button,
|
||||
margin = Size.margin.small,
|
||||
bordersize = 0,
|
||||
self:generateProgressGroup(self.screen_width * 0.95, self.screen_height * 0.20,
|
||||
self:generateProgressGroup(math.floor(self.screen_width * 0.95), math.floor(self.screen_height * 0.2),
|
||||
self.fl_cur, self.one_step)
|
||||
}
|
||||
local light_line = LineWidget:new{
|
||||
|
||||
@@ -207,12 +207,12 @@ function InputDialog:init()
|
||||
self.width = Screen:getWidth() - 2*self.border_size
|
||||
self.covers_fullscreen = true -- hint for UIManager:_repaint()
|
||||
else
|
||||
self.width = self.width or Screen:getWidth() * 0.8
|
||||
self.width = self.width or math.floor(Screen:getWidth() * 0.8)
|
||||
end
|
||||
if self.condensed then
|
||||
self.text_width = self.width - 2*(self.border_size + self.input_padding + self.input_margin)
|
||||
else
|
||||
self.text_width = self.text_width or self.width * 0.9
|
||||
self.text_width = self.text_width or math.floor(self.width * 0.9)
|
||||
end
|
||||
if self.readonly then -- hide keyboard if we can't edit
|
||||
self.keyboard_hidden = true
|
||||
|
||||
@@ -25,7 +25,7 @@ local KeyboardLayoutDialog = InputContainer:new{
|
||||
is_always_active = true,
|
||||
title = _("Keyboard layout"),
|
||||
modal = true,
|
||||
width = Screen:getWidth() * 0.8,
|
||||
width = math.floor(Screen:getWidth() * 0.8),
|
||||
face = Font:getFace("cfont", 22),
|
||||
title_face = Font:getFace("x_smalltfont"),
|
||||
title_padding = Size.padding.default,
|
||||
@@ -86,7 +86,7 @@ function KeyboardLayoutDialog:init()
|
||||
|
||||
self.radio_button_table = RadioButtonTable:new{
|
||||
radio_buttons = radio_buttons,
|
||||
width = self.width * 0.9,
|
||||
width = math.floor(self.width * 0.9),
|
||||
focused = true,
|
||||
scroll = false,
|
||||
parent = self,
|
||||
|
||||
@@ -28,7 +28,7 @@ function LoginDialog:init()
|
||||
text = self.username,
|
||||
hint = self.username_hint,
|
||||
face = self.input_face,
|
||||
width = self.width * 0.9,
|
||||
width = math.floor(self.width * 0.9),
|
||||
focused = true,
|
||||
scroll = false,
|
||||
parent = self,
|
||||
@@ -38,7 +38,7 @@ function LoginDialog:init()
|
||||
text = self.password,
|
||||
hint = self.password_hint,
|
||||
face = self.input_face,
|
||||
width = self.width * 0.9,
|
||||
width = math.floor(self.width * 0.9),
|
||||
text_type = "password",
|
||||
focused = false,
|
||||
scroll = false,
|
||||
|
||||
@@ -42,7 +42,7 @@ function MultiInputDialog:init()
|
||||
input_type = field.input_type or "string",
|
||||
text_type = field.text_type,
|
||||
face = self.input_face,
|
||||
width = self.width * 0.9,
|
||||
width = math.floor(self.width * 0.9),
|
||||
focused = k == 1 and true or false,
|
||||
scroll = false,
|
||||
parent = self,
|
||||
@@ -68,7 +68,7 @@ function MultiInputDialog:init()
|
||||
TextBoxWidget:new{
|
||||
text = field.description,
|
||||
face = Font:getFace("x_smallinfofont"),
|
||||
width = self.width * 0.9,
|
||||
width = math.floor(self.width * 0.9),
|
||||
}
|
||||
}
|
||||
table.insert(VerticalGroupData, CenterContainer:new{
|
||||
|
||||
@@ -46,7 +46,7 @@ function NaturalLightWidget:init()
|
||||
self.screen_width = Screen:getWidth()
|
||||
self.screen_height = Screen:getHeight()
|
||||
self.span = math.ceil(self.screen_height * 0.01)
|
||||
self.width = self.screen_width*0.95
|
||||
self.width = math.floor(self.screen_width * 0.95)
|
||||
self.button_width = 0.08 * self.width
|
||||
self.textbox_width = 0.1 * self.width
|
||||
self.text_width = 0.2 * self.width
|
||||
@@ -149,15 +149,15 @@ function NaturalLightWidget:createFrame()
|
||||
text = _("Natural light configuration"),
|
||||
face = self.title_face,
|
||||
bold = true,
|
||||
width = self.screen_width * 0.95,
|
||||
width = math.floor(self.screen_width * 0.95),
|
||||
},
|
||||
}
|
||||
local main_content = FrameContainer:new{
|
||||
padding = Size.padding.button,
|
||||
margin = Size.margin.small,
|
||||
bordersize = 0,
|
||||
self:createMainContent(self.screen_width * 0.95,
|
||||
self.screen_height * 0.201)
|
||||
self:createMainContent(math.floor(self.screen_width * 0.95),
|
||||
math.floor(self.screen_height * 0.2))
|
||||
}
|
||||
local nl_line = LineWidget:new{
|
||||
dimen = Geom:new{
|
||||
@@ -272,7 +272,7 @@ function NaturalLightWidget:createMainContent(width, height)
|
||||
text = "Restore Defaults",
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
width = self.width * 0.35,
|
||||
width = math.floor(self.width * 0.35),
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
self:setAllValues({white_gain = 25,
|
||||
@@ -288,7 +288,7 @@ function NaturalLightWidget:createMainContent(width, height)
|
||||
text = "Cancel",
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
width = self.width * 0.2,
|
||||
width = math.floor(self.width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
self:setAllValues(self.old_values)
|
||||
@@ -299,7 +299,7 @@ function NaturalLightWidget:createMainContent(width, height)
|
||||
text = "Save",
|
||||
margin = Size.margin.small,
|
||||
radius = 0,
|
||||
width = self.width * 0.2,
|
||||
width = math.floor(self.width * 0.2),
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("natural_light_config",
|
||||
|
||||
@@ -56,7 +56,7 @@ function NumberPickerWidget:init()
|
||||
self.screen_width = Screen:getWidth()
|
||||
self.screen_height = Screen:getHeight()
|
||||
if self.width == nil then
|
||||
self.width = self.screen_width * 0.2
|
||||
self.width = math.floor(self.screen_width * 0.2)
|
||||
end
|
||||
if self.value_table then
|
||||
self.value_index = self.value_index or 1
|
||||
@@ -116,7 +116,7 @@ function NumberPickerWidget:paintWidget()
|
||||
}
|
||||
|
||||
local empty_space = VerticalSpan:new{
|
||||
width = self.screen_height * 0.01
|
||||
width = math.ceil(self.screen_height * 0.01)
|
||||
}
|
||||
local value = self.value
|
||||
if not self.value_table then
|
||||
|
||||
@@ -195,8 +195,8 @@ function OPDSBrowser:addNewCatalog()
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
}
|
||||
UIManager:show(self.add_server_dialog)
|
||||
self.add_server_dialog:onShowKeyboard()
|
||||
@@ -245,8 +245,8 @@ function OPDSBrowser:editCalibreServer()
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
}
|
||||
UIManager:show(self.add_server_dialog)
|
||||
self.add_server_dialog:onShowKeyboard()
|
||||
@@ -792,8 +792,8 @@ function OPDSBrowser:editOPDSServer(item)
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
}
|
||||
UIManager:show(self.edit_server_dialog)
|
||||
self.edit_server_dialog:onShowKeyboard()
|
||||
|
||||
@@ -28,7 +28,7 @@ function OpenWithDialog:init()
|
||||
|
||||
self.radio_button_table = RadioButtonTable:new{
|
||||
radio_buttons = self.radio_buttons,
|
||||
width = self.width * 0.9,
|
||||
width = math.floor(self.width * 0.9),
|
||||
focused = true,
|
||||
scroll = false,
|
||||
parent = self,
|
||||
@@ -45,8 +45,8 @@ function OpenWithDialog:init()
|
||||
end
|
||||
end,
|
||||
|
||||
width = self.width * 0.9,
|
||||
max_width = self.width * 0.9 - 2*Size.border.window,
|
||||
width = math.floor(self.width * 0.9),
|
||||
max_width = math.floor(self.width * 0.9 - 2 * Size.border.window),
|
||||
height = self.height,
|
||||
face = self.face,
|
||||
|
||||
@@ -55,7 +55,7 @@ function OpenWithDialog:init()
|
||||
self._always_file_toggle = LeftContainer:new{
|
||||
bordersize = 0,
|
||||
dimen = Geom:new{
|
||||
w = self.width * 0.9,
|
||||
w = math.floor(self.width * 0.9),
|
||||
h = self._check_file_button:getSize().h,
|
||||
},
|
||||
self._check_file_button,
|
||||
@@ -71,8 +71,8 @@ function OpenWithDialog:init()
|
||||
end
|
||||
end,
|
||||
|
||||
width = self.width * 0.9,
|
||||
max_width = self.width * 0.9 - 2*Size.border.window,
|
||||
width = math.floor(self.width * 0.9),
|
||||
max_width = math.floor(self.width * 0.9 - 2 * Size.border.window),
|
||||
height = self.height,
|
||||
face = self.face,
|
||||
|
||||
@@ -81,7 +81,7 @@ function OpenWithDialog:init()
|
||||
self._always_global_toggle = LeftContainer:new{
|
||||
bordersize = 0,
|
||||
dimen = Geom:new{
|
||||
w = self.width * 0.9,
|
||||
w = math.floor(self.width * 0.9),
|
||||
h = self._check_global_button:getSize().h,
|
||||
},
|
||||
self._check_global_button,
|
||||
@@ -115,7 +115,7 @@ function OpenWithDialog:init()
|
||||
LineWidget:new{
|
||||
background = Blitbuffer.COLOR_DARK_GRAY,
|
||||
dimen = Geom:new{
|
||||
w = self.width * 0.9,
|
||||
w = math.floor(self.width * 0.9),
|
||||
h = Size.line.medium,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -280,7 +280,7 @@ function SortWidget:init()
|
||||
width = self.width_widget * 22 / 100,
|
||||
}
|
||||
local button_vertical_line = LineWidget:new{
|
||||
dimen = Geom:new{ w = Size.line.thick, h = self.item_height * 1.25 },
|
||||
dimen = Geom:new{ w = Size.line.thick, h = math.floor(self.item_height * 1.25) },
|
||||
background = Blitbuffer.COLOR_DARK_GRAY,
|
||||
style = "solid",
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ local SpinWidget = InputContainer:new{
|
||||
title_text = "",
|
||||
title_face = Font:getFace("x_smalltfont"),
|
||||
info_text = nil,
|
||||
width = Screen:getWidth() * 0.95,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = Screen:getHeight(),
|
||||
value_table = nil,
|
||||
value_index = nil,
|
||||
@@ -80,7 +80,7 @@ function SpinWidget:update()
|
||||
local picker_update_callback = function() end
|
||||
local value_widget = NumberPickerWidget:new{
|
||||
show_parent = self,
|
||||
width = self.screen_width * 0.2,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
value = self.value,
|
||||
value_table = self.value_table,
|
||||
value_index = self.value_index,
|
||||
@@ -199,14 +199,14 @@ function SpinWidget:update()
|
||||
TextBoxWidget:new{
|
||||
text = self.info_text,
|
||||
face = Font:getFace("x_smallinfofont"),
|
||||
width = self.width * 0.9,
|
||||
width = math.floor(self.width * 0.9),
|
||||
}
|
||||
})
|
||||
end
|
||||
table.insert(vgroup, CenterContainer:new{
|
||||
dimen = Geom:new{
|
||||
w = self.width,
|
||||
h = value_group:getSize().h + self.screen_height * 0.1,
|
||||
h = value_group:getSize().h + math.floor(self.screen_height * 0.1),
|
||||
},
|
||||
value_group
|
||||
})
|
||||
|
||||
@@ -37,7 +37,7 @@ function TimeWidget:init()
|
||||
self.light_bar = {}
|
||||
self.screen_width = Screen:getWidth()
|
||||
self.screen_height = Screen:getHeight()
|
||||
self.width = self.screen_width * 0.95
|
||||
self.width = math.floor(self.screen_width * 0.95)
|
||||
if Device:hasKeys() then
|
||||
self.key_events = {
|
||||
Close = { {"Back"}, doc = "close time widget" }
|
||||
@@ -62,7 +62,7 @@ end
|
||||
function TimeWidget:update()
|
||||
local hour_widget = NumberPickerWidget:new{
|
||||
show_parent = self,
|
||||
width = self.screen_width * 0.2,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
value = self.hour,
|
||||
value_min = 0,
|
||||
value_max = self.hour_max,
|
||||
@@ -71,7 +71,7 @@ function TimeWidget:update()
|
||||
}
|
||||
local min_widget = NumberPickerWidget:new{
|
||||
show_parent = self,
|
||||
width = self.screen_width * 0.2,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
value = self.min,
|
||||
value_min = 0,
|
||||
value_max = 59,
|
||||
@@ -83,7 +83,7 @@ function TimeWidget:update()
|
||||
alignment = "center",
|
||||
face = self.title_face,
|
||||
bold = true,
|
||||
width = self.screen_width * 0.2,
|
||||
width = math.floor(self.screen_width * 0.2),
|
||||
}
|
||||
local time_group = HorizontalGroup:new{
|
||||
align = "center",
|
||||
@@ -101,7 +101,7 @@ function TimeWidget:update()
|
||||
text = self.title_text,
|
||||
face = self.title_face,
|
||||
bold = true,
|
||||
max_width = self.screen_width * 0.95 - closebutton:getSize().w,
|
||||
max_width = math.floor(self.screen_width * 0.95) - closebutton:getSize().w,
|
||||
},
|
||||
}
|
||||
local time_line = LineWidget:new{
|
||||
@@ -158,8 +158,8 @@ function TimeWidget:update()
|
||||
time_line,
|
||||
CenterContainer:new{
|
||||
dimen = Geom:new{
|
||||
w = self.screen_width * 0.95,
|
||||
h = time_group:getSize().h * 1.2,
|
||||
w = math.floor(self.screen_width * 0.95),
|
||||
h = math.floor(time_group:getSize().h * 1.2),
|
||||
},
|
||||
time_group
|
||||
},
|
||||
|
||||
@@ -484,8 +484,8 @@ function TouchMenu:init()
|
||||
local up_button = IconButton:new{
|
||||
icon_file = "resources/icons/appbar.chevron.up.png",
|
||||
show_parent = self.show_parent,
|
||||
padding_left = footer_width*0.33*0.1,
|
||||
padding_right = footer_width*0.33*0.1,
|
||||
padding_left = math.floor(footer_width*0.33*0.1),
|
||||
padding_right = math.floor(footer_width*0.33*0.1),
|
||||
callback = function()
|
||||
self:backToUpperMenu()
|
||||
end,
|
||||
@@ -493,15 +493,15 @@ function TouchMenu:init()
|
||||
local footer_height = up_button:getSize().h + Size.line.thick
|
||||
self.footer = HorizontalGroup:new{
|
||||
LeftContainer:new{
|
||||
dimen = Geom:new{ w = footer_width*0.33, h = footer_height},
|
||||
dimen = Geom:new{ w = math.floor(footer_width*0.33), h = footer_height},
|
||||
up_button,
|
||||
},
|
||||
CenterContainer:new{
|
||||
dimen = Geom:new{ w = footer_width*0.33, h = footer_height},
|
||||
dimen = Geom:new{ w = math.floor(footer_width*0.33), h = footer_height},
|
||||
self.page_info,
|
||||
},
|
||||
RightContainer:new{
|
||||
dimen = Geom:new{ w = footer_width*0.33, h = footer_height},
|
||||
dimen = Geom:new{ w = math.floor(footer_width*0.33), h = footer_height},
|
||||
self.device_info,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,8 +536,8 @@ function Wikipedia:addImages(page, lang, more_images, image_size_factor, hi_imag
|
||||
local height = wimage.height or 100
|
||||
-- Give a little boost in size to thin images
|
||||
if width < height / 2 or height < width / 2 then
|
||||
width = width * 1.3
|
||||
height = height * 1.3
|
||||
width = math.floor(width * 1.3)
|
||||
height = math.floor(height * 1.3)
|
||||
end
|
||||
width = math.ceil(width * image_size_factor)
|
||||
height = math.ceil(height * image_size_factor)
|
||||
|
||||
Submodule platform/android/luajit-launcher updated: 5cd2962aae...8cb68727e2
@@ -141,7 +141,7 @@ function AutoSuspend:addToMainMenu(menu_items)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local curr_items = G_reader_settings:readSetting("auto_suspend_timeout_seconds") or 60*60
|
||||
local autosuspend_spin = SpinWidget:new {
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = curr_items / 60,
|
||||
value_min = 5,
|
||||
value_max = 240,
|
||||
@@ -173,7 +173,7 @@ function AutoSuspend:addToMainMenu(menu_items)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local curr_items = self.autoshutdown_timeout_seconds
|
||||
local autosuspend_spin = SpinWidget:new {
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = curr_items / 60 / 60,
|
||||
-- About a minute, good for testing and battery life fanatics.
|
||||
-- Just high enough to avoid an instant shutdown death scenario.
|
||||
|
||||
@@ -120,7 +120,7 @@ function AutoTurn:addToMainMenu(menu_items)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local curr_items = G_reader_settings:readSetting("autoturn_timeout_seconds") or 30
|
||||
local autoturn_spin = SpinWidget:new {
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = curr_items,
|
||||
value_min = 0,
|
||||
value_max = 240,
|
||||
@@ -151,7 +151,7 @@ function AutoTurn:addToMainMenu(menu_items)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local curr_items = G_reader_settings:readSetting("autoturn_distance") or 1
|
||||
local autoturn_spin = SpinWidget:new {
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = curr_items,
|
||||
value_min = -20,
|
||||
value_max = 20,
|
||||
|
||||
@@ -422,7 +422,7 @@ function CoverBrowser:addToMainMenu(menu_items)
|
||||
-- value of 10 if it hasn't.
|
||||
local curr_items = BookInfoManager:getSetting("files_per_page") or 10
|
||||
local items = SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = curr_items,
|
||||
value_min = 4,
|
||||
value_max = 20,
|
||||
|
||||
@@ -377,8 +377,8 @@ function EvernoteExporter:login()
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.8,
|
||||
height = Screen:getHeight() * 0.4,
|
||||
width = math.floor(Screen:getWidth() * 0.8),
|
||||
height = math.floor(Screen:getHeight() * 0.4),
|
||||
}
|
||||
|
||||
UIManager:show(self.login_dialog)
|
||||
|
||||
@@ -97,7 +97,7 @@ function GoodreadsBook:genHeader(title)
|
||||
end
|
||||
|
||||
function GoodreadsBook:genBookInfoGroup()
|
||||
local split_span_width = self.screen_width * 0.05
|
||||
local split_span_width = math.floor(self.screen_width * 0.05)
|
||||
local img_width, img_height
|
||||
if Screen:getScreenMode() == "landscape" then
|
||||
img_width = Screen:scaleBySize(132)
|
||||
@@ -133,7 +133,7 @@ function GoodreadsBook:genBookInfoGroup()
|
||||
}
|
||||
)
|
||||
--span
|
||||
local span_author = VerticalSpan:new{ width = height * 0.1 }
|
||||
local span_author = VerticalSpan:new{ width = math.floor(height * 0.1) }
|
||||
table.insert(book_meta_info_group,
|
||||
CenterContainer:new{
|
||||
dimen = Geom:new{ w = width, h = Screen:scaleBySize(10) },
|
||||
@@ -218,7 +218,7 @@ function GoodreadsBook:genBookInfoGroup()
|
||||
book_meta_info_group,
|
||||
})
|
||||
return CenterContainer:new{
|
||||
dimen = Geom:new{ w = self.screen_width, h = self.screen_height * 0.35 },
|
||||
dimen = Geom:new{ w = self.screen_width, h = math.floor(self.screen_height * 0.35) },
|
||||
book_info_group,
|
||||
}
|
||||
end
|
||||
@@ -244,13 +244,13 @@ function GoodreadsBook:bookReview()
|
||||
ScrollHtmlWidget:new{
|
||||
html_body = self.dates.description,
|
||||
css = css,
|
||||
width = self.screen_width * 0.9,
|
||||
height = self.screen_height * 0.48,
|
||||
width = math.floor(self.screen_width * 0.9),
|
||||
height = math.floor(self.screen_height * 0.48),
|
||||
dialog = self,
|
||||
}
|
||||
}
|
||||
return CenterContainer:new{
|
||||
dimen = Geom:new{ w = self.screen_width, h = self.screen_height * 0.50 },
|
||||
dimen = Geom:new{ w = self.screen_width, h = math.floor(self.screen_height * 0.5) },
|
||||
book_meta_info_group,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -146,8 +146,8 @@ How to generate a key and a secret key:
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
input_type = "text",
|
||||
}
|
||||
UIManager:show(self.settings_dialog)
|
||||
|
||||
@@ -361,8 +361,8 @@ function KOSync:login()
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.8,
|
||||
height = Screen:getHeight() * 0.4,
|
||||
width = math.floor(Screen:getWidth() * 0.8),
|
||||
height = math.floor(Screen:getHeight() * 0.4),
|
||||
}
|
||||
|
||||
UIManager:show(self.login_dialog)
|
||||
|
||||
8
plugins/perceptionexpander.koplugin/main.lua
Executable file → Normal file
8
plugins/perceptionexpander.koplugin/main.lua
Executable file → Normal file
@@ -52,8 +52,8 @@ function PerceptionExpander:createUI(readSettings)
|
||||
|
||||
self.screen_width = Screen:getWidth()
|
||||
local screen_height = Screen:getHeight()
|
||||
local line_height = screen_height * 0.9
|
||||
local line_top_position = screen_height * 0.05
|
||||
local line_height = math.floor(screen_height * 0.9)
|
||||
local line_top_position = math.floor(screen_height * 0.05)
|
||||
|
||||
self.last_screen_mode = Screen:getScreenMode()
|
||||
if self.last_screen_mode == "landscape" then
|
||||
@@ -152,8 +152,8 @@ function PerceptionExpander:showSettingsDialog()
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.8,
|
||||
height = Screen:getHeight() * 0.3,
|
||||
width = math.floor(Screen:getWidth() * 0.8),
|
||||
height = math.floor(Screen:getHeight() * 0.3),
|
||||
}
|
||||
UIManager:show(self.settings_dialog)
|
||||
self.settings_dialog:onShowKeyboard()
|
||||
|
||||
@@ -789,7 +789,7 @@ The max value ensures a page you stay on for a long time (because you fell aslee
|
||||
callback = function(touchmenu_instance)
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
UIManager:show(SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = self.calendar_nb_book_spans,
|
||||
value_min = 1,
|
||||
value_max = 5,
|
||||
|
||||
@@ -47,7 +47,7 @@ function ReaderProgress:init()
|
||||
self.large_font_face = Font:getFace("largeffont")
|
||||
self.screen_width = Screen:getWidth()
|
||||
self.screen_height = Screen:getHeight()
|
||||
if Screen:getWidth() < Screen:getHeight() then
|
||||
if self.screen_width < self.screen_height then
|
||||
self.header_span = 25
|
||||
self.stats_span = 20
|
||||
else
|
||||
@@ -256,7 +256,7 @@ function ReaderProgress:genWeekStats(stats_day)
|
||||
LeftContainer:new{
|
||||
dimen = Geom:new{ w = self.screen_width , h = height / 3 },
|
||||
ProgressWidget:new{
|
||||
width = (self.screen_width * 0.005) + (self.screen_width * 0.9 * select_day_time / max_week_time),
|
||||
width = math.floor((self.screen_width * 0.005) + (self.screen_width * 0.9 * select_day_time / max_week_time)),
|
||||
height = Screen:scaleBySize(14),
|
||||
percentage = 1.0,
|
||||
ticks = nil,
|
||||
@@ -272,7 +272,7 @@ function ReaderProgress:genWeekStats(stats_day)
|
||||
end --for i=1
|
||||
table.insert(statistics_container, statistics_group)
|
||||
return CenterContainer:new{
|
||||
dimen = Geom:new{ w = self.screen_width * 1.1 , h = self.screen_height * 0.50 },
|
||||
dimen = Geom:new{ w = math.floor(self.screen_width * 1.1), h = math.floor(self.screen_height * 0.5) },
|
||||
statistics_container,
|
||||
}
|
||||
end
|
||||
@@ -365,7 +365,7 @@ function ReaderProgress:genSummaryDay(width)
|
||||
table.insert(statistics_group, span_group)
|
||||
table.insert(statistics_container, statistics_group)
|
||||
return CenterContainer:new{
|
||||
dimen = Geom:new{ w = self.screen_width , h = self.screen_height * 0.13 },
|
||||
dimen = Geom:new{ w = self.screen_width , h = math.floor(self.screen_height * 0.13) },
|
||||
statistics_container,
|
||||
}
|
||||
end
|
||||
@@ -490,7 +490,7 @@ function ReaderProgress:genSummaryWeek(width)
|
||||
table.insert(statistics_group, data_group)
|
||||
table.insert(statistics_container, statistics_group)
|
||||
return CenterContainer:new{
|
||||
dimen = Geom:new{ w = self.screen_width , h = self.screen_height * 0.10 },
|
||||
dimen = Geom:new{ w = self.screen_width , h = math.floor(self.screen_height * 0.10) },
|
||||
statistics_container,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ function Terminal:start()
|
||||
title = _("Enter a command and press \"Execute\""),
|
||||
input = self.command,
|
||||
para_direction_rtl = false, -- force LTR
|
||||
text_height = Screen:getHeight() * 0.4,
|
||||
text_height = math.floor(Screen:getHeight() * 0.4),
|
||||
input_type = "string",
|
||||
buttons = {{{
|
||||
text = _("Cancel"),
|
||||
|
||||
@@ -95,7 +95,7 @@ function TextEditor:getSubMenuItems()
|
||||
local SpinWidget = require("ui/widget/spinwidget")
|
||||
local font_size = self.font_size
|
||||
UIManager:show(SpinWidget:new{
|
||||
width = Screen:getWidth() * 0.6,
|
||||
width = math.floor(Screen:getWidth() * 0.6),
|
||||
value = font_size,
|
||||
value_min = 8,
|
||||
value_max = 26,
|
||||
|
||||
@@ -936,8 +936,8 @@ Restart KOReader after editing the config file.]]), BD.dirpath(DataStorage:getSe
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
input_type = "string",
|
||||
}
|
||||
UIManager:show(self.settings_dialog)
|
||||
@@ -976,8 +976,8 @@ function Wallabag:editClientSettings()
|
||||
},
|
||||
},
|
||||
},
|
||||
width = Screen:getWidth() * 0.95,
|
||||
height = Screen:getHeight() * 0.2,
|
||||
width = math.floor(Screen:getWidth() * 0.95),
|
||||
height = math.floor(Screen:getHeight() * 0.2),
|
||||
input_type = "string",
|
||||
}
|
||||
UIManager:show(self.client_settings_dialog)
|
||||
|
||||
@@ -36,7 +36,7 @@ describe("InputContainer widget", function()
|
||||
assert.is.same("bar", ic._ordered_touch_zones[2].def.id)
|
||||
assert.is.same("tap", ic._ordered_touch_zones[2].gs_range.ges)
|
||||
assert.is.same(0, ic._ordered_touch_zones[2].gs_range.range.x)
|
||||
assert.is.same(screen_height * 0.1, ic._ordered_touch_zones[2].gs_range.range.y)
|
||||
assert.is.same(math.floor(screen_height * 0.1), ic._ordered_touch_zones[2].gs_range.range.y)
|
||||
assert.is.same(screen_width / 2, ic._ordered_touch_zones[2].gs_range.range.w)
|
||||
assert.is.same(screen_height, ic._ordered_touch_zones[2].gs_range.range.h)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user