Skip to content

Commit

Permalink
Tonal surfaces: replace manual app bar with surface container colors
Browse files Browse the repository at this point in the history
  • Loading branch information
UweTrottmann committed Mar 7, 2024
1 parent 02ae3f6 commit b3e4ab1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
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
2 changes: 0 additions & 2 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,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 @@ -151,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

0 comments on commit b3e4ab1

Please sign in to comment.