@@ -87,44 +87,6 @@ void OnFlyoutStateChanging(object sender, AndroidX.DrawerLayout.Widget.DrawerLay
8787 // - Do not extend; add new logic to the forthcoming implementation instead.
8888 internal class WindowsListener : MauiWindowInsetListener , IOnApplyWindowInsetsListener
8989 {
90- private WeakReference < ImageView > _bgImageRef ;
91- private WeakReference < AView > _flyoutViewRef ;
92- private WeakReference < AView > _footerViewRef ;
93-
94- public AView FlyoutView
95- {
96- get
97- {
98- if ( _flyoutViewRef != null && _flyoutViewRef . TryGetTarget ( out var flyoutView ) )
99- return flyoutView ;
100-
101- return null ;
102- }
103- set
104- {
105- _flyoutViewRef = new WeakReference < AView > ( value ) ;
106- }
107- }
108- public AView FooterView
109- {
110- get
111- {
112- if ( _footerViewRef != null && _footerViewRef . TryGetTarget ( out var footerView ) )
113- return footerView ;
114-
115- return null ;
116- }
117- set
118- {
119- _footerViewRef = new WeakReference < AView > ( value ) ;
120- }
121- }
122-
123- public WindowsListener ( ImageView bgImage )
124- {
125- _bgImageRef = new WeakReference < ImageView > ( bgImage ) ;
126- }
127-
12890 public override WindowInsetsCompat OnApplyWindowInsets ( AView v , WindowInsetsCompat insets )
12991 {
13092 if ( insets == null || v == null )
@@ -135,38 +97,12 @@ public override WindowInsetsCompat OnApplyWindowInsets(AView v, WindowInsetsComp
13597 // The flyout overlaps the status bar so we don't really care about insetting it
13698 var systemBars = insets . GetInsets ( WindowInsetsCompat . Type . SystemBars ( ) ) ;
13799 var displayCutout = insets . GetInsets ( WindowInsetsCompat . Type . DisplayCutout ( ) ) ;
100+ var leftInset = Math . Max ( systemBars ? . Left ?? 0 , displayCutout ? . Left ?? 0 ) ;
138101 var topInset = Math . Max ( systemBars ? . Top ?? 0 , displayCutout ? . Top ?? 0 ) ;
102+ var rightInset = Math . Max ( systemBars ? . Right ?? 0 , displayCutout ? . Right ?? 0 ) ;
139103 var bottomInset = Math . Max ( systemBars ? . Bottom ?? 0 , displayCutout ? . Bottom ?? 0 ) ;
140- var appbarLayout = v . FindDescendantView < AppBarLayout > ( ( v ) => true ) ;
141104
142- int flyoutViewBottomInset = 0 ;
143-
144- if ( FooterView is not null )
145- {
146- v . SetPadding ( 0 , 0 , 0 , bottomInset ) ;
147- flyoutViewBottomInset = 0 ;
148- }
149- else
150- {
151- flyoutViewBottomInset = bottomInset ;
152- v . SetPadding ( 0 , 0 , 0 , 0 ) ;
153- }
154-
155- if ( appbarLayout . MeasuredHeight > 0 )
156- {
157- FlyoutView ? . SetPadding ( 0 , 0 , 0 , flyoutViewBottomInset ) ;
158- appbarLayout ? . SetPadding ( 0 , topInset , 0 , 0 ) ;
159- }
160- else
161- {
162- FlyoutView ? . SetPadding ( 0 , topInset , 0 , flyoutViewBottomInset ) ;
163- appbarLayout ? . SetPadding ( 0 , 0 , 0 , 0 ) ;
164- }
165-
166- if ( _bgImageRef != null && _bgImageRef . TryGetTarget ( out var bgImage ) && bgImage != null )
167- {
168- bgImage . SetPadding ( 0 , topInset , 0 , bottomInset ) ;
169- }
105+ v . SetPadding ( leftInset , topInset , rightInset , bottomInset ) ;
170106
171107 return WindowInsetsCompat . Consumed ;
172108 }
@@ -207,7 +143,7 @@ protected virtual void LoadView(IShellContext shellContext)
207143 LayoutParameters = new LP ( coordinator . LayoutParameters )
208144 } ;
209145
210- _windowsListener = new WindowsListener ( _bgImage ) ;
146+ _windowsListener = new WindowsListener ( ) ;
211147 MauiWindowInsetListener . SetupViewWithLocalListener ( coordinator , _windowsListener ) ;
212148
213149 UpdateFlyoutHeaderBehavior ( ) ;
@@ -304,7 +240,6 @@ protected virtual void UpdateFlyoutContent()
304240 }
305241
306242 _flyoutContentView = CreateFlyoutContent ( _rootView ) ;
307- _windowsListener . FlyoutView = _flyoutContentView ;
308243 if ( _flyoutContentView == null )
309244 return ;
310245
@@ -421,7 +356,6 @@ protected virtual void UpdateFlyoutFooter()
421356 var oldFooterView = _footerView ;
422357 _rootView . RemoveView ( _footerView ) ;
423358 _footerView = null ;
424- _windowsListener . FooterView = null ;
425359 oldFooterView . View = null ;
426360 }
427361
@@ -441,8 +375,6 @@ protected virtual void UpdateFlyoutFooter()
441375 MatchWidth = true
442376 } ;
443377
444- _windowsListener . FooterView = _footerView ;
445-
446378 var footerViewLP = new CoordinatorLayout . LayoutParams ( 0 , 0 )
447379 {
448380 Gravity = ( int ) ( GravityFlags . Bottom | GravityFlags . End )
0 commit comments