Commit f8c057d1 authored by Theresa's avatar Theresa Committed by Commit Bot

Add stub Google Sans definition and apply to text styles

Also use BlackHeadline for selectable list layout toolbar (e.g.
bookmarks, history, photo picker, etc).

BUG=849845

Change-Id: Idc1e643b0d3a22bfb6d8dd9f595e77d48a618195
Reviewed-on: https://chromium-review.googlesource.com/c/1387672
Commit-Queue: Theresa <twellington@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Reviewed-by: default avatarBecky Zhou <huayinz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619967}
parent e950ee8a
...@@ -167,6 +167,7 @@ Still reading? ...@@ -167,6 +167,7 @@ Still reading?
<issue id="InconsistentArrays" severity="Error"> <issue id="InconsistentArrays" severity="Error">
<ignore regexp="android_webview/locale_paks.resources.zip/values/locale-paks.xml"/> <ignore regexp="android_webview/locale_paks.resources.zip/values/locale-paks.xml"/>
<ignore regexp="chrome/android/chrome_locale_paks.resources.zip/values/locale-paks.xml"/> <ignore regexp="chrome/android/chrome_locale_paks.resources.zip/values/locale-paks.xml"/>
<ignore regexp="preloaded_fonts.xml"/>
</issue> </issue>
<issue id="InconsistentLayout" severity="ignore"/> <issue id="InconsistentLayout" severity="ignore"/>
<issue id="InefficientWeight" severity="Error"> <issue id="InefficientWeight" severity="Error">
......
...@@ -20,5 +20,5 @@ ...@@ -20,5 +20,5 @@
android:id="@+id/title" android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:textAppearance="@style/TextAppearance.BlackHeadline" /> android:textAppearance="@style/TextAppearance.AlertDialogTitleStyle" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert"> <style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:windowBackground">@drawable/popup_bg</item> <item name="android:windowBackground">@drawable/popup_bg</item>
<item name="android:windowTitleStyle">@style/AlertDialogTitleStyle</item> <item name="android:windowTitleStyle">@style/TextAppearance.AlertDialogTitleStyle</item>
<item name="android:textColorHighlight">@color/text_highlight_color</item> <item name="android:textColorHighlight">@color/text_highlight_color</item>
<!-- Overriding AppCompat values --> <!-- Overriding AppCompat values -->
...@@ -118,8 +118,15 @@ ...@@ -118,8 +118,15 @@
<item name="spinnerStyle">@style/SpinnerStyle</item> <item name="spinnerStyle">@style/SpinnerStyle</item>
</style> </style>
<style name="AlertDialogTitleStyle" parent="RtlOverlay.DialogWindowTitle.AppCompat"> <!-- Styled to match BlackHeadline but setup to override values in the app compat parent theme.
<item name="android:textAppearance">@style/TextAppearance.BlackHeadline</item> Note that the fontFamily doesn't get applied on older versions of Android.
See https://crbug.com/918697.-->
<style name="TextAppearance.AlertDialogTitleStyle"
parent="RtlOverlay.DialogWindowTitle.AppCompat">
<item name="android:textColor">@color/default_text_color_list</item>
<item name="android:textSize">@dimen/headline_size</item>
<item name="android:fontFamily">@font/accent_font</item>
<item name="android:textStyle">normal</item>
</style> </style>
<!-- The dim amount should match the alpha of modal_dialog_scrim_color. --> <!-- The dim amount should match the alpha of modal_dialog_scrim_color. -->
......
...@@ -152,8 +152,7 @@ public class BookmarkManager implements BookmarkDelegate, SearchDelegate, ...@@ -152,8 +152,7 @@ public class BookmarkManager implements BookmarkDelegate, SearchDelegate,
mToolbar = (BookmarkActionBar) mSelectableListLayout.initializeToolbar( mToolbar = (BookmarkActionBar) mSelectableListLayout.initializeToolbar(
R.layout.bookmark_action_bar, mSelectionDelegate, 0, null, R.id.normal_menu_group, R.layout.bookmark_action_bar, mSelectionDelegate, 0, null, R.id.normal_menu_group,
R.id.selection_mode_menu_group, R.color.modern_primary_color, null, true, R.id.selection_mode_menu_group, null, true, isDialogUi);
isDialogUi);
mToolbar.initializeSearchView( mToolbar.initializeSearchView(
this, R.string.bookmark_action_bar_search, R.id.search_menu_id); this, R.string.bookmark_action_bar_search, R.id.search_menu_id);
......
...@@ -139,8 +139,8 @@ public class PickerCategoryView ...@@ -139,8 +139,8 @@ public class PickerCategoryView
int titleId = multiSelectionAllowed ? R.string.contacts_picker_select_contacts int titleId = multiSelectionAllowed ? R.string.contacts_picker_select_contacts
: R.string.contacts_picker_select_contact; : R.string.contacts_picker_select_contact;
mToolbar = (ContactsPickerToolbar) mSelectableListLayout.initializeToolbar( mToolbar = (ContactsPickerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.contacts_picker_toolbar, mSelectionDelegate, titleId, null, 0, 0, R.layout.contacts_picker_toolbar, mSelectionDelegate, titleId, null, 0, 0, null,
R.color.modern_primary_color, null, false, false); false, false);
mToolbar.setNavigationOnClickListener(this); mToolbar.setNavigationOnClickListener(this);
mToolbar.initializeSearchView(this, R.string.contacts_picker_search, 0); mToolbar.initializeSearchView(this, R.string.contacts_picker_search, 0);
......
...@@ -112,8 +112,7 @@ public class ToolbarCoordinator implements SelectionObserver<ListItem> { ...@@ -112,8 +112,7 @@ public class ToolbarCoordinator implements SelectionObserver<ListItem> {
mShadow = mView.findViewById(R.id.shadow); mShadow = mView.findViewById(R.id.shadow);
mToolbar.initialize(selectionDelegate, 0 /* titleResId */, null /* drawerLayout */, mToolbar.initialize(selectionDelegate, 0 /* titleResId */, null /* drawerLayout */,
normalMenuGroupId, R.id.selection_mode_menu_group, R.color.modern_primary_color, normalMenuGroupId, R.id.selection_mode_menu_group, hasCloseButton);
hasCloseButton);
mToolbar.setOnMenuItemClickListener(this ::onMenuItemClick); mToolbar.setOnMenuItemClickListener(this ::onMenuItemClick);
// TODO(crbug.com/881037): Pass the visible group to the toolbar during initialization. // TODO(crbug.com/881037): Pass the visible group to the toolbar during initialization.
......
...@@ -236,8 +236,7 @@ public class DownloadManagerUi implements OnMenuItemClickListener, SearchDelegat ...@@ -236,8 +236,7 @@ public class DownloadManagerUi implements OnMenuItemClickListener, SearchDelegat
mToolbar = (DownloadManagerToolbar) mSelectableListLayout.initializeToolbar( mToolbar = (DownloadManagerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.download_manager_toolbar, mBackendProvider.getSelectionDelegate(), 0, null, R.layout.download_manager_toolbar, mBackendProvider.getSelectionDelegate(), 0, null,
normalGroupId, R.id.selection_mode_menu_group, R.color.modern_primary_color, this, normalGroupId, R.id.selection_mode_menu_group, this, true, isSeparateActivity);
true, isSeparateActivity);
mToolbar.getMenu().setGroupVisible(normalGroupId, true); mToolbar.getMenu().setGroupVisible(normalGroupId, true);
mToolbar.setManager(this); mToolbar.setManager(this);
mToolbar.initialize(mFilterAdapter); mToolbar.initialize(mFilterAdapter);
......
...@@ -125,8 +125,8 @@ public class HistoryManager implements OnMenuItemClickListener, SignInStateObser ...@@ -125,8 +125,8 @@ public class HistoryManager implements OnMenuItemClickListener, SignInStateObser
// 3. Initialize toolbar. // 3. Initialize toolbar.
mToolbar = (HistoryManagerToolbar) mSelectableListLayout.initializeToolbar( mToolbar = (HistoryManagerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.history_toolbar, mSelectionDelegate, R.string.menu_history, null, R.layout.history_toolbar, mSelectionDelegate, R.string.menu_history, null,
R.id.normal_menu_group, R.id.selection_mode_menu_group, R.id.normal_menu_group, R.id.selection_mode_menu_group, this, true,
R.color.modern_primary_color, this, true, isSeparateActivity); isSeparateActivity);
mToolbar.setManager(this); mToolbar.setManager(this);
mToolbar.initializeSearchView(this, R.string.history_manager_search, R.id.search_menu_id); mToolbar.initializeSearchView(this, R.string.history_manager_search, R.id.search_menu_id);
mToolbar.setInfoMenuItem(R.id.info_menu_id); mToolbar.setInfoMenuItem(R.id.info_menu_id);
......
...@@ -154,8 +154,8 @@ public class PickerCategoryView extends RelativeLayout ...@@ -154,8 +154,8 @@ public class PickerCategoryView extends RelativeLayout
int titleId = multiSelectionAllowed ? R.string.photo_picker_select_images int titleId = multiSelectionAllowed ? R.string.photo_picker_select_images
: R.string.photo_picker_select_image; : R.string.photo_picker_select_image;
PhotoPickerToolbar toolbar = (PhotoPickerToolbar) mSelectableListLayout.initializeToolbar( PhotoPickerToolbar toolbar = (PhotoPickerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.photo_picker_toolbar, mSelectionDelegate, titleId, null, 0, 0, R.layout.photo_picker_toolbar, mSelectionDelegate, titleId, null, 0, 0, null, false,
R.color.default_primary_color, null, false, false); false);
toolbar.setNavigationOnClickListener(this); toolbar.setNavigationOnClickListener(this);
Button doneButton = (Button) toolbar.findViewById(R.id.done); Button doneButton = (Button) toolbar.findViewById(R.id.done);
doneButton.setOnClickListener(this); doneButton.setOnClickListener(this);
......
...@@ -192,9 +192,6 @@ public class SelectableListLayout<E> ...@@ -192,9 +192,6 @@ public class SelectableListLayout<E>
* established. * established.
* @param selectedGroupResId The resource id of the menu item to show when a selection is * @param selectedGroupResId The resource id of the menu item to show when a selection is
* established. * established.
* @param normalBackgroundColorResId The resource id of the color to use as the background color
* when selection is not enabled. If null the default appbar
* background color will be used.
* @param listener The OnMenuItemClickListener to set on the toolbar. * @param listener The OnMenuItemClickListener to set on the toolbar.
* @param showShadowOnSelection Whether to show the toolbar shadow on selection. * @param showShadowOnSelection Whether to show the toolbar shadow on selection.
* @param updateStatusBarColor Whether the status bar color should be updated to match the * @param updateStatusBarColor Whether the status bar color should be updated to match the
...@@ -205,7 +202,6 @@ public class SelectableListLayout<E> ...@@ -205,7 +202,6 @@ public class SelectableListLayout<E>
public SelectableListToolbar<E> initializeToolbar(int toolbarLayoutId, public SelectableListToolbar<E> initializeToolbar(int toolbarLayoutId,
SelectionDelegate<E> delegate, int titleResId, @Nullable DrawerLayout drawerLayout, SelectionDelegate<E> delegate, int titleResId, @Nullable DrawerLayout drawerLayout,
int normalGroupResId, int selectedGroupResId, int normalGroupResId, int selectedGroupResId,
@Nullable Integer normalBackgroundColorResId,
@Nullable OnMenuItemClickListener listener, boolean showShadowOnSelection, @Nullable OnMenuItemClickListener listener, boolean showShadowOnSelection,
boolean updateStatusBarColor) { boolean updateStatusBarColor) {
mToolbarStub.setLayoutResource(toolbarLayoutId); mToolbarStub.setLayoutResource(toolbarLayoutId);
...@@ -213,7 +209,7 @@ public class SelectableListLayout<E> ...@@ -213,7 +209,7 @@ public class SelectableListLayout<E>
SelectableListToolbar<E> toolbar = (SelectableListToolbar<E>) mToolbarStub.inflate(); SelectableListToolbar<E> toolbar = (SelectableListToolbar<E>) mToolbarStub.inflate();
mToolbar = toolbar; mToolbar = toolbar;
mToolbar.initialize(delegate, titleResId, drawerLayout, normalGroupResId, mToolbar.initialize(delegate, titleResId, drawerLayout, normalGroupResId,
selectedGroupResId, normalBackgroundColorResId, updateStatusBarColor); selectedGroupResId, updateStatusBarColor);
if (listener != null) { if (listener != null) {
mToolbar.setOnMenuItemClickListener(listener); mToolbar.setOnMenuItemClickListener(listener);
......
...@@ -167,16 +167,13 @@ public class SelectableListToolbar<E> ...@@ -167,16 +167,13 @@ public class SelectableListToolbar<E>
* established. * established.
* @param selectedGroupResId The resource id of the menu item to show when a selection is * @param selectedGroupResId The resource id of the menu item to show when a selection is
* established. * established.
* @param normalBackgroundColorResId The resource id of the color to use as the background color
* when selection is not enabled. If null the default appbar
* background color will be used.
* @param updateStatusBarColor Whether the status bar color should be updated to match the * @param updateStatusBarColor Whether the status bar color should be updated to match the
* toolbar color. If true, the status bar will only be updated if * toolbar color. If true, the status bar will only be updated if
* the current device fully supports theming and is on Android M+. * the current device fully supports theming and is on Android M+.
*/ */
public void initialize(SelectionDelegate<E> delegate, int titleResId, public void initialize(SelectionDelegate<E> delegate, int titleResId,
@Nullable DrawerLayout drawerLayout, int normalGroupResId, int selectedGroupResId, @Nullable DrawerLayout drawerLayout, int normalGroupResId, int selectedGroupResId,
@Nullable Integer normalBackgroundColorResId, boolean updateStatusBarColor) { boolean updateStatusBarColor) {
mTitleResId = titleResId; mTitleResId = titleResId;
mDrawerLayout = drawerLayout; mDrawerLayout = drawerLayout;
mNormalGroupResId = normalGroupResId; mNormalGroupResId = normalGroupResId;
...@@ -198,11 +195,8 @@ public class SelectableListToolbar<E> ...@@ -198,11 +195,8 @@ public class SelectableListToolbar<E>
if (mDrawerLayout != null) initActionBarDrawerToggle(); if (mDrawerLayout != null) initActionBarDrawerToggle();
normalBackgroundColorResId = normalBackgroundColorResId != null
? normalBackgroundColorResId
: ColorUtils.getDefaultThemeColor(getResources(), false);
mNormalBackgroundColor = mNormalBackgroundColor =
ApiCompatibilityUtils.getColor(getResources(), normalBackgroundColorResId); ApiCompatibilityUtils.getColor(getResources(), R.color.modern_primary_color);
setBackgroundColor(mNormalBackgroundColor); setBackgroundColor(mNormalBackgroundColor);
mSelectionBackgroundColor = ApiCompatibilityUtils.getColor( mSelectionBackgroundColor = ApiCompatibilityUtils.getColor(
...@@ -213,6 +207,7 @@ public class SelectableListToolbar<E> ...@@ -213,6 +207,7 @@ public class SelectableListToolbar<E>
mLightIconColorList = mLightIconColorList =
AppCompatResources.getColorStateList(getContext(), R.color.white_mode_tint); AppCompatResources.getColorStateList(getContext(), R.color.white_mode_tint);
setTitleTextAppearance(getContext(), R.style.TextAppearance_BlackHeadline);
if (mTitleResId != 0) setTitle(mTitleResId); if (mTitleResId != 0) setTitle(mTitleResId);
// TODO(twellington): add the concept of normal & selected tint to apply to all toolbar // TODO(twellington): add the concept of normal & selected tint to apply to all toolbar
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<font-family />
...@@ -88,12 +88,15 @@ ...@@ -88,12 +88,15 @@
<item name="android:fontFamily">sans-serif</item> <item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
</style> </style>
<!-- This style is overridden downstream to set accent_font_medium as the font family. -->
<style name="TextAppearance.ButtonMediumStyle" parent="TextAppearance.RobotoMediumStyle" />
<!-- Black Text Styles --> <!-- Black Text Styles -->
<!-- TODO(huayinz): remove tools:ignore once these text styles are all used in ui/android --> <!-- TODO(huayinz): remove tools:ignore once these text styles are all used in ui/android -->
<style name="TextAppearance.BlackHeadline" tools:ignore="UnusedResources"> <style name="TextAppearance.BlackHeadline" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_list</item> <item name="android:textColor">@color/default_text_color_list</item>
<item name="android:textSize">@dimen/headline_size</item> <item name="android:textSize">@dimen/headline_size</item>
<item name="android:fontFamily">@font/accent_font</item>
</style> </style>
<style name="TextAppearance.BlackTitle1" tools:ignore="UnusedResources"> <style name="TextAppearance.BlackTitle1" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_list</item> <item name="android:textColor">@color/default_text_color_list</item>
...@@ -139,7 +142,7 @@ ...@@ -139,7 +142,7 @@
<item name="android:textColor">@color/default_text_color_secondary_list</item> <item name="android:textColor">@color/default_text_color_secondary_list</item>
<item name="android:textSize">@dimen/text_size_small</item> <item name="android:textSize">@dimen/text_size_small</item>
</style> </style>
<style name="TextAppearance.BlackButtonText" parent="TextAppearance.RobotoMediumStyle" tools:ignore="UnusedResources"> <style name="TextAppearance.BlackButtonText" parent="TextAppearance.ButtonMediumStyle" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_secondary_list</item> <item name="android:textColor">@color/default_text_color_secondary_list</item>
<item name="android:textSize">@dimen/text_size_medium</item> <item name="android:textSize">@dimen/text_size_medium</item>
</style> </style>
...@@ -153,6 +156,7 @@ ...@@ -153,6 +156,7 @@
<style name="TextAppearance.WhiteHeadline" tools:ignore="UnusedResources"> <style name="TextAppearance.WhiteHeadline" tools:ignore="UnusedResources">
<item name="android:textColor">@android:color/white</item> <item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/headline_size</item> <item name="android:textSize">@dimen/headline_size</item>
<item name="android:fontFamily">@font/accent_font</item>
</style> </style>
<style name="TextAppearance.WhiteBodyIncognito" tools:ignore="UnusedResources"> <style name="TextAppearance.WhiteBodyIncognito" tools:ignore="UnusedResources">
<item name="android:textColor">@color/white_alpha_70</item> <item name="android:textColor">@color/white_alpha_70</item>
...@@ -170,7 +174,10 @@ ...@@ -170,7 +174,10 @@
<item name="android:textColor">@android:color/white</item> <item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/text_size_medium</item> <item name="android:textSize">@dimen/text_size_medium</item>
</style> </style>
<style name="TextAppearance.WhiteButtonText" parent="TextAppearance.WhiteTitle2" /> <style name="TextAppearance.WhiteButtonText" parent="TextAppearance.ButtonMediumStyle">
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/text_size_medium</item>
</style>
<style name="TextAppearance.WhiteLink" tools:ignore="UnusedResources"> <style name="TextAppearance.WhiteLink" tools:ignore="UnusedResources">
<item name="android:textColor">@android:color/white</item> <item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/text_size_medium</item> <item name="android:textSize">@dimen/text_size_medium</item>
...@@ -178,15 +185,18 @@ ...@@ -178,15 +185,18 @@
</style> </style>
<!-- Blue Text Styles --> <!-- Blue Text Styles -->
<style name="TextAppearance.BlueTitle2" parent="TextAppearance.RobotoMediumStyle"> <style name="TextAppearance.BlueTitle2" parent="TextAppearance.RobotoMediumStyle" tools:ignore="UnusedResources">
<item name="android:textColor">@color/blue_when_enabled</item> <item name="android:textColor">@color/blue_when_enabled</item>
<item name="android:textSize">@dimen/text_size_medium</item> <item name="android:textSize">@dimen/text_size_medium</item>
</style> </style>
<style name="TextAppearance.BlueButtonText1" parent="TextAppearance.RobotoMediumStyle" tools:ignore="UnusedResources"> <style name="TextAppearance.BlueButtonText1" parent="TextAppearance.ButtonMediumStyle" tools:ignore="UnusedResources">
<item name="android:textColor">@color/modern_blue_300</item> <item name="android:textColor">@color/modern_blue_300</item>
<item name="android:textSize">@dimen/text_size_medium</item> <item name="android:textSize">@dimen/text_size_medium</item>
</style> </style>
<style name="TextAppearance.BlueButtonText2" parent="TextAppearance.BlueTitle2" /> <style name="TextAppearance.BlueButtonText2" parent="TextAppearance.ButtonMediumStyle">
<item name="android:textColor">@color/blue_when_enabled</item>
<item name="android:textSize">@dimen/text_size_medium</item>
</style>
<style name="TextAppearance.BlueLink1" tools:ignore="UnusedResources"> <style name="TextAppearance.BlueLink1" tools:ignore="UnusedResources">
<item name="android:textColor">@color/blue_when_enabled</item> <item name="android:textColor">@color/blue_when_enabled</item>
<item name="android:textSize">@dimen/text_size_large</item> <item name="android:textSize">@dimen/text_size_large</item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment