Skip to content

Commit

Permalink
Android.Resources: add workaround styles.xml
Browse files Browse the repository at this point in the history
Add simple styles.xml to workaround the maui styling bug
in dark theme [1]. Should be removed after merging [2].

[1] dotnet/maui#15088
[2] dotnet/maui#15091
  • Loading branch information
parhamsaremi committed May 17, 2023
1 parent 059a1ef commit fefe99d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Frontend/Frontend.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<ItemGroup>
<MauiImage Include="Resources\Images\*" />
<MauiFont Include="Resources\Fonts\*" />
<None Remove="Platforms\Android\Resources\values\styles.xml" />

<MauiIcon Condition="$(TargetFramework.Contains('-android'))" Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.png" Color="#512BD4" ForegroundScale="0.60" />
<MauiIcon Condition="!$(TargetFramework.Contains('-android'))" Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.png" Color="#512BD4" />
Expand Down
11 changes: 11 additions & 0 deletions src/Frontend/Platforms/Android/Resources/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!-- Workaround for fixing DisplayAlert's AlertDialog button color in dark theme https://github.com/dotnet/maui/issues/15088.
Should be removed after merging https://github.com/dotnet/maui/pull/15091.-->
<style name="Maui.MainTheme" parent="Theme.MaterialComponents.DayNight">
<item name="alertDialogTheme">@style/MauiAlertDialogTheme</item>
</style>
<style name="MauiAlertDialogTheme" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="colorPrimary">?attr/colorOnSurface</item>
</style>
</resources>

0 comments on commit fefe99d

Please sign in to comment.