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

Android MauiIcon resizetizering issue #11159

Closed
Bohdandn opened this issue Nov 7, 2022 · 9 comments
Closed

Android MauiIcon resizetizering issue #11159

Bohdandn opened this issue Nov 7, 2022 · 9 comments
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer platform/android 🤖 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Milestone

Comments

@Bohdandn
Copy link

Bohdandn commented Nov 7, 2022

Description

MauiIcon on Android 8+ resizing wrongly scales foreground and "ForegroundScale" option that should fix it behaves unexpectedly.
Default project, default csproj, changes:
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" />

Main points:

  • I think it would be much better to generate icon similar to old Android icons by default, MAUI stretches FG to like 120% by default so it never fit
  • I found that ForegroundScale should fix it but it seems behave differently than supposed here and here
  • my maui-android version is - 6.0.541, there is no such in "Version with bug" selector

Here how it looks like:

Emulator: Nexus 6 API24
image

Emulator: Pixel 3 XL API33
image

ForegroundScale="0.65"
image

ForegroundScale="0.2"
image

ForegroundScale="0.1"
image

ForegroundScale="0.05" - looking to the trend I expected this one to finally fit...
image

Setting BaseSize="128,128" doesn't seem to change anything

Steps to Reproduce

  1. dotnet new maui
  2. replace icons (even with original one you will see that FG is too big)
  3. Run on android 8+

Link to public reproduction project repository

https://github.com/Bohdandn/simple-maui

Version with bug

6.0.486 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 8+

Did you find any workaround?

Use android native capabilities to set icon

Relevant log output

No response

@Bohdandn Bohdandn added the t/bug Something isn't working label Nov 7, 2022
@jsuarezruiz jsuarezruiz added the area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer label Nov 8, 2022
@Bohdandn
Copy link
Author

Bohdandn commented Nov 8, 2022

Checked after .net7 update (maui-* workloads - 7.0.49/7.0.100) - behavior still the same.
One more obvious note - scaled icon via ForegroundScale looks the same on iOS and old android

@PureWeen PureWeen added this to the Backlog milestone Nov 9, 2022
@ghost
Copy link

ghost commented Nov 9, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@tranb3r
Copy link

tranb3r commented Nov 23, 2022

Any update? Thanks
cc @mattleibow

@Mephisztoe
Copy link

I experimented with this option today using my iPhone after we had some weird issues with ForegroundScale.

My expectation was that a value of 1.0 means that my AppIcon has its full size as designed (100%) and gets reduced with values smaller than that (with 0.5 being half its original size).

However, the Resizetizer takes this input value and multiplies some main scale value with it.
This makes a value of 0.0 resulting in the icon vanishing.
However, a value of 0.5 actually doubles the size as it seems.

Also:
Whenever I enter a value with more than one decimal place (like 0.65 or 0.25), the AppIcon also vanishes. I had a look at the sources and there is nothing I could find that looks broken. The value is parsed into a Double first of all and later type casted into a Float. Nothing wrong there. However, I get only more or less predictable results when I enter values with only one decimal place and that's... weird.

Regarding iOS I'd say: Just don't use that option. Then the mechanism is ignored and the icon behaves as expected.

@tranb3r
Copy link

tranb3r commented Dec 20, 2022

Also: Whenever I enter a value with more than one decimal place (like 0.65 or 0.25), the AppIcon also vanishes. I had a look at the sources and there is nothing I could find that looks broken. The value is parsed into a Double first of all and later type casted into a Float. Nothing wrong there. However, I get only more or less predictable results when I enter values with only one decimal place and that's... weird.

There was an issue with the conversion of the double value, caused by incorrect culture being used.
So x0.65 could be interpreted as x65. While x0.6 would be x6.
I believe it has been fixed, but not released yet.

@Mashedpoturtles
Copy link

Also: Whenever I enter a value with more than one decimal place (like 0.65 or 0.25), the AppIcon also vanishes. I had a look at the sources and there is nothing I could find that looks broken. The value is parsed into a Double first of all and later type casted into a Float. Nothing wrong there. However, I get only more or less predictable results when I enter values with only one decimal place and that's... weird.

There was an issue with the conversion of the double value, caused by incorrect culture being used. So x0.65 could be interpreted as x65. While x0.6 would be x6. I believe it has been fixed, but not released yet.

how long usually can we expect a release for a fix for something like this?

@Zhanglirong-Winnie Zhanglirong-Winnie added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Jul 13, 2023
@ghost
Copy link

ghost commented Jul 13, 2023

Hi @Bohdandn. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 2.0. Not repro on android emulator API33 platform with sample project.
simple-maui.zip
API33-ForegroundScale="1"
API33-1
API33-ForegroundScale="0.65"
API33-0 65
API33-ForegroundScale="0.2"
API33-0 2
API33-ForegroundScale="0.1"
API24-0 1
API33-ForegroundScale="0.05"
API33-0 05

@tranb3r
Copy link

tranb3r commented Jul 13, 2023

Why is the icon zoomed-in when foregroundscale=1?
It seems like you have to set foregroundscale=0.65 to get something that looks ok.

@ghost ghost closed this as completed Jul 20, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 19, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer platform/android 🤖 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants