From 1cd868c326f2e483a697cadbccf2dcb0be424933 Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Fri, 1 Mar 2024 11:36:45 +0100 Subject: [PATCH 1/4] Update material [1.10.0 -> 1.11.0] --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d856969571..f7f9f87f0e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -85,7 +85,7 @@ kotlinx-coroutines-core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0" kotlinx-coroutines-test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.0" # https://github.com/michaelbull/kotlin-result/releases kotlinx-result = "com.michael-bull.kotlin-result:kotlin-result:1.1.18" -material = "com.google.android.material:material:1.10.0" # https://github.com/material-components/material-components-android/releases +material = "com.google.android.material:material:1.11.0" # https://github.com/material-components/material-components-android/releases # https://github.com/mockito/mockito/releases # mockito 5 requires JDK 11 mockito = "org.mockito:mockito-core:4.11.0" From bec8bd0b3335d974c7b53d263437a0ad5fc40fac Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Fri, 1 Mar 2024 12:31:43 +0100 Subject: [PATCH 2/4] Material surface tones: add generated colors --- .../battlelancer/seriesguide/ui/theme/Color.kt | 1 + app/src/main/res/values/colors_md.xml | 16 +++++++++++++++- app/src/main/res/values/themes.xml | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/battlelancer/seriesguide/ui/theme/Color.kt b/app/src/main/java/com/battlelancer/seriesguide/ui/theme/Color.kt index a119295037..2f9fe74007 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/ui/theme/Color.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/ui/theme/Color.kt @@ -3,6 +3,7 @@ package com.battlelancer.seriesguide.ui.theme import androidx.compose.ui.graphics.Color // Compose Material 3 colors, should match the XML colors in colors_md.xml +// Generated using https://material-foundation.github.io/material-theme-builder/ val seed = Color(0xFF6545A0) val white = Color(0xFFFFFFFF) diff --git a/app/src/main/res/values/colors_md.xml b/app/src/main/res/values/colors_md.xml index e20d7646b9..4f45db1f42 100644 --- a/app/src/main/res/values/colors_md.xml +++ b/app/src/main/res/values/colors_md.xml @@ -2,7 +2,7 @@ - + #b69df8 @@ -23,6 +23,13 @@ #F5EFF4 #323033 #D5BBFF + #DED8E0 + #FEF7FF + #FFFFFF + #F8F1FA + #F2ECF4 + #EDE6EF + #E7E0E9 #3D1976 #54348E @@ -44,6 +51,13 @@ #CBC4CF #948E99 #6C4CA7 + #151218 + #3B383F + #0F0D13 + #1D1A21 + #211E25 + #2C292F + #37333A #6545A0 #BA1B1B diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 06abb4a8da..15c20a2bab 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -47,6 +47,13 @@ @color/sg_color_background_dark @color/md_theme_dark_onSurface @color/md_theme_dark_primaryInverse + @color/md_theme_dark_surfaceDim + @color/md_theme_dark_surfaceBright + @color/md_theme_dark_surfaceContainerLowest + @color/md_theme_dark_surfaceContainerLow + @color/md_theme_dark_surfaceContainer + @color/md_theme_dark_surfaceContainerHigh + @color/md_theme_dark_surfaceContainerHighest @color/sg_color_background @@ -120,6 +127,13 @@ @color/md_theme_light_inverseOnSurface @color/md_theme_light_inverseSurface @color/md_theme_light_primaryInverse + @color/md_theme_light_surfaceDim + @color/md_theme_light_surfaceBright + @color/md_theme_light_surfaceContainerLowest + @color/md_theme_light_surfaceContainerLow + @color/md_theme_light_surfaceContainer + @color/md_theme_light_surfaceContainerHigh + @color/md_theme_light_surfaceContainerHighest @color/sg_color_background From 02ae3f6a071cf852f0f5cc63a246985868aafc3f Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Fri, 1 Mar 2024 12:44:32 +0100 Subject: [PATCH 3/4] Material surface tones: map previous surface colors Also use new fixed surfaceContainer color for nav bar to match bottom nav. --- .../battlelancer/seriesguide/ui/theme/Color.kt | 16 ++++++++-------- .../battlelancer/seriesguide/util/ThemeUtils.kt | 9 ++++++--- app/src/main/res/values/colors_md.xml | 16 ++++++++-------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/battlelancer/seriesguide/ui/theme/Color.kt b/app/src/main/java/com/battlelancer/seriesguide/ui/theme/Color.kt index 2f9fe74007..fd7305cb36 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/ui/theme/Color.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/ui/theme/Color.kt @@ -42,10 +42,10 @@ val md_theme_light_scrim = Color(0xFF000000) val surfaceDimLight = Color(0xFFDED8E0) val surfaceBrightLight = Color(0xFFFEF7FF) val surfaceContainerLowestLight = Color(0xFFFFFFFF) -val surfaceContainerLowLight = Color(0xFFF8F1FA) -val surfaceContainerLight = Color(0xFFF2ECF4) -val surfaceContainerHighLight = Color(0xFFEDE6EF) -val surfaceContainerHighestLight = Color(0xFFE7E0E9) +val surfaceContainerLowLight = Color(0xFFE3E0E6) // Buttons, cards +val surfaceContainerLight = Color(0xFFDEDBE3) // App bars +val surfaceContainerHighLight = Color(0xFFDCD9E3) // Dialogs +val surfaceContainerHighestLight = md_theme_light_surfaceVariant // Text input, switch val md_theme_dark_primary = Color(0xFF927bbc) val md_theme_dark_onPrimary = Color(0xFF3D1976) @@ -79,7 +79,7 @@ val md_theme_dark_scrim = Color(0xFF000000) val surfaceDimDark = Color(0xFF151218) val surfaceBrightDark = Color(0xFF3B383F) val surfaceContainerLowestDark = Color(0xFF0F0D13) -val surfaceContainerLowDark = Color(0xFF1D1A21) -val surfaceContainerDark = Color(0xFF211E25) -val surfaceContainerHighDark = Color(0xFF2C292F) -val surfaceContainerHighestDark = Color(0xFF37333A) \ No newline at end of file +val surfaceContainerLowDark = Color(0xFF1F1B26) // Buttons, cards +val surfaceContainerDark = Color(0xFF221E2B) // App bars +val surfaceContainerHighDark = Color(0xFF25202E) // Dialogs +val surfaceContainerHighestDark = md_theme_dark_surfaceVariant // Text input, switch \ No newline at end of file diff --git a/app/src/main/java/com/battlelancer/seriesguide/util/ThemeUtils.kt b/app/src/main/java/com/battlelancer/seriesguide/util/ThemeUtils.kt index 0949b3ea4c..565eff9a76 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/util/ThemeUtils.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/util/ThemeUtils.kt @@ -36,7 +36,6 @@ import com.battlelancer.seriesguide.ui.SeriesGuidePreferences import com.google.android.material.appbar.AppBarLayout import com.google.android.material.color.DynamicColors import com.google.android.material.color.MaterialColors -import com.google.android.material.elevation.SurfaceColors import com.google.android.material.shape.MaterialShapeDrawable import com.uwetrottmann.androidutils.AndroidUtils import com.uwetrottmann.seriesguide.widgets.SlidingTabLayout @@ -190,8 +189,12 @@ object ThemeUtils { // As those are the majority of used devices, use an opaque color with alpha matching // the navigation bar instead. // Color.TRANSPARENT - // Widget.Material3.BottomNavigationView elevation is m3_sys_elevation_level2 - val opaqueNavBarColor = SurfaceColors.SURFACE_2.getColor(context) + // Widget.Material3.BottomNavigationView background is ?attr/colorSurfaceContainer + val opaqueNavBarColor = MaterialColors.getColor( + context, + com.google.android.material.R.attr.colorSurfaceContainer, + Color.BLACK + ) ColorUtils.setAlphaComponent(opaqueNavBarColor, 192) } } diff --git a/app/src/main/res/values/colors_md.xml b/app/src/main/res/values/colors_md.xml index 4f45db1f42..0d416217c5 100644 --- a/app/src/main/res/values/colors_md.xml +++ b/app/src/main/res/values/colors_md.xml @@ -26,10 +26,10 @@ #DED8E0 #FEF7FF #FFFFFF - #F8F1FA - #F2ECF4 - #EDE6EF - #E7E0E9 + #E3E0E6 + #DEDBE3 + #DCD9E3 + @color/md_theme_light_surfaceVariant #3D1976 #54348E @@ -54,10 +54,10 @@ #151218 #3B383F #0F0D13 - #1D1A21 - #211E25 - #2C292F - #37333A + #1F1B26 + #221E2B + #25202E + @color/md_theme_dark_surfaceVariant #6545A0 #BA1B1B From b3e4ab17e8fa92005a6e7c8334daade9b9148671 Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Fri, 1 Mar 2024 15:47:19 +0100 Subject: [PATCH 4/4] Tonal surfaces: replace manual app bar with surface container colors --- .../com/battlelancer/seriesguide/util/WebTools.kt | 4 ++-- app/src/main/res/values-v23/themes.xml | 6 ++++-- app/src/main/res/values-v27/themes.xml | 12 ++++++------ app/src/main/res/values/attrs.xml | 1 - app/src/main/res/values/colors.xml | 2 -- app/src/main/res/values/themes.xml | 2 -- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/battlelancer/seriesguide/util/WebTools.kt b/app/src/main/java/com/battlelancer/seriesguide/util/WebTools.kt index 46c0b141a5..8656fbd57a 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/util/WebTools.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/util/WebTools.kt @@ -26,12 +26,12 @@ object WebTools { fun openInCustomTab(context: Context, url: String): Boolean { val darkParams = CustomTabColorSchemeParams.Builder() .setToolbarColor( - ContextCompat.getColor(context, R.color.sg_background_app_bar_dark) + ContextCompat.getColor(context, R.color.md_theme_dark_surfaceContainer) ) .build() val defaultParams = CustomTabColorSchemeParams.Builder() .setToolbarColor( - ContextCompat.getColor(context, R.color.sg_color_background_light) + ContextCompat.getColor(context, R.color.md_theme_light_surfaceContainer) ) .build() val customTabsIntent = CustomTabsIntent.Builder() diff --git a/app/src/main/res/values-v23/themes.xml b/app/src/main/res/values-v23/themes.xml index f5c6f6cceb..9ca0a1eea1 100644 --- a/app/src/main/res/values-v23/themes.xml +++ b/app/src/main/res/values-v23/themes.xml @@ -5,8 +5,9 @@ + - @color/sg_background_app_bar_dark + @color/md_theme_dark_surfaceContainer @@ -14,9 +15,10 @@ + - @color/sg_color_background + @color/md_theme_light_surfaceContainer true diff --git a/app/src/main/res/values-v27/themes.xml b/app/src/main/res/values-v27/themes.xml index b0622e7a86..38752e7bb6 100644 --- a/app/src/main/res/values-v27/themes.xml +++ b/app/src/main/res/values-v27/themes.xml @@ -5,11 +5,11 @@ + - @color/sg_background_app_bar_dark - + @color/md_theme_dark_surfaceContainer - @color/sg_black_almost + @color/md_theme_dark_surfaceContainer @@ -17,13 +17,13 @@ + - @color/sg_color_background + @color/md_theme_light_surfaceContainer true - - ?attr/sgColorTopAppBar + @color/md_theme_light_surfaceContainer true diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 9bcb20a5d0..1343d38288 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -14,7 +14,6 @@ - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index e87704fb8e..1b411a8a0c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -45,8 +45,6 @@ #aaffffff #ffffffff - - #241f2c #de927bbc diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 15c20a2bab..d4f31995e4 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -71,7 +71,6 @@ @color/sg_white_15 @color/sg_black_40 @color/sg_black_87 - @color/sg_background_app_bar_dark @color/sg_color_outline_dark @@ -151,7 +150,6 @@ @color/sg_black_10 @color/sg_black_7 @color/sg_white_87 - @color/sg_color_background @color/sg_color_outline_light