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

[resources] Update resource density-based lookup to be equal with the android logic #4969

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

terrakok
Copy link
Collaborator

@terrakok terrakok commented Jun 14, 2024

In general, Android prefers scaling down a larger original image to scaling up a smaller original image: https://developer.android.com/guide/topics/resources/providing-resources#BestMatch

Fixes #4368

Release Notes

Highlights - Resources

  • If there is no resource with suitable density, use resource with the most suitable density, otherwise use default (similar to the Android logic)

@terrakok terrakok requested a review from igordmn June 14, 2024 13:25
@igordmn
Copy link
Collaborator

igordmn commented Jun 17, 2024

Update resource filtering and add density-based lookup to be equal with the android logic

Better to be more specific. Something like:

If there is no resource with suitable density, use resource with the most suitable density, otherwise use default (similar to the Android logic)

@terrakok terrakok changed the title [resources] Update resource filtering and add density-based lookup [resources] If there is no resource with suitable density, use resource with the closest lower density, otherwise use default (similar to the Android logic) Jun 18, 2024
@terrakok terrakok changed the title [resources] If there is no resource with suitable density, use resource with the closest lower density, otherwise use default (similar to the Android logic) [resources] Update resource density-based lookup to be equal with the android logic Jun 18, 2024
@terrakok terrakok requested a review from igordmn June 18, 2024 10:44
… android logic

In general, Android prefers scaling down a larger original image to scaling up a smaller original image: https://developer.android.com/guide/topics/resources/providing-resources#BestMatch
Copy link
Collaborator

@igordmn igordmn left a comment

Choose a reason for hiding this comment

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

Looks good, could you also change the PR description?

@terrakok terrakok merged commit 5c141b5 into master Jun 20, 2024
@terrakok terrakok deleted the k.tskh/density-q branch June 20, 2024 11:57
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.

[Resource] Drawable scaling from other density-qualified resource
2 participants