Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,29 @@ public override WindowInsetsCompat OnApplyWindowInsets(AView v, WindowInsetsComp
var topInset = Math.Max(systemBars?.Top ?? 0, displayCutout?.Top ?? 0);
var rightInset = Math.Max(systemBars?.Right ?? 0, displayCutout?.Right ?? 0);
var bottomInset = Math.Max(systemBars?.Bottom ?? 0, displayCutout?.Bottom ?? 0);

// Only apply bottom padding if the view's bottom actually extends into
// the bottom safe area zone. If the view is fully above the safe area
// boundary, there is no overlap and no padding is needed.
if (bottomInset > 0 && v.Height > 0)
{
var location = new int[2];
v.GetLocationOnScreen(location);
var viewBottom = location[1] + v.Height;

var windowManager = v.Context?.GetSystemService(Context.WindowService) as IWindowManager;
if (windowManager?.DefaultDisplay is not null)
{
var realMetrics = new global::Android.Util.DisplayMetrics();
windowManager.DefaultDisplay.GetRealMetrics(realMetrics);
var screenHeight = realMetrics.HeightPixels;

// View does not reach the bottom safe area zone — no bottom padding needed
if (viewBottom <= screenHeight - bottomInset)
bottomInset = 0;
}
}

v.SetPadding(leftInset, topInset, rightInset, bottomInset);
return WindowInsetsCompat.Consumed;
}
Expand Down Expand Up @@ -507,6 +530,12 @@ void OnFlyoutViewLayoutChanging()
_flyoutHeight = View.MeasuredHeight;
_flyoutWidth = View.MeasuredWidth;

// Re-request insets so OnApplyWindowInsets re-evaluates whether
// the bottom padding is still needed at the new flyout size.
// Without this, the padding set during the first inset dispatch
// (which may have been at full-screen height) would persist even
// after FlyoutHeight is changed to a smaller value.
ViewCompat.RequestApplyInsets(_rootView);

// We wait to instantiate the flyout footer until we know the WxH of the flyout container
if (_footerView == null)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading