1. 26 9月, 2021 1 次提交
  2. 25 9月, 2021 3 次提交
  3. 24 9月, 2021 8 次提交
  4. 23 9月, 2021 12 次提交
  5. 22 9月, 2021 3 次提交
    • M
      Remove IBoxView (#2619) · 7cac05a9
      Matthew Leibowitz 提交于
      * Remove IBoxView
      
      * Fix device tests
      Co-authored-by: NRui Marinho <me@ruimarinho.net>
      7cac05a9
    • G
    • J
      [android] use a custom Resource.designer.cs (#2606) · 386af46b
      Jonathan Peppers 提交于
      Context: https://github.com/jonathanpeppers/CustomResourceDesigner
      Context: https://github.com/xamarin/xamarin-android/issues/6310
      
      We found a systemic problem with Xamarin.Android class libraries:
      
      * Include AndroidX & Google Material
      * Include at least one `@(AndroidResource)` and use the ID from C#
      * `Resource.designer.cs` has 2,700+ fields. That's a lot!
      
      This problem compounds itself as you include more class libraries that
      depend on each other. The main app will end up repeatedly setting
      these fields at startup for each library that contains fields in
      `Resource.designer.cs`...
      
      Reviewing the .NET MAUI fields, I found:
      
          src\Core\src\obj\Debug\net6.0-android\Resource.designer.cs
          5310
          src\Controls\src\Core\obj\Debug\net6.0-android\Resource.designer.cs
          5167 fields
          src\Controls\src\Xaml\obj\Release\net6.0-android\Resource.designer.cs
          5167 fields
          src\Compatibility\Core\src\obj\Debug\net6.0-android\Resource.designer.cs
          5333 fields
          src\Essentials\src\obj\Debug\net6.0-android\Resource.designer.cs
          204 fields
      
      In fact, I found 21,497 fields were set at startup for a `dotnet new
      maui` app in `Resource.designer.cs`!
      
      In many projects you can simply set `$(AndroidGenerateResourceDesigner)`
      to `false`, but the issue is .NET MAUI actually uses some of the C#
      `Resource.designer.cs` values at runtime.
      
      So to solve the problem here, I came up with a new pattern:
      
      https://github.com/jonathanpeppers/CustomResourceDesigner
      
      We can copy the contents of `Resource.designer.cs` and manually delete
      all the fields we don't need. This allows
      `$(AndroidGenerateResourceDesigner)` to be turned off.
      
      We are working on a long-term solution for this issue in
      Xamarin.Android, but we can do this workaround in .NET MAUI now.
      
      ~~ Results ~~
      
      Building a `dotnet new maui` then `dotnet build -c Release` and
      running on a Pixel 5.
      
      Before:
      
      * 21,497 fields set at startup in UpdateIdValues()
      * Activity Displayed: 1s454ms
      * .apk size: 17300275 bytes
      
      After:
      
      * 65 fields set at startup in UpdateIdValues()
      * Activity Displayed: 1s079ms
      * .apk size: 16677683 bytes
      
          > apkdiff -f before.apk after.apk
          Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
          -         233 assemblies/Microsoft.Maui.Controls.Compatibility.Android.FormsViewGroup.dll
          -       5,264 assemblies/Microsoft.Maui.Essentials.dll
          -     103,010 assemblies/Microsoft.Maui.dll
          -     103,260 assemblies/Microsoft.Maui.Controls.Compatibility.dll
          -     103,811 assemblies/Microsoft.Maui.Controls.Xaml.dll
          -     106,127 assemblies/Microsoft.Maui.Controls.dll
          -     201,031 assemblies/foo.dll
          Summary:
          +           0 Other entries 0.00% (of 2,139,558)
          -     622,736 Assemblies -6.93% (of 8,987,664)
          +           0 Dalvik executables 0.00% (of 6,440,988)
          +           0 Shared libraries 0.00% (of 9,860,264)
          -   1,340,928 Uncompressed assemblies -6.55% (of 20,465,016)
          -     622,592 Package size difference -3.60% (of 17,300,275)
      386af46b
  6. 21 9月, 2021 13 次提交