Add option to hide status bar
This commit is contained in:
1 parent
b964c7adf7
commit
0a3447fda1
4 files changed
+28
-3
No files matched your search
@@ -110,4 +110,5 @@
|
||||
<string name="quickstep_description">Clear All Button, Corner Radius</string>
|
||||
<string name="wallpaper_scrolling_label">Scroll Wallpaper</string>
|
||||
<string name="show_sys_ui_scrim">Show Top Shadow</string>
|
||||
<string name="pref_hide_statusbar">Hide Status Bar</string>
|
||||
</resources>
|
||||
@@ -20,6 +20,8 @@ import android.content.Context
|
||||
import android.os.Bundle
|
||||
import androidx.activity.OnBackPressedDispatcher
|
||||
import androidx.activity.OnBackPressedDispatcherOwner
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import androidx.lifecycle.*
|
||||
import androidx.savedstate.SavedStateRegistry
|
||||
import androidx.savedstate.SavedStateRegistryController
|
||||
@@ -30,11 +32,11 @@ import app.lawnchair.nexuslauncher.OverlayCallbackImpl
|
||||
import app.lawnchair.preferences.PreferenceManager
|
||||
import app.lawnchair.root.RootHelperManager
|
||||
import app.lawnchair.root.RootNotAvailableException
|
||||
import com.android.launcher3.BaseActivity
|
||||
import com.android.launcher3.LauncherAppState
|
||||
import com.android.launcher3.LauncherRootView
|
||||
import com.android.launcher3.*
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.statemanager.StateManager
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher
|
||||
import com.android.launcher3.uioverrides.states.OverviewState
|
||||
import com.android.systemui.plugins.shared.LauncherOverlayManager
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -66,6 +68,23 @@ class LawnchairLauncher : QuickstepLauncher(), LifecycleOwner,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (prefs.hideStatusBar.get()) {
|
||||
val insetsController = WindowInsetsControllerCompat(launcher.window, rootView)
|
||||
insetsController.hide(WindowInsetsCompat.Type.statusBars())
|
||||
launcher.stateManager.addStateListener(object : StateManager.StateListener<LauncherState> {
|
||||
override fun onStateTransitionStart(toState: LauncherState) {
|
||||
if (toState is OverviewState) {
|
||||
insetsController.show(WindowInsetsCompat.Type.statusBars())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStateTransitionComplete(finalState: LauncherState) {
|
||||
if (finalState !is OverviewState) {
|
||||
insetsController.hide(WindowInsetsCompat.Type.statusBars())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun setupViews() {
|
||||
|
||||
@@ -90,6 +90,7 @@ class PreferenceManager private constructor(private val context: Context) : Base
|
||||
val accentColor = IntPref("pref_accentColor", LAWNCHAIR_BLUE.toInt(), recreate)
|
||||
val wallpaperScrolling = BoolPref("pref_wallpaperScrolling", true)
|
||||
val showSysUiScrim = BoolPref("pref_showSysUiScrim", true)
|
||||
val hideStatusBar = BoolPref("pref_hideStatusBar", false, recreate)
|
||||
|
||||
init {
|
||||
sp.registerOnSharedPreferenceChangeListener(this)
|
||||
|
||||
@@ -66,6 +66,10 @@ fun HomeScreenPreferences() {
|
||||
prefs.workspaceDt2s.getAdapter(),
|
||||
label = stringResource(id = R.string.workspace_dt2s),
|
||||
)
|
||||
SwitchPreference(
|
||||
prefs.hideStatusBar.getAdapter(),
|
||||
label = stringResource(id = R.string.pref_hide_statusbar),
|
||||
)
|
||||
SwitchPreference(
|
||||
prefs.showSysUiScrim.getAdapter(),
|
||||
label = stringResource(id = R.string.show_sys_ui_scrim),
|
||||
|
||||
Reference in new issue
Block a user