mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Status bar can now be hidden or shown as desired
This commit is contained in:
parent
a20e8b430c
commit
c145eec220
3 changed files with 38 additions and 6 deletions
|
|
@ -98,6 +98,8 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
private lateinit var leftSwipeActivity: Pair<LauncherActivityInfo?, Int?>
|
||||
private lateinit var rightSwipeActivity: Pair<LauncherActivityInfo?, Int?>
|
||||
|
||||
private var windowInsetsController: WindowInsetsController? = null
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
|
@ -113,14 +115,19 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
Color.parseColor(preferences.getString("bgColor", "#00000000"))
|
||||
)
|
||||
|
||||
val windowInsetsController = window.insetsController
|
||||
windowInsetsController = window.insetsController
|
||||
|
||||
windowInsetsController?.let {
|
||||
it.hide(WindowInsets.Type.statusBars()) // Hide system bars
|
||||
it.systemBarsBehavior = WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE // Set behavior
|
||||
if (preferences.getBoolean("barVisibility", false)) {
|
||||
it.show(WindowInsets.Type.statusBars())
|
||||
}
|
||||
else {
|
||||
it.hide(WindowInsets.Type.statusBars())
|
||||
it.systemBarsBehavior =
|
||||
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
searchView = findViewById(R.id.searchView)
|
||||
|
||||
launcherApps = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||
|
|
@ -274,6 +281,19 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
"rightSwipeApp" -> {
|
||||
rightSwipeActivity = getSwipeInfo("right")
|
||||
}
|
||||
|
||||
"barVisibility" -> {
|
||||
windowInsetsController?.let {
|
||||
if (preferences?.getBoolean("barVisibility", false) == true) {
|
||||
it.show(WindowInsets.Type.statusBars())
|
||||
}
|
||||
else {
|
||||
it.hide(WindowInsets.Type.statusBars())
|
||||
it.systemBarsBehavior =
|
||||
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginTop="45dp"
|
||||
android:layout_marginBottom="27dp"
|
||||
android:fontFamily="@null"
|
||||
android:format12Hour="hh:mm a"
|
||||
|
|
|
|||
|
|
@ -115,6 +115,18 @@
|
|||
app:title="Search Size"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:allowDividerAbove="false"
|
||||
app:title="System bars">
|
||||
<SwitchPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:defaultValue="false"
|
||||
android:title="Show Status Bar"
|
||||
app:key="barVisibility" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue