Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyValuePage: enhance TitleBar #9713

Merged
merged 2 commits into from Nov 1, 2022
Merged

Conversation

hius07
Copy link
Member

@hius07 hius07 commented Oct 30, 2022

Add left button.
Allow title centering (may be useful with the left button).

May looks like:
01


This change is Reviewable

Comment on lines 455 to 456
left_icon_tap_callback = function() self:onLeftButtonTap() end,
left_icon_hold_callback = function() self:onLeftButtonHold() end,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we said "do as for Menu, for consistency" :) But:

Somehow, the function KeyValuePage:onLeftButtonTap() -- to be overriden and implemented by the caller we do override for ToC and Bookmark feels a bit convoluted: you have to create the Menu (toc_menu = Menu:new), then hack that toc_menu. If we want to do the simple 1-step UIManager:show(KeyValuePage:new{...}), we can't override them: we need to split it into 3 steps local zzz = KeyValuePage:new{...} ; zzz:onLeftButtonTap = function()..end ; UIManager:show(zzz).

But here and in Menu, when we don't want/like to do it that way, we can just provide a left_icon_tap_callback that will override the need to hijack onLeftButtonTap().
So, this solution is fine, as it provides 2 ways to specify the action of the icons. One nice, and one convoluted (may be for historical reasons, the way ToC and Bookmarks were done ?). Dunno if there's any real reason to keep the convoluted one :) But ok anyway if we don't want to change too many things.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently 5 modules set left_icon_tap_callback and 6 modules provide onLeftButtonTap.
For the future cleanup in favor of left_icon_tap_callback.

@poire-z poire-z added this to the 2022.11 milestone Nov 1, 2022
@Frenzie Frenzie merged commit e3f134d into koreader:master Nov 1, 2022
@hius07 hius07 deleted the KVP-TitleBar branch November 1, 2022 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants