DictQuickLookup: various tweaks

- Rework widget layout to avoid implicit (and wrong)
  sizing, using proper padding/margins and correct
  measurements of components.
- Adjust lookup word font size so it's not smaller
  than the definition.
- Tweak small window positionning: keep it centered
  if possible, only move it to keep the highlighted
  word shown when we can.
- Large window: adjust to screen size correctly,
  leaving room for footer.
- Always have a "Close" button at bottom right.
  Former always displayed button "Follow link" will
  be added as a 3rd row in the rare case we select
  a word in a link.
- Replace "tap on lookup word to edit and redo the
  query" with an icon on the right: tap on it to
  edit the queries word, long-press to edit the
  current result word. Only close the current dict
  window when lookup is launched.
- Remove feature "tap on title to set current dict
  as the default dict for this document", as it didn't
  really work, and it was bad UX.
This commit is contained in:
poire-z
2020-12-22 18:45:34 +01:00
parent b66d0be3f9
commit c98dfef7fc
4 changed files with 414 additions and 197 deletions

View File

@@ -853,7 +853,6 @@ function ReaderDictionary:showDict(word, results, box, link)
selected_link = link,
results = results,
dictionary = self.default_dictionary,
width = Screen:getWidth() - Screen:scaleBySize(80),
word_box = box,
-- differentiate between dict and wiki
is_wiki = self.is_wiki,
@@ -1009,6 +1008,7 @@ function ReaderDictionary:downloadDictionary(dict, download_location, continue)
end
end
--[[ No longer used
function ReaderDictionary:onUpdateDefaultDict(dict)
logger.dbg("make default dictionary:", dict)
self.default_dictionary = dict
@@ -1019,6 +1019,7 @@ function ReaderDictionary:onUpdateDefaultDict(dict)
})
return true
end
]]--
function ReaderDictionary:onReadSettings(config)
self.default_dictionary = config:readSetting("default_dictionary")