Skip to content

Commit

Permalink
Android: Fix for NavBar height with getSafeAreaInsets (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottrules44 authored Oct 8, 2022
1 parent 57e9d84 commit ba5abf4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,7 @@ protected static float[] callGetSafeAreaInsetPixels(CoronaRuntime runtime)
CoronaStatusBarApiListener listener = runtime.getController().getCoronaStatusBarApiListener();
CoronaStatusBarSettings statusBarMode = listener.getStatusBarMode();
boolean hasNavigationBar = listener.HasSoftwareKeys();

if (listener != null) {
if (listener.IsAndroidTV()) {
int contentHeight = JavaToNativeShim.getContentHeightInPixels(runtime);
Expand All @@ -1568,7 +1569,12 @@ protected static float[] callGetSafeAreaInsetPixels(CoronaRuntime runtime)
result[0] = cutout.getSafeInsetTop();
result[1] = cutout.getSafeInsetLeft();
result[2] = cutout.getSafeInsetRight();
result[3] = cutout.getSafeInsetBottom();
//Android InsetBottom does not always return correct navbar height
if(hasNavigationBar && cutout.getSafeInsetBottom() == 0 && !runtime.getController().getSystemUiVisibility().contains("immersive")){
result[3] = listener.getNavigationBarHeight();
}else{
result[3] = cutout.getSafeInsetBottom();
}
}
else {
result[0] = (statusBarMode != CoronaStatusBarSettings.HIDDEN) ? listener.getStatusBarHeight() : 0;
Expand Down

0 comments on commit ba5abf4

Please sign in to comment.