Design: fix status bar, white flash, button order, theme switching

- Android: windowBackground day/night colors fix white flash on navigation
- Android: status bar color set dynamically per theme in OnResume
- Android: AppearanceLightStatusBars set correctly (light icons in dark, dark in light)
- Android: overflow icon tinted white via view-tree walk in OnWindowFocusChanged
- AddConnection: reorder buttons Test → Connect → Save; Save is now primary (filled)
- SessionPage: saved queries header row fully tappable (not just chevron)
- SessionPage: QueryEditor BackgroundColor/TextColor use DynamicResource for live theme switching
- LightTheme: add Editor style so colors reset correctly when switching dark→light

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gerwin Kuijntjes
2026-03-31 15:35:03 +02:00
parent d0b7e8335d
commit efe8e1a6d4
7 changed files with 36 additions and 13 deletions

View File

@@ -32,9 +32,14 @@ namespace Xamarin.Neo4j.Android
var nightMode = Resources.Configuration.UiMode & UiMode.NightMask;
var isDark = nightMode == UiMode.NightYes;
// Status bar icon appearance: dark icons on light bg, white icons on dark bg
// Status bar: match page background, icons contrast with it
if (Window != null)
{
var statusBarColor = isDark
? AColor.ParseColor("#0c0c0c")
: AColor.ParseColor("#f5f5f5");
Window.SetStatusBarColor(statusBarColor);
var controller = new WindowInsetsControllerCompat(Window, Window.DecorView);
controller.AppearanceLightStatusBars = !isDark;
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="windowBackground">#0c0c0c</color>
<color name="statusBarColor">#0c0c0c</color>
</resources>

View File

@@ -5,4 +5,6 @@
<color name="colorPrimaryDark">#0c0c0c</color>
<color name="colorAccent">#e2e2e2</color>
<color name="navBar">#141414</color>
<color name="windowBackground">#f5f5f5</color>
<color name="statusBarColor">#f5f5f5</color>
</resources>

View File

@@ -19,6 +19,9 @@
<item name="colorAccent">@color/colorAccent</item>
<!-- colorOnPrimary controls text/icon color on primary-colored surfaces (toolbar, overflow icon) -->
<item name="colorOnPrimary">#ffffff</item>
<!-- windowBackground prevents white flash during page transitions -->
<item name="android:windowBackground">@color/windowBackground</item>
<item name="android:statusBarColor">@color/statusBarColor</item>
<item name="actionModeBackground">@color/colorPrimary</item>
<item name="actionOverflowButtonStyle">@style/OverflowMenuButton</item>
<item name="actionModeStyle">@style/ActionModeStyle</item>

View File

@@ -51,9 +51,9 @@
</Grid>
</StackLayout>
<Button Text="Connect" BackgroundColor="{DynamicResource Accent}" TextColor="{DynamicResource QueryTextBackground}" Command="{Binding Commands[Connect]}" />
<Button Text="Test" BackgroundColor="Transparent" TextColor="{DynamicResource Accent}" BorderColor="{DynamicResource Accent}" BorderWidth="1" Command="{Binding Commands[Test]}" />
<Button Text="Save" BackgroundColor="Transparent" TextColor="{DynamicResource PrimaryTextColor}" BorderColor="{DynamicResource SecondaryTextColor}" BorderWidth="1" Command="{Binding Commands[Save]}" />
<Button Text="Test" BackgroundColor="Transparent" TextColor="{DynamicResource SecondaryTextColor}" BorderColor="{DynamicResource SecondaryTextColor}" BorderWidth="1" Command="{Binding Commands[Test]}" />
<Button Text="Connect" BackgroundColor="Transparent" TextColor="{DynamicResource PrimaryTextColor}" BorderColor="{DynamicResource PrimaryTextColor}" BorderWidth="1" Command="{Binding Commands[Connect]}" />
<Button Text="Save" BackgroundColor="{DynamicResource Accent}" TextColor="{DynamicResource QueryTextBackground}" Command="{Binding Commands[Save]}" />
</StackLayout>
</ScrollView>
</ContentPage.Content>

View File

@@ -49,6 +49,8 @@
<controls:QueryEditor Text="{Binding Query}" ExecuteClicked="ExecuteQuery"
Placeholder="MATCH (n) RETURN n LIMIT 25"
PlaceholderColor="{DynamicResource SecondaryTextColor}"
BackgroundColor="{DynamicResource QueryTextBackground}"
TextColor="{DynamicResource PrimaryTextColor}"
FontSize="14" MaxHeight="200" HorizontalOptions="FillAndExpand" AutoSize="TextChanges" />
</Border>
@@ -57,20 +59,21 @@
<StackLayout Spacing="0" Padding="0,0,0,16">
<!-- Saved queries section — collapsible, always above results -->
<Grid ColumnDefinitions="*,Auto" Padding="16,10,4,4">
<Grid ColumnDefinitions="*,Auto" Padding="16,10,16,4">
<Grid.GestureRecognizers>
<TapGestureRecognizer Tapped="ToggleSavedQueries" />
</Grid.GestureRecognizers>
<Label Grid.Column="0"
Text="Saved Queries"
FontSize="12" FontAttributes="Bold"
TextColor="{DynamicResource SecondaryTextColor}"
VerticalOptions="Center" />
<Button Grid.Column="1"
x:Name="savedQueriesChevron"
Text="{x:Static fonts:FontAwesomeSolid.ChevronUp}"
FontFamily="{StaticResource FontAwesomeSolid}" FontSize="11"
BackgroundColor="Transparent"
TextColor="{DynamicResource SecondaryTextColor}"
WidthRequest="40" HeightRequest="32"
Clicked="ToggleSavedQueries" />
<Label Grid.Column="1"
x:Name="savedQueriesChevron"
Text="{x:Static fonts:FontAwesomeSolid.ChevronUp}"
FontFamily="{StaticResource FontAwesomeSolid}" FontSize="11"
TextColor="{DynamicResource SecondaryTextColor}"
VerticalOptions="Center" />
</Grid>
<StackLayout x:Name="savedQueriesContent" Spacing="0" Margin="16,0">

View File

@@ -41,6 +41,11 @@
<Setter Property="BarTextColor" Value="#e2e2e2" />
</Style>
<Style TargetType="Editor" ApplyToDerivedTypes="True">
<Setter Property="BackgroundColor" Value="#ffffff"/>
<Setter Property="TextColor" Value="#0c0c0c"/>
</Style>
<Style TargetType="TabbedPage" ApplyToDerivedTypes="True">
<Setter Property="BackgroundColor" Value="#ffffff"/>
<Setter Property="BarTextColor" Value="#868a92"/>