From 6b3169b609fddca403f88b96f99d0996b5617177 Mon Sep 17 00:00:00 2001 From: Jahir Fiquitiva <jahir.fiquitiva@gmail.com> Date: Wed, 1 Jan 2025 17:05:29 -0500 Subject: [PATCH] fix: content behind system bars in Android 15. fix menu background colors --- library/src/main/res/drawable/menu_background.xml | 8 ++++++++ library/src/main/res/layout/activity_fragments.xml | 5 +++-- .../res/layout/activity_fragments_bottom_navigation.xml | 1 + library/src/main/res/layout/activity_muzei_settings.xml | 5 +++-- library/src/main/res/layout/activity_recyclerview.xml | 5 +++-- library/src/main/res/values/m3_styles.xml | 1 + library/src/main/res/values/styles.xml | 1 + 7 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 library/src/main/res/drawable/menu_background.xml diff --git a/library/src/main/res/drawable/menu_background.xml b/library/src/main/res/drawable/menu_background.xml new file mode 100644 index 000000000..57c1e80dd --- /dev/null +++ b/library/src/main/res/drawable/menu_background.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="?colorSurface" /> + <corners android:radius="@dimen/small_components_corner_size" /> + <padding + android:bottom="@dimen/medium_components_corner_size" + android:top="@dimen/medium_components_corner_size" /> +</shape> diff --git a/library/src/main/res/layout/activity_fragments.xml b/library/src/main/res/layout/activity_fragments.xml index 65e248e50..bdc2fad2b 100644 --- a/library/src/main/res/layout/activity_fragments.xml +++ b/library/src/main/res/layout/activity_fragments.xml @@ -4,7 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_root_view" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:fitsSystemWindows="true"> <com.google.android.material.appbar.AppBarLayout android:layout_width="match_parent" @@ -30,4 +31,4 @@ android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> -</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file +</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/library/src/main/res/layout/activity_fragments_bottom_navigation.xml b/library/src/main/res/layout/activity_fragments_bottom_navigation.xml index 0c0beaea8..8786da166 100644 --- a/library/src/main/res/layout/activity_fragments_bottom_navigation.xml +++ b/library/src/main/res/layout/activity_fragments_bottom_navigation.xml @@ -10,6 +10,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="false" + android:fitsSystemWindows="true" android:transitionName="appbar" tools:ignore="UnusedAttribute"> diff --git a/library/src/main/res/layout/activity_muzei_settings.xml b/library/src/main/res/layout/activity_muzei_settings.xml index 8f249a872..f0ece8060 100644 --- a/library/src/main/res/layout/activity_muzei_settings.xml +++ b/library/src/main/res/layout/activity_muzei_settings.xml @@ -4,7 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:fitsSystemWindows="true"> <com.google.android.material.appbar.AppBarLayout android:id="@+id/appbar" @@ -106,4 +107,4 @@ </androidx.core.widget.NestedScrollView> -</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file +</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/library/src/main/res/layout/activity_recyclerview.xml b/library/src/main/res/layout/activity_recyclerview.xml index 40963f8bc..97a18203b 100644 --- a/library/src/main/res/layout/activity_recyclerview.xml +++ b/library/src/main/res/layout/activity_recyclerview.xml @@ -4,7 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_root_view" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:fitsSystemWindows="true"> <com.google.android.material.appbar.AppBarLayout android:layout_width="match_parent" @@ -30,4 +31,4 @@ android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> -</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file +</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/library/src/main/res/values/m3_styles.xml b/library/src/main/res/values/m3_styles.xml index 96757f621..df6904528 100644 --- a/library/src/main/res/values/m3_styles.xml +++ b/library/src/main/res/values/m3_styles.xml @@ -50,6 +50,7 @@ <item name="android:forceDarkAllowed">true</item> <item name="preferenceTheme">@style/Widget.Frames.PreferenceThemeOverlay.MaterialYou</item> + <item name="popupMenuBackground">@drawable/menu_background</item> </style> <style name="Frames.SplashScreen.Amoled.MaterialYou" parent="Frames.SplashScreen.MaterialYou" /> diff --git a/library/src/main/res/values/styles.xml b/library/src/main/res/values/styles.xml index 56efab01e..36e932585 100644 --- a/library/src/main/res/values/styles.xml +++ b/library/src/main/res/values/styles.xml @@ -42,6 +42,7 @@ <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <item name="android:forceDarkAllowed">true</item> + <item name="popupMenuBackground">@drawable/menu_background</item> </style> <style name="Frames.SplashScreen.Amoled" parent="Frames.SplashScreen" />