Skip to content

Commit

Permalink
Merge pull request #980 from UweTrottmann/material-1.11.0
Browse files Browse the repository at this point in the history
Material 1.11.0
  • Loading branch information
UweTrottmann authored Mar 7, 2024
2 parents 7f20f9c + b3e4ab1 commit f35ab1a
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 28 deletions.
17 changes: 9 additions & 8 deletions app/src/main/java/com/battlelancer/seriesguide/ui/theme/Color.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -41,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)
Expand Down Expand Up @@ -78,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)
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values-v23/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@

<!-- All customizations that are SPECIFIC to API-level 23 go here. -->

<!-- Not used in most of the app since drawing edge-to-edge. -->
<!-- Override primary variant color to make status bar match app bar -->
<item name="android:statusBarColor">@color/sg_background_app_bar_dark</item>
<item name="android:statusBarColor">@color/md_theme_dark_surfaceContainer</item>

</style>

<style name="Theme.BaseSeriesGuide.Light" parent="Theme.Material3.Light.NoActionBar">

<!-- All customizations that are SPECIFIC to API-level 23 go here. -->

<!-- Not used in most of the app since drawing edge-to-edge. -->
<!-- Override primary variant color to make status bar match app bar -->
<!-- Note: Could color status bar light as of L, but not use light style until M. So only for M+. -->
<item name="android:statusBarColor">@color/sg_color_background</item>
<item name="android:statusBarColor">@color/md_theme_light_surfaceContainer</item>
<item name="android:windowLightStatusBar">true</item>

</style>
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/values-v27/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@

<!-- All customizations that are SPECIFIC to API-level 27 go here. -->

<!-- Not used in most of the app since drawing edge-to-edge. -->
<!-- Copy from v23\themes.xml -->
<item name="android:statusBarColor">@color/sg_background_app_bar_dark</item>

<item name="android:statusBarColor">@color/md_theme_dark_surfaceContainer</item>
<!-- Note: nav bar color needs to be opaque! -->
<item name="android:navigationBarColor">@color/sg_black_almost</item>
<item name="android:navigationBarColor">@color/md_theme_dark_surfaceContainer</item>

</style>

<style name="Theme.BaseSeriesGuide.Light" parent="Theme.Material3.Light.NoActionBar">

<!-- All customizations that are SPECIFIC to API-level 27 go here. -->

<!-- Not used in most of the app since drawing edge-to-edge. -->
<!-- Copy from v23\themes.xml -->
<item name="android:statusBarColor">@color/sg_color_background</item>
<item name="android:statusBarColor">@color/md_theme_light_surfaceContainer</item>
<item name="android:windowLightStatusBar">true</item>

<!-- Note: nav bar color needs to be opaque! -->
<!-- Use white-ish to reduce burn-in on OLED displays -->
<item name="android:navigationBarColor">?attr/sgColorTopAppBar</item>
<item name="android:navigationBarColor">@color/md_theme_light_surfaceContainer</item>
<item name="android:windowLightNavigationBar">true</item>

</style>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<attr name="sgColorDivider" format="reference|color" />
<attr name="sgColorShadow" format="reference|color" />
<attr name="sgColorStatusBarOverlay" format="reference|color" />
<attr name="sgColorTopAppBar" format="reference|color" />
<attr name="sgColorOutlineLighter" format="reference|color" />

<!-- Custom view attributes -->
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
<color name="sg_background_gradient_start">#aaffffff</color>
<color name="sg_background_gradient_end">#ffffffff</color>

<!-- 4dp elevation of night/sg_color_background -->
<color name="sg_background_app_bar_dark">#241f2c</color>
<!-- emphasis high = 87% -->
<color name="sg_color_primary_300_emphasis_high">#de927bbc</color>

Expand Down
16 changes: 15 additions & 1 deletion app/src/main/res/values/colors_md.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources">

<!-- XML Material 3 colors, should match the Compose colors in com/battlelancer/seriesguide/ui/theme/Color.kt -->
<!-- Exported using https://m3.material.io/theme-builder and base color #6545a0 -->
<!-- Generated using https://material-foundation.github.io/material-theme-builder/ and base color #6545a0 -->
<!-- https://m3.material.io/styles/color/the-color-system/color-roles -->

<color name="md_theme_light_primaryContainer">#b69df8</color>
Expand All @@ -23,6 +23,13 @@
<color name="md_theme_light_inverseOnSurface">#F5EFF4</color>
<color name="md_theme_light_inverseSurface">#323033</color>
<color name="md_theme_light_primaryInverse">#D5BBFF</color>
<color name="md_theme_light_surfaceDim">#DED8E0</color>
<color name="md_theme_light_surfaceBright">#FEF7FF</color>
<color name="md_theme_light_surfaceContainerLowest">#FFFFFF</color>
<color name="md_theme_light_surfaceContainerLow">#E3E0E6</color>
<color name="md_theme_light_surfaceContainer">#DEDBE3</color>
<color name="md_theme_light_surfaceContainerHigh">#DCD9E3</color>
<color name="md_theme_light_surfaceContainerHighest">@color/md_theme_light_surfaceVariant</color>

<color name="md_theme_dark_onPrimary">#3D1976</color>
<color name="md_theme_dark_primaryContainer">#54348E</color>
Expand All @@ -44,6 +51,13 @@
<color name="md_theme_dark_onSurfaceVariant">#CBC4CF</color>
<color name="md_theme_dark_outline">#948E99</color>
<color name="md_theme_dark_primaryInverse">#6C4CA7</color>
<color name="md_theme_dark_surfaceDim">#151218</color>
<color name="md_theme_dark_surfaceBright">#3B383F</color>
<color name="md_theme_dark_surfaceContainerLowest">#0F0D13</color>
<color name="md_theme_dark_surfaceContainerLow">#1F1B26</color>
<color name="md_theme_dark_surfaceContainer">#221E2B</color>
<color name="md_theme_dark_surfaceContainerHigh">#25202E</color>
<color name="md_theme_dark_surfaceContainerHighest">@color/md_theme_dark_surfaceVariant</color>

<color name="seed">#6545A0</color>
<color name="error">#BA1B1B</color>
Expand Down
16 changes: 14 additions & 2 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
<item name="colorOnSurfaceInverse">@color/sg_color_background_dark</item>
<item name="colorSurfaceInverse">@color/md_theme_dark_onSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_dark_primaryInverse</item>
<item name="colorSurfaceDim">@color/md_theme_dark_surfaceDim</item>
<item name="colorSurfaceBright">@color/md_theme_dark_surfaceBright</item>
<item name="colorSurfaceContainerLowest">@color/md_theme_dark_surfaceContainerLowest</item>
<item name="colorSurfaceContainerLow">@color/md_theme_dark_surfaceContainerLow</item>
<item name="colorSurfaceContainer">@color/md_theme_dark_surfaceContainer</item>
<item name="colorSurfaceContainerHigh">@color/md_theme_dark_surfaceContainerHigh</item>
<item name="colorSurfaceContainerHighest">@color/md_theme_dark_surfaceContainerHighest</item>

<!-- Windows -->
<item name="android:windowBackground">@color/sg_color_background</item>
Expand All @@ -64,7 +71,6 @@
<item name="sgColorDivider">@color/sg_white_15</item>
<item name="sgColorShadow">@color/sg_black_40</item>
<item name="sgColorStatusBarOverlay">@color/sg_black_87</item>
<item name="sgColorTopAppBar">@color/sg_background_app_bar_dark</item>
<item name="sgColorOutlineLighter">@color/sg_color_outline_dark</item>

<!-- dialogTheme is used by AppCompatDialogFragment. -->
Expand Down Expand Up @@ -120,6 +126,13 @@
<item name="colorOnSurfaceInverse">@color/md_theme_light_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/md_theme_light_inverseSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_light_primaryInverse</item>
<item name="colorSurfaceDim">@color/md_theme_light_surfaceDim</item>
<item name="colorSurfaceBright">@color/md_theme_light_surfaceBright</item>
<item name="colorSurfaceContainerLowest">@color/md_theme_light_surfaceContainerLowest</item>
<item name="colorSurfaceContainerLow">@color/md_theme_light_surfaceContainerLow</item>
<item name="colorSurfaceContainer">@color/md_theme_light_surfaceContainer</item>
<item name="colorSurfaceContainerHigh">@color/md_theme_light_surfaceContainerHigh</item>
<item name="colorSurfaceContainerHighest">@color/md_theme_light_surfaceContainerHighest</item>

<!-- Windows -->
<item name="android:windowBackground">@color/sg_color_background</item>
Expand All @@ -137,7 +150,6 @@
<item name="sgColorDivider">@color/sg_black_10</item>
<item name="sgColorShadow">@color/sg_black_7</item>
<item name="sgColorStatusBarOverlay">@color/sg_white_87</item>
<item name="sgColorTopAppBar">@color/sg_color_background</item>
<item name="sgColorOutlineLighter">@color/sg_color_outline_light</item>

<!-- dialogTheme is used by AppCompatDialogFragment. -->
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f35ab1a

Please sign in to comment.