mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
SortWidget: Preserve the cancel's button highlight when changing its icon
setIcon recreates the frame without preserving the current frame's invert status (which is arguably a bug, but button is so ubuquitous that I dare not touch that behavior...). So, instead, rely on the rarely used preselect flag to preserve it.
This commit is contained in:
@@ -438,11 +438,14 @@ function SortWidget:_populateItems()
|
||||
chevron_first, chevron_last = chevron_last, chevron_first
|
||||
end
|
||||
if self.marked > 0 then
|
||||
-- setIcon will recreate the frame, but we want to preserve the focus inversion
|
||||
self.footer_cancel.preselect = self.footer_cancel.frame.invert
|
||||
self.footer_cancel:setIcon("cancel", self.footer_button_width)
|
||||
self.footer_cancel.callback = function() self:onCancel() end
|
||||
self.footer_first_up:setIcon("move.up", self.footer_button_width)
|
||||
self.footer_last_down:setIcon("move.down", self.footer_button_width)
|
||||
else
|
||||
self.footer_cancel.preselect = self.footer_cancel.frame.invert
|
||||
self.footer_cancel:setIcon("exit", self.footer_button_width)
|
||||
self.footer_cancel.callback = function() self:onClose() end
|
||||
self.footer_first_up:setIcon(chevron_first, self.footer_button_width)
|
||||
|
||||
Reference in New Issue
Block a user