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

Fix & enable HW rotation on notched devices on P+ #288

Merged
merged 5 commits into from
Jan 13, 2021

Conversation

NiLuJe
Copy link
Member

@NiLuJe NiLuJe commented Jan 12, 2021

Looks simple enough (he said, hopefully ;p) :).


This change is Reviewable

Turns out getMetrics/getSize takes care of the grunt work for us.
(The updated methods in SDK 30 appear to follow a similar trend, too).
And keep stuff in alphabetical order
@NiLuJe
Copy link
Member Author

NiLuJe commented Jan 13, 2021

Ah. Knew it was too easy: this excluded the status bar area, too.

@NiLuJe NiLuJe changed the title Fix & enable HW rotation on notched device on P+ Fix & enable HW rotation on notched devices on P+ Jan 13, 2021
Copy link
Member

@pazos pazos left a comment

Choose a reason for hiding this comment

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

As you know getScreenSizeWithConstraints(activity) only works on pre KitKat devices (apis 17 & 18) and it is completely deprecated in immersive mode (apis19+).

Since legacy APIs doesn't use HW rotation I think it is safe to ignore getScreenAvailableWidth et al.

@NiLuJe
Copy link
Member Author

NiLuJe commented Jan 13, 2021

Note to self: nav bar, not status bar.

@NiLuJe
Copy link
Member Author

NiLuJe commented Jan 13, 2021

As you know getScreenSizeWithConstraints(activity) only works on pre KitKat devices (apis 17 & 18) and it is completely deprecated in immersive mode (apis19+).

Since legacy APIs doesn't use HW rotation I think it is safe to ignore getScreenAvailableWidth et al.

Err, the only thing it does is using getMetrics instead of getRealMetrics. AFAICT, that's very much not deprecated until SDK 30, and it indeed worked perfectly fine on my API 29 phone. It just happens to also exclude the nav bar, which is a problem ^^.

Speaking of, the SDK 30 variant has a code excerpt to do that manually, and it appears to be able to tell display cutouts apart from the nav bar ;).

@pazos
Copy link
Member

pazos commented Jan 13, 2021

@NiLuJe: You're right. I was talking about our usage :P. As we always enable immersive mode in KitKat+ devices, we don't need getMetrics there. It could be relevant for #238, but there're better ways to retrieve screen size on each surface change

But having that available doesn't hurt either. 👍

@NiLuJe NiLuJe merged commit e42e173 into koreader:master Jan 13, 2021
Frenzie added a commit to Frenzie/koreader that referenced this pull request Jan 14, 2021
Frenzie added a commit to koreader/koreader that referenced this pull request Jan 14, 2021
Frenzie added a commit to Frenzie/koreader that referenced this pull request Jan 16, 2021
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.

2 participants