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?
<issue id="InconsistentArrays" severity="Error">
<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="preloaded_fonts.xml"/>
</issue>
<issue id="InconsistentLayout" severity="ignore"/>
<issue id="InefficientWeight" severity="Error">
......
......@@ -20,5 +20,5 @@
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="@style/TextAppearance.BlackHeadline" />
android:textAppearance="@style/TextAppearance.AlertDialogTitleStyle" />
</LinearLayout>
\ No newline at end of file
......@@ -106,7 +106,7 @@
<style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<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>
<!-- Overriding AppCompat values -->
......@@ -118,8 +118,15 @@
<item name="spinnerStyle">@style/SpinnerStyle</item>
</style>
<style name="AlertDialogTitleStyle" parent="RtlOverlay.DialogWindowTitle.AppCompat">
<item name="android:textAppearance">@style/TextAppearance.BlackHeadline</item>
<!-- Styled to match BlackHeadline but setup to override values in the app compat parent theme.
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>
<!-- The dim amount should match the alpha of modal_dialog_scrim_color. -->
......
......@@ -152,8 +152,7 @@ public class BookmarkManager implements BookmarkDelegate, SearchDelegate,
mToolbar = (BookmarkActionBar) mSelectableListLayout.initializeToolbar(
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,
isDialogUi);
R.id.selection_mode_menu_group, null, true, isDialogUi);
mToolbar.initializeSearchView(
this, R.string.bookmark_action_bar_search, R.id.search_menu_id);
......
......@@ -139,8 +139,8 @@ public class PickerCategoryView
int titleId = multiSelectionAllowed ? R.string.contacts_picker_select_contacts
: R.string.contacts_picker_select_contact;
mToolbar = (ContactsPickerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.contacts_picker_toolbar, mSelectionDelegate, titleId, null, 0, 0,
R.color.modern_primary_color, null, false, false);
R.layout.contacts_picker_toolbar, mSelectionDelegate, titleId, null, 0, 0, null,
false, false);
mToolbar.setNavigationOnClickListener(this);
mToolbar.initializeSearchView(this, R.string.contacts_picker_search, 0);
......
......@@ -112,8 +112,7 @@ public class ToolbarCoordinator implements SelectionObserver<ListItem> {
mShadow = mView.findViewById(R.id.shadow);
mToolbar.initialize(selectionDelegate, 0 /* titleResId */, null /* drawerLayout */,
normalMenuGroupId, R.id.selection_mode_menu_group, R.color.modern_primary_color,
hasCloseButton);
normalMenuGroupId, R.id.selection_mode_menu_group, hasCloseButton);
mToolbar.setOnMenuItemClickListener(this ::onMenuItemClick);
// TODO(crbug.com/881037): Pass the visible group to the toolbar during initialization.
......
......@@ -236,8 +236,7 @@ public class DownloadManagerUi implements OnMenuItemClickListener, SearchDelegat
mToolbar = (DownloadManagerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.download_manager_toolbar, mBackendProvider.getSelectionDelegate(), 0, null,
normalGroupId, R.id.selection_mode_menu_group, R.color.modern_primary_color, this,
true, isSeparateActivity);
normalGroupId, R.id.selection_mode_menu_group, this, true, isSeparateActivity);
mToolbar.getMenu().setGroupVisible(normalGroupId, true);
mToolbar.setManager(this);
mToolbar.initialize(mFilterAdapter);
......
......@@ -125,8 +125,8 @@ public class HistoryManager implements OnMenuItemClickListener, SignInStateObser
// 3. Initialize toolbar.
mToolbar = (HistoryManagerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.history_toolbar, mSelectionDelegate, R.string.menu_history, null,
R.id.normal_menu_group, R.id.selection_mode_menu_group,
R.color.modern_primary_color, this, true, isSeparateActivity);
R.id.normal_menu_group, R.id.selection_mode_menu_group, this, true,
isSeparateActivity);
mToolbar.setManager(this);
mToolbar.initializeSearchView(this, R.string.history_manager_search, R.id.search_menu_id);
mToolbar.setInfoMenuItem(R.id.info_menu_id);
......
......@@ -154,8 +154,8 @@ public class PickerCategoryView extends RelativeLayout
int titleId = multiSelectionAllowed ? R.string.photo_picker_select_images
: R.string.photo_picker_select_image;
PhotoPickerToolbar toolbar = (PhotoPickerToolbar) mSelectableListLayout.initializeToolbar(
R.layout.photo_picker_toolbar, mSelectionDelegate, titleId, null, 0, 0,
R.color.default_primary_color, null, false, false);
R.layout.photo_picker_toolbar, mSelectionDelegate, titleId, null, 0, 0, null, false,
false);
toolbar.setNavigationOnClickListener(this);
Button doneButton = (Button) toolbar.findViewById(R.id.done);
doneButton.setOnClickListener(this);
......
......@@ -192,9 +192,6 @@ public class SelectableListLayout<E>
* established.
* @param selectedGroupResId The resource id of the menu item to show when a selection is
* 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 showShadowOnSelection Whether to show the toolbar shadow on selection.
* @param updateStatusBarColor Whether the status bar color should be updated to match the
......@@ -205,7 +202,6 @@ public class SelectableListLayout<E>
public SelectableListToolbar<E> initializeToolbar(int toolbarLayoutId,
SelectionDelegate<E> delegate, int titleResId, @Nullable DrawerLayout drawerLayout,
int normalGroupResId, int selectedGroupResId,
@Nullable Integer normalBackgroundColorResId,
@Nullable OnMenuItemClickListener listener, boolean showShadowOnSelection,
boolean updateStatusBarColor) {
mToolbarStub.setLayoutResource(toolbarLayoutId);
......@@ -213,7 +209,7 @@ public class SelectableListLayout<E>
SelectableListToolbar<E> toolbar = (SelectableListToolbar<E>) mToolbarStub.inflate();
mToolbar = toolbar;
mToolbar.initialize(delegate, titleResId, drawerLayout, normalGroupResId,
selectedGroupResId, normalBackgroundColorResId, updateStatusBarColor);
selectedGroupResId, updateStatusBarColor);
if (listener != null) {
mToolbar.setOnMenuItemClickListener(listener);
......
......@@ -167,16 +167,13 @@ public class SelectableListToolbar<E>
* established.
* @param selectedGroupResId The resource id of the menu item to show when a selection is
* 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
* toolbar color. If true, the status bar will only be updated if
* the current device fully supports theming and is on Android M+.
*/
public void initialize(SelectionDelegate<E> delegate, int titleResId,
@Nullable DrawerLayout drawerLayout, int normalGroupResId, int selectedGroupResId,
@Nullable Integer normalBackgroundColorResId, boolean updateStatusBarColor) {
boolean updateStatusBarColor) {
mTitleResId = titleResId;
mDrawerLayout = drawerLayout;
mNormalGroupResId = normalGroupResId;
......@@ -198,11 +195,8 @@ public class SelectableListToolbar<E>
if (mDrawerLayout != null) initActionBarDrawerToggle();
normalBackgroundColorResId = normalBackgroundColorResId != null
? normalBackgroundColorResId
: ColorUtils.getDefaultThemeColor(getResources(), false);
mNormalBackgroundColor =
ApiCompatibilityUtils.getColor(getResources(), normalBackgroundColorResId);
ApiCompatibilityUtils.getColor(getResources(), R.color.modern_primary_color);
setBackgroundColor(mNormalBackgroundColor);
mSelectionBackgroundColor = ApiCompatibilityUtils.getColor(
......@@ -213,6 +207,7 @@ public class SelectableListToolbar<E>
mLightIconColorList =
AppCompatResources.getColorStateList(getContext(), R.color.white_mode_tint);
setTitleTextAppearance(getContext(), R.style.TextAppearance_BlackHeadline);
if (mTitleResId != 0) setTitle(mTitleResId);
// 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 @@
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">bold</item>
</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 -->
<!-- TODO(huayinz): remove tools:ignore once these text styles are all used in ui/android -->
<style name="TextAppearance.BlackHeadline" tools:ignore="UnusedResources">
<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>
</style>
<style name="TextAppearance.BlackTitle1" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_list</item>
......@@ -139,7 +142,7 @@
<item name="android:textColor">@color/default_text_color_secondary_list</item>
<item name="android:textSize">@dimen/text_size_small</item>
</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:textSize">@dimen/text_size_medium</item>
</style>
......@@ -153,6 +156,7 @@
<style name="TextAppearance.WhiteHeadline" tools:ignore="UnusedResources">
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/headline_size</item>
<item name="android:fontFamily">@font/accent_font</item>
</style>
<style name="TextAppearance.WhiteBodyIncognito" tools:ignore="UnusedResources">
<item name="android:textColor">@color/white_alpha_70</item>
......@@ -170,7 +174,10 @@
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/text_size_medium</item>
</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">
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/text_size_medium</item>
......@@ -178,15 +185,18 @@
</style>
<!-- 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:textSize">@dimen/text_size_medium</item>
</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:textSize">@dimen/text_size_medium</item>
</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">
<item name="android:textColor">@color/blue_when_enabled</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