mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 14:31:30 +01:00
minor reformatting
This commit is contained in:
parent
9935386ad8
commit
941b06b258
1 changed files with 13 additions and 6 deletions
|
@ -10,6 +10,8 @@ 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.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
|
||||||
|
@ -111,14 +113,18 @@ class HomeActivity : UIObject, AppCompatActivity() {
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
private fun hideNavigationBar() {
|
private fun hideNavigationBar() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
val windowInsetsController = window.insetsController ?: return
|
window.insetsController?.apply {
|
||||||
windowInsetsController.hide(android.view.WindowInsets.Type.navigationBars())
|
hide(WindowInsets.Type.navigationBars())
|
||||||
windowInsetsController.systemBarsBehavior =
|
systemBarsBehavior =
|
||||||
android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
val decorView = window.decorView
|
val decorView = window.decorView
|
||||||
val uiOptions =
|
val uiOptions = (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
(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)
|
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
|
// Try to hide the navigation bar but do not hide the status bar
|
||||||
decorView.systemUiVisibility = uiOptions
|
decorView.systemUiVisibility = uiOptions
|
||||||
|
@ -219,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
|
||||||
|
|
Loading…
Add table
Reference in a new issue