maui icon indicating copy to clipboard operation
maui copied to clipboard

[Android] Fix double conversion with FromPixels

Open filipnavara opened this issue 1 year ago • 3 comments

Description of Change

ItemContentView on Android was calling Convert.FromPixel on the value passed to MeasureVirtualView, which then did the conversion again with ToDouble extension method:

https://github.com/dotnet/maui/blob/8b44525b87a790e0fe0f056839f8d575314d5467/src/Core/src/Handlers/ViewHandlerExtensions.Android.cs#L54-L55

https://github.com/dotnet/maui/blob/8b44525b87a790e0fe0f056839f8d575314d5467/src/Core/src/Platform/Android/MeasureSpecExtensions.cs#L25-L30

This in turn results in the Layout measurement called with twice downscaled values.

Issues Fixed

filipnavara avatar Oct 22 '24 13:10 filipnavara

Hey there @filipnavara! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

/azp run

PureWeen avatar Oct 22 '24 13:10 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Oct 22 '24 13:10 azure-pipelines[bot]

As @PureWeen pointed out, this is essentially the same as https://github.com/dotnet/maui/pull/25367 except I didn't write tests yet. I'll close the PR in favor of the other one once the test run finishes.

filipnavara avatar Oct 22 '24 14:10 filipnavara

closing in favor of https://github.com/dotnet/maui/pull/25367

PureWeen avatar Oct 22 '24 14:10 PureWeen