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

Crop the notification thumbnail in 1:1 mode instead of stretching it #8533

Merged
merged 6 commits into from
Jul 13, 2022
Merged

Crop the notification thumbnail in 1:1 mode instead of stretching it #8533

merged 6 commits into from
Jul 13, 2022

Conversation

OxygenCobalt
Copy link
Contributor

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

While using the whole thumbnail for the notification's large icon works fine on Android 10 and below, it breaks down on Android 11/12, in which it leaves a large amount of whitespace. The 1:1 option is also not ideal here, as it distorts the thumbnail in an unappealing manner.

This PR changes the scaling mechanism used to crop the thumbnail to a 1:1 ratio instead of stretching it. More specifically, it picks the smaller dimension from the thumbnail and then scales the larger dimension down to fit, cropping the thumbnail to the center in the process. I feel this is much better than how the option currently works.

Before/After Screenshots/Screen Record

  • Before:
    image

  • After:
    image

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

Change the bitmap transformation strategy when a 1:1 aspect ratio is
enabled to not stretch the bitmap but rather crop it.

On Android 11/12, the way the whole thumbnail was used for the
notification icon was not ideal, however the setting to toggle a 1:1
(as it states in settings) resulted in distortions.

Fix this by simply cropping the bitmap.
@opusforlife2 opusforlife2 added GUI Issue is related to the graphical user interface player notification Anything to do with the MediaStyle notification labels Jun 25, 2022
@OxygenCobalt
Copy link
Contributor Author

By the way @opusforlife2, should I update the setting string to remove the "May cause distortions" portion? Or will this be done by the maintainers?

@opusforlife2
Copy link
Collaborator

Go ahead. 👍

Update the 1:1 mode strings to remove mentions of scaling or
distortions, as those no longer apply.
@OxygenCobalt
Copy link
Contributor Author

Done. This can probably be merged now @opusforlife2.

@sonarcloud
Copy link

sonarcloud bot commented Jul 13, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@Stypox Stypox 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 to me. Thank you!

@Stypox Stypox merged commit 6f7298b into TeamNewPipe:dev Jul 13, 2022
@AudricV
Copy link
Member

AudricV commented Jul 13, 2022

Note: we have to delete translations of the strings updated in this PR in order to apply their changes in translations.

@Stypox
Copy link
Member

Stypox commented Jul 13, 2022

Uhm, no? Weblate already takes care of asking translators to re-translate outdated strings, if I remember correctly.
Also, the new meaning is not so different from the previous, so it's better to keep translations even if they are not the most up-to-date.

@Stypox Stypox mentioned this pull request Aug 27, 2022
9 tasks
@OxygenCobalt OxygenCobalt deleted the crop-notification-large-icon branch April 24, 2023 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI Issue is related to the graphical user interface player notification Anything to do with the MediaStyle notification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crop the notification thumbnail in 1:1 mode instead of stretching it
4 participants