Skip to content
Snippets Groups Projects
Unverified Commit 4e855be3 authored by Charles Lombardo's avatar Charles Lombardo Committed by GitHub
Browse files

Merge pull request #11594 from t895/rotation-fix

android: Prevent nav bar shade from laying out across screen
parents 69ba29e5 38b939b2
No related branches found
No related tags found
No related merge requests found
...@@ -181,12 +181,14 @@ class SettingsActivity : AppCompatActivity() { ...@@ -181,12 +181,14 @@ class SettingsActivity : AppCompatActivity() {
private fun setInsets() { private fun setInsets() {
ViewCompat.setOnApplyWindowInsetsListener( ViewCompat.setOnApplyWindowInsetsListener(
binding.navigationBarShade binding.navigationBarShade
) { view: View, windowInsets: WindowInsetsCompat -> ) { _: View, windowInsets: WindowInsetsCompat ->
val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
val mlpShade = view.layoutParams as MarginLayoutParams // The only situation where we care to have a nav bar shade is when it's at the bottom
mlpShade.height = barInsets.bottom // of the screen where scrolling list elements can go behind it.
view.layoutParams = mlpShade val mlpNavShade = binding.navigationBarShade.layoutParams as MarginLayoutParams
mlpNavShade.height = barInsets.bottom
binding.navigationBarShade.layoutParams = mlpNavShade
windowInsets windowInsets
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<View <View
android:id="@+id/navigation_bar_shade" android:id="@+id/navigation_bar_shade"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="1px" android:layout_height="1px"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:clickable="false" android:clickable="false"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment