Skip to content

Screensaver: improve sleep screen message - #13571

Merged
hius07 merged 2 commits into
koreader:masterfrom
hius07:sleep-screen-message
Apr 14, 2025
Merged

Screensaver: improve sleep screen message#13571
hius07 merged 2 commits into
koreader:masterfrom
hius07:sleep-screen-message

Conversation

@hius07

@hius07 hius07 commented Apr 12, 2025

Copy link
Copy Markdown
Member

(1) Because of long description, the input dialog buttons were overlapped with the keyboard.
Move description to the info message.
(2) Allow multiline messages. Closes #13559.

1

2

3


This change is Reviewable

@Commodore64user

Commodore64user commented Apr 12, 2025

Copy link
Copy Markdown
Member

Have a look at the infomessage class so that you avoid running through the force_one_line loop (when the message is in the middle only)

https://github.com/koreader/koreader/blob/master/frontend/ui/widget/infomessage.lua#L182

@hius07

hius07 commented Apr 12, 2025

Copy link
Copy Markdown
Member Author

If you want one line, don't press Enter.

@Commodore64user

Copy link
Copy Markdown
Member

If you want one line, don't press Enter.

What i mean is, you might be unnecessarily running through the whole loop every time you lock the device, but you don't need to, as you would expect to not be a single line

@hius07

hius07 commented Apr 12, 2025

Copy link
Copy Markdown
Member Author

The "whole loop" of what?

@Commodore64user

Commodore64user commented Apr 12, 2025

Copy link
Copy Markdown
Member

@hius07

hius07 commented Apr 12, 2025

Copy link
Copy Markdown
Member Author

Yes, we reduce font size of long messages to fit to the screen.

@Commodore64user

Commodore64user commented Apr 12, 2025

Copy link
Copy Markdown
Member

You are doing it as well with the middle sleep screen message, that's what i am trying to tell you... avoid running the loop if you have multiple lines as it goes against force_one_line #13026 and #13337

@hius07

hius07 commented Apr 12, 2025

Copy link
Copy Markdown
Member Author

avoid running the loop if you have multiple lines

But I need to fit to the screen, even with multiple lines.

max_height = Screen:getHeight() * 0.95

force_one_line is not applicable if I pressed Enter.

@Commodore64user

Copy link
Copy Markdown
Member

Just saying make sure you don't end up here

https://github.com/koreader/koreader/blob/master/frontend/ui/widget/infomessage.lua#L182

@hius07

hius07 commented Apr 12, 2025

Copy link
Copy Markdown
Member Author

Sorry for my bad English, I don't understand you.
What changes do you propose to make to this PR?
(Note that multi lines sleep screen message is not a new feature)

@Commodore64user

Commodore64user commented Apr 12, 2025

Copy link
Copy Markdown
Member

Force-one-line is true for the middle message, but a multi line goes against that… so you are unnecessarily running the loop that reduces the font size to fit the text in one line, even though it will end up not being a single line… ever, my suggestion is that you don’t set max-height to that of force-one-line, i.e enter the else instead

if message_pos == "middle" then
message_widget = InfoMessage:new{
text = screensaver_message,
readonly = true,
dismissable = false,
force_one_line = true,
}

Does that make sense?

@mergen3107

Copy link
Copy Markdown
Contributor

Sorry guys, a side question.
Any chance of getting all this text on lock screen justified?

@hius07

hius07 commented Apr 13, 2025

Copy link
Copy Markdown
Member Author

unnecessarily running the loop that reduces the font size to fit the text in one line

The loop is required to fit the text in the max height.
For middle position and no "break-line" chars in the text, the max height is, roughly, a line height.
Otherwise, max height is, roughly, a screen height.
The loop is required in any case.

If the text contains "line-break" chars, force_one_line is not applicable:

if self.force_one_line and not self.text:find("\n") then

@hius07

hius07 commented Apr 13, 2025

Copy link
Copy Markdown
Member Author

Any chance of getting all this text on lock screen justified?

Yes. What does your long text contain?

@mergen3107

Copy link
Copy Markdown
Contributor

Yes. What does your long text contain?

@hius07
Sorry, I totally confused terms.

I wanted to ask about centered text instead of justified.

On the screensaver screenshot in the OP, is it possible to have the text in each line centered?

@hius07

hius07 commented Apr 13, 2025

Copy link
Copy Markdown
Member Author

is it possible to have the text in each line centered?

The lines are centered when the message position is "top" or "bottom".

@mergen3107

Copy link
Copy Markdown
Contributor

But for vertically centered position horizontal position is not available? :D

Seems weird, but OK

@Commodore64user

Copy link
Copy Markdown
Member

When I say avoid the loop, what i mean is avoid running it under force_one_line. I am NOT saying you should not keep the 95% thing. If the break line meets the not self.text:find("\n") great. That is what i have been trying to say. Make sure that you don't enter this case.

@hius07
hius07 merged commit dee2411 into koreader:master Apr 14, 2025
@hius07
hius07 deleted the sleep-screen-message branch April 14, 2025 17:51
@hius07 hius07 added this to the 2025.05 milestone Apr 14, 2025
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
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.

Sleep Screen Message Multi-Line

4 participants