Bimba.git

commit df934cc0619755fd820d5124a154023d6f02aa3b

Author: Adam <git@apiote.xyz>

proper full screen and status bar

%!v(PANIC=String method: strings: negative Repeat count)


diff --git a/app/src/main/java/ml/adamsprogs/bimba/dashboard/MainActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/dashboard/MainActivity.kt
index 1e0f19e5af94bb4648d681dfa8e150ad139734a2..9ad2f4caf46522af80beeebb28187e9a53a8b50a 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/dashboard/MainActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/dashboard/MainActivity.kt
@@ -10,6 +10,7 @@ import androidx.activity.result.ActivityResultLauncher
 import androidx.activity.result.contract.ActivityResultContracts
 import androidx.appcompat.app.AppCompatActivity
 import androidx.core.content.ContextCompat
+import androidx.core.view.WindowCompat
 import androidx.core.view.get
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.FragmentManager
@@ -49,6 +50,7 @@ 				}
 			}, true
 		)
 
+		WindowCompat.setDecorFitsSystemWindows(window, false)
 		val navView: BottomNavigationView = binding.bottomNavigation
 		val navHostFragment =
 			supportFragmentManager.findFragmentById(R.id.nav_host_fragment_activity_main) as NavHostFragment




diff --git a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeFragment.kt b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeFragment.kt
index 07b12ab2f43b4b158cf835feaede03a13554b398..3dd84a1133eba507fa2ac9521eab8b5dfcc8402b 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeFragment.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeFragment.kt
@@ -6,7 +6,9 @@ import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
-import androidx.appcompat.app.AppCompatActivity
+import android.widget.FrameLayout
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
 import androidx.fragment.app.Fragment
 import androidx.lifecycle.ViewModelProvider
 import com.mancj.materialsearchbar.MaterialSearchBar
@@ -33,6 +35,15 @@ 		val homeViewModel =
 			ViewModelProvider(this)[HomeViewModel::class.java]
 		homeViewModel.items.observe(viewLifecycleOwner) {
 			binding.searchBar.updateLastSuggestions(it)
+		}
+
+		val root = binding.root
+		ViewCompat.setOnApplyWindowInsetsListener(root) { view, windowInsets ->
+			val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
+			view.layoutParams = (view.layoutParams as FrameLayout.LayoutParams).apply {
+				topMargin = insets.top
+			}
+			WindowInsetsCompat.CONSUMED
 		}
 
 		binding.searchBar.lastSuggestions = lastSuggestions




diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 7f7d3e77bd7b60502b44ff3b2124ab5ee5b11d6a..3bb6106b6bf38245c81e0043df466024c1ecd71b 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -11,8 +11,7 @@ 		android:layout_height="match_parent">
 
 		<com.google.android.material.appbar.AppBarLayout
 			android:layout_width="match_parent"
-			android:layout_height="wrap_content"
-			android:fitsSystemWindows="true">
+			android:layout_height="wrap_content">
 
 			<com.google.android.material.appbar.MaterialToolbar
 				android:id="@+id/topAppBar"