mirror of
https://github.com/jrpie/Launcher.git
synced 2025-04-12 07:14:38 +02:00
Merge 941b06b258
into 8948b34243
This commit is contained in:
commit
f525d3a37d
5 changed files with 47 additions and 0 deletions
|
@ -61,6 +61,7 @@ import eu.jonahbauer.android.preference.annotations.Preferences;
|
||||||
@Preference(name = "screen_timeout_disabled", type = boolean.class, defaultValue = "false"),
|
@Preference(name = "screen_timeout_disabled", type = boolean.class, defaultValue = "false"),
|
||||||
@Preference(name = "full_screen", type = boolean.class, defaultValue = "true"),
|
@Preference(name = "full_screen", type = boolean.class, defaultValue = "true"),
|
||||||
@Preference(name = "rotate_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 = {
|
@PreferenceGroup(name = "functionality", prefix = "settings_functionality_", suffix = "_key", value = {
|
||||||
@Preference(name = "search_auto_launch", type = boolean.class, defaultValue = "true"),
|
@Preference(name = "search_auto_launch", type = boolean.class, defaultValue = "true"),
|
||||||
|
|
|
@ -9,6 +9,9 @@ import android.util.DisplayMetrics
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.Window
|
||||||
|
import android.view.WindowInsets
|
||||||
|
import android.view.WindowInsetsController
|
||||||
import android.window.OnBackInvokedDispatcher
|
import android.window.OnBackInvokedDispatcher
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.view.isVisible
|
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() {
|
private fun updateSettingsFallbackButtonVisibility() {
|
||||||
// If µLauncher settings can not be reached from any action bound to an enabled gesture,
|
// If µLauncher settings can not be reached from any action bound to an enabled gesture,
|
||||||
// show the fallback button.
|
// show the fallback button.
|
||||||
|
@ -186,6 +225,7 @@ class HomeActivity : UIObject, AppCompatActivity() {
|
||||||
// Only used pre Android 13, cf. onBackInvokedDispatcher
|
// Only used pre Android 13, cf. onBackInvokedDispatcher
|
||||||
handleBack()
|
handleBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_VOLUME_UP -> {
|
KeyEvent.KEYCODE_VOLUME_UP -> {
|
||||||
if (Action.forGesture(Gesture.VOLUME_UP) == LauncherAction.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
|
// Let the OS handle the key event. This works better with some custom ROMs
|
||||||
|
|
|
@ -137,6 +137,7 @@
|
||||||
<string name="settings_display_screen_timeout_disabled_key" translatable="false">display.disable_timeout</string>
|
<string name="settings_display_screen_timeout_disabled_key" translatable="false">display.disable_timeout</string>
|
||||||
<string name="settings_display_full_screen_key" translatable="false">display.use_full_screen</string>
|
<string name="settings_display_full_screen_key" translatable="false">display.use_full_screen</string>
|
||||||
<string name="settings_display_rotate_screen_key" translatable="false">display.rotate_screen</string>
|
<string name="settings_display_rotate_screen_key" translatable="false">display.rotate_screen</string>
|
||||||
|
<string name="settings_display_hide_navigation_bar_key" translatable="false">display.hide_navigation</string>
|
||||||
|
|
||||||
<string name="settings_enabled_gestures_double_swipe_key" translatable="false">enabled_gestures.double_actions</string>
|
<string name="settings_enabled_gestures_double_swipe_key" translatable="false">enabled_gestures.double_actions</string>
|
||||||
<string name="settings_enabled_gestures_edge_swipe_key" translatable="false">enabled_gestures.edge_actions</string>
|
<string name="settings_enabled_gestures_edge_swipe_key" translatable="false">enabled_gestures.edge_actions</string>
|
||||||
|
|
|
@ -155,6 +155,7 @@
|
||||||
<string name="settings_display_screen_timeout_disabled">Keep screen on</string>
|
<string name="settings_display_screen_timeout_disabled">Keep screen on</string>
|
||||||
<string name="settings_display_full_screen">Use full screen</string>
|
<string name="settings_display_full_screen">Use full screen</string>
|
||||||
<string name="settings_display_rotate_screen">Rotate screen</string>
|
<string name="settings_display_rotate_screen">Rotate screen</string>
|
||||||
|
<string name="settings_display_hide_navigation_bar">Hide navigation bar</string>
|
||||||
|
|
||||||
<string name="settings_launcher_section_functionality">Functionality</string>
|
<string name="settings_launcher_section_functionality">Functionality</string>
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,10 @@
|
||||||
android:key="@string/settings_display_screen_timeout_disabled_key"
|
android:key="@string/settings_display_screen_timeout_disabled_key"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:title="@string/settings_display_screen_timeout_disabled"/>
|
android:title="@string/settings_display_screen_timeout_disabled"/>
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="@string/settings_display_hide_navigation_bar_key"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:title="@string/settings_display_hide_navigation_bar"/>
|
||||||
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
Loading…
Add table
Reference in a new issue