diff --git a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt index b701a37..30a7e42 100644 --- a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt +++ b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt @@ -98,6 +98,8 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh private lateinit var leftSwipeActivity: Pair private lateinit var rightSwipeActivity: Pair + 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 + } + } + } } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index ba0acd9..0a9ed5e 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -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" diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml index 97ef659..b37ac35 100644 --- a/app/src/main/res/xml/root_preferences.xml +++ b/app/src/main/res/xml/root_preferences.xml @@ -115,6 +115,18 @@ app:title="Search Size" app:useSimpleSummaryProvider="true" /> + + +