Skip to content

Commit

Permalink
Fixed running on Android 10 and older (thanks @AntTheAlchemist!)
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 24, 2024
1 parent c601120 commit 31730be
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions android-project/app/src/main/java/org/libsdl/app/SDLSurface.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,15 @@ public void surfaceChanged(SurfaceHolder holder,
// Window inset
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
Insets combined = insets.getInsets(WindowInsets.Type.statusBars() |
WindowInsets.Type.navigationBars() |
WindowInsets.Type.captionBar() |
WindowInsets.Type.systemGestures() |
WindowInsets.Type.mandatorySystemGestures() |
WindowInsets.Type.tappableElement() |
WindowInsets.Type.displayCutout() |
WindowInsets.Type.systemOverlays());

SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom);
if (Build.VERSION.SDK_INT >= 30 /* Android 11 (R) */) {
Insets combined = insets.getInsets(WindowInsets.Type.systemBars() |
WindowInsets.Type.systemGestures() |
WindowInsets.Type.mandatorySystemGestures() |
WindowInsets.Type.tappableElement() |
WindowInsets.Type.displayCutout());

SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom);
}

// Pass these to any child views in case they need them
return insets;
Expand Down

0 comments on commit 31730be

Please sign in to comment.