Skip to content

Commit 5249f54

Browse files
dsn5ftgsajith
authored andcommitted
Update AppBarLayout and ActionBar to default to surface style in Dark Theme
Also update Dark Theme colorPrimaryDark to be #000000 to match PiperOrigin-RevId: 245028116
1 parent e53eff8 commit 5249f54

8 files changed

Lines changed: 69 additions & 8 deletions

File tree

catalog/java/io/material/catalog/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@
4848
android:name=".topappbar.TopAppBarActionBarDemoActivity"
4949
android:exported="false"
5050
android:label="@string/cat_topappbar_action_bar_title"
51-
android:theme="@style/Theme.MaterialComponents.Light"/>
51+
android:theme="@style/Theme.MaterialComponents.DayNight"/>
5252
<activity
5353
android:name=".topappbar.TopAppBarDarkActionBarDemoActivity"
5454
android:exported="false"
5555
android:label="@string/cat_topappbar_dark_action_bar_title"
56-
android:theme="@style/Theme.MaterialComponents.Light.DarkActionBar"/>
56+
android:theme="@style/Theme.MaterialComponents.DayNight.DarkActionBar"/>
5757
<activity
5858
android:name=".topappbar.TopAppBarScrollingTransparentStatusDemoActivity"
5959
android:exported="false"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2019 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<resources>
18+
<color name="cat_toc_title_text_color">@color/design_dark_default_color_on_surface</color>
19+
</resources>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2019 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<resources>
18+
19+
<style name="Widget.Catalog.Toolbar" parent="Widget.MaterialComponents.Toolbar"/>
20+
21+
</resources>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2019 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<resources>
18+
<color name="cat_toc_title_text_color">@color/design_default_color_on_primary</color>
19+
</resources>

catalog/java/io/material/catalog/tableofcontents/res/layout/cat_toc_header.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
android:includeFontPadding="false"
3434
android:text="@string/cat_toc_title"
3535
android:textAppearance="?attr/textAppearanceHeadline6"
36-
android:textColor="?colorOnPrimary"/>
36+
android:textColor="@color/cat_toc_title_text_color"/>
3737
</LinearLayout>

lib/java/com/google/android/material/color/res/values/colors.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
<!-- Dark theme brand colors. -->
3737
<color name="design_dark_default_color_primary">#BB86FC</color>
38-
<color name="design_dark_default_color_primary_dark">#8858C8</color>
38+
<color name="design_dark_default_color_primary_dark">#000000</color>
3939
<color name="design_dark_default_color_primary_variant">#3700B3</color>
4040
<color name="design_dark_default_color_on_primary">#000000</color>
4141
<color name="design_dark_default_color_secondary">#03DAC6</color>

lib/java/com/google/android/material/dialog/res/values/themes_base.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@
3434
<item name="minTouchTargetSize">@dimen/mtrl_min_touch_target_size</item>
3535

3636
<!-- Widget styles -->
37-
<item name="actionBarStyle">@style/Widget.MaterialComponents.ActionBar.Solid</item>
37+
<item name="actionBarStyle">@style/Widget.MaterialComponents.ActionBar.Surface</item>
38+
<item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.ActionBar.Surface</item>
3839
<item name="actionOverflowMenuStyle">@style/Widget.MaterialComponents.PopupMenu.Overflow.Dark</item>
39-
<item name="appBarLayoutStyle">@style/Widget.MaterialComponents.AppBarLayout.Primary</item>
40+
<item name="appBarLayoutStyle">@style/Widget.MaterialComponents.AppBarLayout.Surface</item>
4041
<item name="borderlessButtonStyle">@style/Widget.MaterialComponents.Button.TextButton</item>
4142
<item name="bottomAppBarStyle">@style/Widget.MaterialComponents.BottomAppBar</item>
4243
<item name="bottomNavigationStyle">@style/Widget.MaterialComponents.BottomNavigationView.Colored</item>

lib/java/com/google/android/material/theme/res/values/themes_base.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
<item name="minTouchTargetSize">@dimen/mtrl_min_touch_target_size</item>
3636

3737
<!-- Widget styles -->
38-
<item name="actionBarStyle">@style/Widget.MaterialComponents.ActionBar.Solid</item>
38+
<item name="actionBarStyle">@style/Widget.MaterialComponents.ActionBar.Surface</item>
39+
<item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.ActionBar.Surface</item>
3940
<item name="actionOverflowMenuStyle">@style/Widget.MaterialComponents.PopupMenu.Overflow.Dark</item>
40-
<item name="appBarLayoutStyle">@style/Widget.MaterialComponents.AppBarLayout.Primary</item>
41+
<item name="appBarLayoutStyle">@style/Widget.MaterialComponents.AppBarLayout.Surface</item>
4142
<item name="borderlessButtonStyle">@style/Widget.MaterialComponents.Button.TextButton</item>
4243
<item name="bottomAppBarStyle">@style/Widget.MaterialComponents.BottomAppBar</item>
4344
<item name="bottomNavigationStyle">@style/Widget.MaterialComponents.BottomNavigationView.Colored</item>

0 commit comments

Comments
 (0)