fix: size wallpapers against the display's natural orientation - #295
Open
chunjiw wants to merge 1 commit into
Open
fix: size wallpapers against the display's natural orientation#295chunjiw wants to merge 1 commit into
chunjiw wants to merge 1 commit into
Conversation
Bnyro
reviewed
Sep 2, 2026
Comment on lines
+92
to
+93
| (context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager) | ||
| .getDisplay(Display.DEFAULT_DISPLAY) |
Member
There was a problem hiding this comment.
Looks like the DisplayManager way works for all Android versions, so why do we fall back to the WindowManager on old Android versions?
Bnyro
reviewed
Sep 2, 2026
Comment on lines
+92
to
+93
| (context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager) | ||
| .getDisplay(Display.DEFAULT_DISPLAY) |
Member
There was a problem hiding this comment.
Suggested change
| (context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager) | |
| .getDisplay(Display.DEFAULT_DISPLAY) | |
| context.getSystemService<DisplayManager>().getDisplay(Display.DEFAULT_DISPLAY) |
Member
|
Thanks for the PR, looks good overall 👍 |
Bnyro
reviewed
Sep 2, 2026
| metrics.widthPixels to metrics.heightPixels | ||
| } | ||
|
|
||
| return when (getDisplayRotation(context)) { |
Member
There was a problem hiding this comment.
Suggested change
| return when (getDisplayRotation(context)) { | |
| // `width` and `height` depend on the current screen orientation. To get the real metrics, | |
| // we additionally check the current rotation of the display. | |
| return when (getDisplayRotation(context)) { |
Please add a short comment here to explain what we're doing, e.g. as the one proposed here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
getMetrics()returns the current window bounds, which rotate with the device — but a wallpaper is stored once and reused for every rotation, so it has to be measured in the display's natural orientation.Applied from a landscape device, the image is cropped to a landscape aspect and
suggestDesiredDimensions()is told the wallpaper is landscape too; the home screen then scales that to cover a portrait screen and crops it a second time. The two crops multiply into a small, heavily magnified patch instead of the expected centre slice. This mostly hits the background changer, which fires whichever way the phone happens to be held.Un-rotates the bounds via
Display.rotationrather thanmin/max, so landscape-natural tablets stay correct.Fixes #293, fixes #257.