2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

UX minor fixes (#12374)

This commit is contained in:
hius07 2024-08-19 08:10:14 +03:00 committed by GitHub
parent f0c9a642d1
commit ed9cde8feb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 35 additions and 23 deletions

View File

@ -153,9 +153,16 @@ function BookInfo:show(doc_settings_or_file, book_props)
})
end
-- pages
local is_doc = self.document and true or false
table.insert(kv_pairs, { self.prop_text["pages"], book_props["pages"] or _("N/A"), separator = true })
-- Current page
if self.document then
local lines_nb, words_nb = self.ui.view:getCurrentPageLineWordCounts()
local text = lines_nb == 0 and _("number of lines and words not available")
or T(N_("1 line", "%1 lines", lines_nb), lines_nb) .. ", " .. T(N_("1 word", "%1 words", words_nb), words_nb)
table.insert(kv_pairs, { _("Current page:"), text, separator = true })
end
-- Summary section
local summary = has_sidecar and doc_settings_or_file:readSetting("summary") or {}
local rating = summary.rating or 0
@ -165,15 +172,7 @@ function BookInfo:show(doc_settings_or_file, book_props)
table.insert(kv_pairs, { _("Rating:"), (""):rep(rating) .. (""):rep(self.rating_max - rating),
hold_callback = summary_hold_callback })
table.insert(kv_pairs, { _("Review:"), summary.note or _("N/A"),
hold_callback = summary_hold_callback, separator = is_doc })
-- Page section
if is_doc then
local lines_nb, words_nb = self.ui.view:getCurrentPageLineWordCounts()
local text = lines_nb == 0 and _("number of lines and words not available")
or T(N_("1 line", "%1 lines", lines_nb), lines_nb) .. ", " .. T(N_("1 word", "%1 words", words_nb), words_nb)
table.insert(kv_pairs, { _("Current page:"), text })
end
hold_callback = summary_hold_callback })
local KeyValuePage = require("ui/widget/keyvaluepage")
self.kvp_widget = KeyValuePage:new{

View File

@ -257,7 +257,7 @@ function ReaderBookmark:genShowInItemsMenuItems(value)
local strings = {
text = _("highlighted text"),
all = _("highlighted text and note"),
note = _("note, or highlighted text"),
note = _("note if set, otherwise highlighted text"),
}
if value == nil then
value = G_reader_settings:readSetting("bookmarks_items_text_type", "note")

View File

@ -61,6 +61,7 @@ local Button = InputContainer:extend{
-- 'max_width' to allow it to be smaller if text or icon is smaller.
width = nil,
max_width = nil,
height = nil, -- if not set, depends on the font size
avoid_text_truncation = true,
text_font_face = "cfont",
text_font_size = 20,
@ -98,7 +99,7 @@ function Button:init()
-- We will give the button the height it would have if no such tweaks were
-- made. LeftContainer and CenterContainer will vertically center the
-- TextWidget or TextBoxWidget in that height (hopefully no ink will overflow)
local reference_height
local reference_height = self.height
if self.text then
local text = self.checked_func == nil and self.text or self:getDisplayText()
local fgcolor = self.enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY
@ -115,7 +116,7 @@ function Button:init()
bold = self.text_font_bold,
face = face,
}
reference_height = self.label_widget:getSize().h
reference_height = reference_height or self.label_widget:getSize().h
if not self.label_widget:isTruncated() then
local checkmark_width = 0
if self.checked_func and not self.checked_func() then

View File

@ -84,6 +84,7 @@ function ButtonTable:init()
allow_hold_when_disabled = btn_entry.allow_hold_when_disabled,
vsync = btn_entry.vsync,
width = btn_entry.width or default_button_width,
height = btn_entry.height,
bordersize = 0,
margin = 0,
padding = Size.padding.buttontable, -- a bit taller than standalone buttons, for easier tap

View File

@ -52,9 +52,10 @@ function SkimToWidget:init()
local frame_border_size = Size.border.window
local button_span_unit_width = Size.span.horizontal_small
local button_font_size, frame_padding, frame_width, inner_width, nb_buttons, larger_span_units, progress_bar_height
local button_font_size, button_height, frame_padding, frame_width, inner_width, nb_buttons, larger_span_units, progress_bar_height
if full_mode then
button_font_size = nil -- use default
button_height = nil
frame_padding = Size.padding.fullscreen -- large padding for airy feeling
frame_width = math.floor(math.min(screen_width, screen_height) * 0.95)
inner_width = frame_width - 2 * (frame_border_size + frame_padding)
@ -62,7 +63,8 @@ function SkimToWidget:init()
larger_span_units = 3 -- 3 x small span width
progress_bar_height = Size.item.height_big
else
button_font_size = 14
button_font_size = 16
button_height = Screen:scaleBySize(32)
frame_padding = Size.padding.default
frame_width = screen_width + 2 * frame_border_size -- hide side borders
inner_width = frame_width - 2 * frame_padding
@ -95,6 +97,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
vsync = true,
callback = function()
@ -106,6 +109,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
vsync = true,
callback = function()
@ -117,6 +121,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
vsync = true,
callback = function()
@ -128,6 +133,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
vsync = true,
callback = function()
@ -146,6 +152,7 @@ function SkimToWidget:init()
padding = 0,
bordersize = 0,
width = button_width,
height = button_height,
show_parent = self,
callback = function()
self.callback_switch_to_goto()
@ -160,6 +167,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
vsync = true,
callback = function()
@ -183,6 +191,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
vsync = true,
callback = function()
@ -200,6 +209,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
vsync = true,
callback = function()
@ -217,6 +227,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
vsync = true,
callback = function()
@ -231,6 +242,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
vsync = true,
callback = function()
@ -247,6 +259,7 @@ function SkimToWidget:init()
text_font_size = button_font_size,
radius = 0,
width = button_width,
height = button_height,
show_parent = self,
callback = function()
self.ui:handleEvent(Event:new("ToggleBookmark"))
@ -337,11 +350,9 @@ function SkimToWidget:init()
bottom_buttons_row,
}
}
if full_mode then
self.movable = MovableContainer:new{
self.skimto_frame,
}
end
self[1] = WidgetContainer:new{
align = skim_dialog_position or "center",
dimen = Geom:new{
@ -349,7 +360,7 @@ function SkimToWidget:init()
w = screen_width,
h = screen_height,
},
self.movable or self.skimto_frame,
self.movable,
}
if Device:hasDPad() then