diff --git a/app/src/main/java/de/jrpie/android/launcher/preferences/LauncherPreferences$Config.java b/app/src/main/java/de/jrpie/android/launcher/preferences/LauncherPreferences$Config.java
index 9be85ab..076445d 100644
--- a/app/src/main/java/de/jrpie/android/launcher/preferences/LauncherPreferences$Config.java
+++ b/app/src/main/java/de/jrpie/android/launcher/preferences/LauncherPreferences$Config.java
@@ -64,6 +64,7 @@ import eu.jonahbauer.android.preference.annotations.Preferences;
@Preference(name = "screen_timeout_disabled", type = boolean.class, defaultValue = "false"),
@Preference(name = "full_screen", type = boolean.class, defaultValue = "true"),
@Preference(name = "rotate_screen", type = boolean.class, defaultValue = "true"),
+ @Preference(name = "hide_navigation_bar", type = boolean.class, defaultValue = "false"),
}),
@PreferenceGroup(name = "functionality", prefix = "settings_functionality_", suffix = "_key", value = {
@Preference(name = "search_auto_launch", type = boolean.class, defaultValue = "true"),
diff --git a/app/src/main/java/de/jrpie/android/launcher/ui/HomeActivity.kt b/app/src/main/java/de/jrpie/android/launcher/ui/HomeActivity.kt
index 973e0ca..1100e0c 100644
--- a/app/src/main/java/de/jrpie/android/launcher/ui/HomeActivity.kt
+++ b/app/src/main/java/de/jrpie/android/launcher/ui/HomeActivity.kt
@@ -9,6 +9,9 @@ import android.util.DisplayMetrics
import android.view.KeyEvent
import android.view.MotionEvent
import android.view.View
+import android.view.Window
+import android.view.WindowInsets
+import android.view.WindowInsetsController
import android.window.OnBackInvokedDispatcher
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
@@ -99,6 +102,42 @@ class HomeActivity : UIObject, AppCompatActivity() {
}
+ override fun onWindowFocusChanged(hasFocus: Boolean) {
+ super.onWindowFocusChanged(hasFocus)
+
+ if (hasFocus && LauncherPreferences.display().hideNavigationBar()) {
+ hideNavigationBar()
+ }
+ }
+
+ @Suppress("DEPRECATION")
+ private fun hideNavigationBar() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ window.insetsController?.apply {
+ hide(WindowInsets.Type.navigationBars())
+ systemBarsBehavior =
+ WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
+ }
+ } else {
+ val decorView = window.decorView
+ val uiOptions = (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+ or View.SYSTEM_UI_FLAG_IMMERSIVE
+ or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
+
+ // Try to hide the navigation bar but do not hide the status bar
+ decorView.systemUiVisibility = uiOptions
+
+ // Add listener to hide the navigation bar
+ decorView.setOnSystemUiVisibilityChangeListener { visibility ->
+ if (visibility and View.SYSTEM_UI_FLAG_FULLSCREEN == 0) {
+ decorView.systemUiVisibility = uiOptions
+ }
+ }
+ }
+ }
+
private fun updateSettingsFallbackButtonVisibility() {
// If µLauncher settings can not be reached from any action bound to an enabled gesture,
// show the fallback button.
@@ -186,6 +225,7 @@ class HomeActivity : UIObject, AppCompatActivity() {
// Only used pre Android 13, cf. onBackInvokedDispatcher
handleBack()
}
+
KeyEvent.KEYCODE_VOLUME_UP -> {
if (Action.forGesture(Gesture.VOLUME_UP) == LauncherAction.VOLUME_UP) {
// Let the OS handle the key event. This works better with some custom ROMs
diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml
index a2e4ad6..b8f2b3f 100644
--- a/app/src/main/res/values/donottranslate.xml
+++ b/app/src/main/res/values/donottranslate.xml
@@ -139,6 +139,7 @@
display.disable_timeout
display.use_full_screen
display.rotate_screen
+ display.hide_navigation
enabled_gestures.double_actions
enabled_gestures.edge_actions
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8e13753..eff8664 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -155,6 +155,7 @@
Keep screen on
Use full screen
Rotate screen
+ Hide navigation bar
Functionality
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index a90debd..2f20cb2 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -186,6 +186,10 @@
android:key="@string/settings_display_screen_timeout_disabled_key"
android:defaultValue="false"
android:title="@string/settings_display_screen_timeout_disabled"/>
+