3
3
using Android . Runtime ;
4
4
using Android . Util ;
5
5
using Android . Views ;
6
- using AndroidX . AppCompat . App ;
7
6
using AndroidX . Core . View ;
8
7
using Uno . Disposables ;
9
8
using Uno . Foundation . Logging ;
10
9
using Uno . UI . Extensions ;
11
10
using Windows . ApplicationModel . Core ;
12
11
using Windows . Foundation ;
13
- using Windows . Graphics ;
14
12
using Windows . Graphics . Display ;
15
13
using Windows . UI . Core ;
16
14
using Windows . UI . ViewManagement ;
@@ -78,6 +76,7 @@ internal void RaiseNativeSizeChanged()
78
76
Bounds = new Rect ( default , windowSize ) ;
79
77
VisibleBounds = visibleBounds ;
80
78
Size = new ( ( int ) ( windowSize . Width * RasterizationScale ) , ( int ) ( windowSize . Height * RasterizationScale ) ) ;
79
+ ApplySystemOverlaysTheming ( ) ;
81
80
82
81
if ( _previousTrueVisibleBounds != visibleBounds )
83
82
{
@@ -88,7 +87,11 @@ internal void RaiseNativeSizeChanged()
88
87
}
89
88
}
90
89
91
- protected override void ShowCore ( ) => RemovePreDrawListener ( ) ;
90
+ protected override void ShowCore ( )
91
+ {
92
+ ApplySystemOverlaysTheming ( ) ;
93
+ RemovePreDrawListener ( ) ;
94
+ }
92
95
93
96
private ( Size windowSize , Rect visibleBounds ) GetVisualBounds ( )
94
97
{
@@ -191,6 +194,24 @@ private WindowInsetsCompat GetWindowInsets(Activity activity)
191
194
return null ;
192
195
}
193
196
197
+ internal void ApplySystemOverlaysTheming ( )
198
+ {
199
+ if ( ( int ) Android . OS . Build . VERSION . SdkInt >= 35 )
200
+ {
201
+ // In edge-to-edge experience we want to adjust the theming of status bar to match the app theme.
202
+ if ( ( ContextHelper . Current is Activity activity ) &&
203
+ activity . Window ? . DecorView is { FitsSystemWindows : false } decorView )
204
+ {
205
+ var requestedTheme = Microsoft . UI . Xaml . Application . Current . RequestedTheme ;
206
+
207
+ var insetsController = WindowCompat . GetInsetsController ( activity . Window , decorView ) ;
208
+
209
+ // "appearance light" refers to status bar set to light theme == dark foreground
210
+ insetsController . AppearanceLightStatusBars = requestedTheme == Microsoft . UI . Xaml . ApplicationTheme . Light ;
211
+ }
212
+ }
213
+ }
214
+
194
215
private Size GetWindowSize ( )
195
216
{
196
217
if ( ContextHelper . Current is not Activity activity )
0 commit comments