mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
CoverBrowser: Mosaic: only left-align for File browser
Left align partially filled rows for File browser/chooser, but have them centered for History and Favorites for a prettier look when only a few items are displayed.
This commit is contained in:
@@ -602,6 +602,7 @@ function CoverBrowser:setupFileManagerDisplayMode(display_mode)
|
||||
FileChooser._do_cover_images = nil
|
||||
FileChooser._do_filename_only = nil
|
||||
FileChooser._do_hint_opened = nil
|
||||
FileChooser._do_center_partial_rows = nil
|
||||
self:refreshFileManagerInstance(true)
|
||||
return
|
||||
end
|
||||
@@ -620,6 +621,8 @@ function CoverBrowser:setupFileManagerDisplayMode(display_mode)
|
||||
-- Set MosaicMenu behaviour:
|
||||
FileChooser._do_cover_images = display_mode ~= "mosaic_text"
|
||||
FileChooser._do_hint_opened = true -- dogear at bottom
|
||||
-- Don't have "../" centered in empty directories
|
||||
FileChooser._do_center_partial_rows = false
|
||||
-- One could override default 3x3 grid here (put that as settings ?)
|
||||
-- FileChooser.nb_cols_portrait = 4
|
||||
-- FileChooser.nb_rows_portrait = 4
|
||||
@@ -638,6 +641,7 @@ function CoverBrowser:setupFileManagerDisplayMode(display_mode)
|
||||
FileChooser._do_hint_opened = true -- dogear at bottom
|
||||
end
|
||||
|
||||
|
||||
-- Replace this FileManager method with the one from CoverMenu
|
||||
-- (but first, make the original method saved here as local available
|
||||
-- to CoverMenu)
|
||||
@@ -684,7 +688,7 @@ local function _FileManagerHistory_updateItemTable(self)
|
||||
hist_menu._updateItemsBuildUI = MosaicMenu._updateItemsBuildUI
|
||||
-- Set MosaicMenu behaviour:
|
||||
hist_menu._do_cover_images = display_mode ~= "mosaic_text"
|
||||
-- no need for do_hint_opened with History
|
||||
hist_menu._do_center_partial_rows = true -- nicer looking when few elements
|
||||
|
||||
elseif display_mode == "list_image_meta" or display_mode == "list_only_meta" or
|
||||
display_mode == "list_image_filename" then -- list modes
|
||||
@@ -695,7 +699,6 @@ local function _FileManagerHistory_updateItemTable(self)
|
||||
-- Set ListMenu behaviour:
|
||||
hist_menu._do_cover_images = display_mode ~= "list_only_meta"
|
||||
hist_menu._do_filename_only = display_mode == "list_image_filename"
|
||||
-- no need for do_hint_opened with History
|
||||
|
||||
end
|
||||
hist_menu._do_hint_opened = BookInfoManager:getSetting("history_hint_opened")
|
||||
@@ -763,6 +766,7 @@ local function _FileManagerCollections_updateItemTable(self)
|
||||
coll_menu._updateItemsBuildUI = MosaicMenu._updateItemsBuildUI
|
||||
-- Set MosaicMenu behaviour:
|
||||
coll_menu._do_cover_images = display_mode ~= "mosaic_text"
|
||||
coll_menu._do_center_partial_rows = true -- nicer looking when few elements
|
||||
|
||||
elseif display_mode == "list_image_meta" or display_mode == "list_only_meta" or
|
||||
display_mode == "list_image_filename" then -- list modes
|
||||
|
||||
@@ -751,9 +751,10 @@ function MosaicMenu:_updateItemsBuildUI()
|
||||
table.insert(self.item_group, VerticalSpan:new{ width = self.item_margin })
|
||||
cur_row = HorizontalGroup:new{}
|
||||
-- Have items on the possibly non-fully filled last row aligned to the left
|
||||
table.insert(self.item_group, LeftContainer:new{
|
||||
local container = self._do_center_partial_rows and CenterContainer or LeftContainer
|
||||
table.insert(self.item_group, container:new{
|
||||
dimen = Geom:new{
|
||||
w = self.dimen.w - 2*self.item_margin,
|
||||
w = self.dimen.w,
|
||||
h = self.item_height
|
||||
},
|
||||
cur_row
|
||||
|
||||
Reference in New Issue
Block a user