mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[RTL UI] update widgets and apps for UI mirroring
Small tweaks all around to handle UI mirroring: - swap existing symbols like arrows, or use alternative ones - rotate some images, like chevrons and dogear icons - flip some left and right swipe handling - flip some geometry arithmetic like tap on left or right side of page or dict window - use new ProgressWidget:getPercentageFromPosition() instead of geometry arithmetic - BD.wrap() some concatenated string bits, like in reader and menu footers - flip inverse_reading_order when UI is mirrored More specific tweaks: - ReaderGesture: reset some specific gestures when UI direction has changed (tap on top/bottom left/right corners, for bookmarks and FileManager "Plus menu"). - ReaderRolling: show markers on the correct side of page, in single or dual page mode. - KoptOptions: swap left and right icons in Alignment toggle - CheckMark: proper rendering in all 4 mirroring/rtl combinations. - VirtualKeyboard: forbid any mirroring - Move util.getMenuText into Menu.lua
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
local BD = require("ui/bidi")
|
||||
local ButtonDialog = require("ui/widget/buttondialog")
|
||||
local InputContainer = require("ui/widget/container/inputcontainer")
|
||||
local UIManager = require("ui/uimanager")
|
||||
@@ -28,6 +29,11 @@ function ReaderSearch:addToMainMenu(menu_items)
|
||||
end
|
||||
|
||||
function ReaderSearch:onShowFulltextSearchInput()
|
||||
local backward_text = "◁"
|
||||
local forward_text = "▷"
|
||||
if BD.mirroredUILayout() then
|
||||
backward_text, forward_text = forward_text, backward_text
|
||||
end
|
||||
self:onInput{
|
||||
title = _("Enter text to search for"),
|
||||
type = "text",
|
||||
@@ -40,14 +46,14 @@ function ReaderSearch:onShowFulltextSearchInput()
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = "◁",
|
||||
text = backward_text,
|
||||
callback = function()
|
||||
self:onShowSearchDialog(self.input_dialog:getInputText(), 1)
|
||||
self:closeInputDialog()
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = "▷",
|
||||
text = forward_text,
|
||||
is_enter_default = true,
|
||||
callback = function()
|
||||
self:onShowSearchDialog(self.input_dialog:getInputText(), 0)
|
||||
@@ -138,24 +144,33 @@ function ReaderSearch:onShowSearchDialog(text, direction)
|
||||
end
|
||||
end
|
||||
end
|
||||
local from_start_text = "▕◁"
|
||||
local backward_text = "◁"
|
||||
local forward_text = "▷"
|
||||
local from_end_text = "▷▏"
|
||||
if BD.mirroredUILayout() then
|
||||
backward_text, forward_text = forward_text, backward_text
|
||||
-- Keep the LTR order of |< and >|:
|
||||
from_start_text, from_end_text = BD.ltr(from_end_text), BD.ltr(from_start_text)
|
||||
end
|
||||
self.search_dialog = ButtonDialog:new{
|
||||
-- alpha = 0.7,
|
||||
buttons = {
|
||||
{
|
||||
{
|
||||
text = "▕◁",
|
||||
text = from_start_text,
|
||||
callback = do_search(self.searchFromStart, text),
|
||||
},
|
||||
{
|
||||
text = "◁",
|
||||
text = backward_text,
|
||||
callback = do_search(self.searchNext, text, 1),
|
||||
},
|
||||
{
|
||||
text = "▷",
|
||||
text = forward_text,
|
||||
callback = do_search(self.searchNext, text, 0),
|
||||
},
|
||||
{
|
||||
text = "▷▏",
|
||||
text = from_end_text,
|
||||
callback = do_search(self.searchFromEnd, text),
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user