Skip to content

Commit

Permalink
feat: Hide system bars when launching editor as overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Jan 13, 2025
1 parent 86cbb22 commit 945a225
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/src/main/java/xtr/keymapper/editor/EditorUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
import android.app.Activity;
import android.content.Context;
import android.graphics.PixelFormat;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsetsController;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.TextView;
Expand Down Expand Up @@ -136,6 +138,17 @@ public void openOverlayWindow() {
PixelFormat.TRANSLUCENT);
mWindowManager.addView(mainView, mParams);
overlayOpen = true;
hideSystemBars();
}

private void hideSystemBars() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
WindowInsetsController windowInsetsController = mainView.getWindowInsetsController();
if (windowInsetsController != null) {
windowInsetsController.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars());
}
}
}

/**
Expand Down

0 comments on commit 945a225

Please sign in to comment.