Commit 952ec30f authored by Lijin Shen's avatar Lijin Shen Committed by Commit Bot

[snowflake] create non-adaptive semantic text styles

1. rename text styles. Most of them are prefixed by "White".
2. add new text styles. Dark text styles are missing in styles.xml.

For more info, see go/clanktext.

Bug: 775198
Change-Id: I0f4679d022a671a5080d0a587fef8d4c35f05c31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033724
Commit-Queue: Lijin Shen <lazzzis@google.com>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737961}
parent 1aea97bd
......@@ -11,10 +11,6 @@
<style name="TextAppearance.BlueTitle2Incognito" parent="TextAppearance.BlueTitle2">
<item name="android:textColor">@color/modern_blue_300</item>
</style>
<!-- TODO(crbug.com/775198) replaced with headline.primary.dark -->
<style name="TextAppearance.Headline.Primary.Black" parent="TextAppearance.WhiteHeadline">
<item name="android:textColor">@color/default_text_color_dark</item>
</style>
<style name="TabGridDialogTitleTheme">
<item name="colorControlNormal">@color/divider_bg_color</item>
......
......@@ -721,7 +721,8 @@ public class TabGridDialogParent
isHovered ? mUngroupBarHoveredBackgroundColorResourceId
: mUngroupBarBackgroundColorResourceId));
mUngroupBarTextView.setTextAppearance(context,
isHovered ? R.style.TextAppearance_WhiteTitle2 : mUngroupBarTextAppearance);
isHovered ? R.style.TextAppearance_TextMediumThick_Primary_Light
: mUngroupBarTextAppearance);
}
/**
......
......@@ -240,7 +240,7 @@ public class TabGridIphItemView extends FrameLayout {
isIncognito ? R.style.TextAppearance_BlueTitle2Incognito
: R.style.TextAppearance_BlueTitle2);
mIphIntroduction.setTextAppearance(mIphIntroduction.getContext(),
isIncognito ? R.style.TextAppearance_WhiteBody
isIncognito ? R.style.TextAppearance_TextMedium_Primary_Light
: R.style.TextAppearance_TextMedium_Primary);
ApiCompatibilityUtils.setImageTintList(mCloseIPHEntranceButton,
......
......@@ -148,7 +148,7 @@ class TabSelectionEditorMediator
ColorStateList toolbarTintColorList = AppCompatResources.getColorStateList(mContext,
isIncognito ? R.color.dark_text_color_list
: R.color.default_text_color_inverse_list);
int textAppearance = isIncognito ? R.style.TextAppearance_Headline_Primary_Black
int textAppearance = isIncognito ? R.style.TextAppearance_Headline_Primary_Dark
: R.style.TextAppearance_Headline_Inverse;
mModel.set(TabSelectionEditorProperties.PRIMARY_COLOR, primaryColor);
......
......@@ -65,7 +65,7 @@ public class TabUiColorProvider {
* @return The text appearance for the tab grid card title.
*/
public static int getTitleTextAppearance(boolean isIncognito) {
return isIncognito ? R.style.TextAppearance_WhiteTitle2
return isIncognito ? R.style.TextAppearance_TextMediumThick_Primary_Light
: R.style.TextAppearance_TextMediumThick_Primary;
}
......
......@@ -18,7 +18,7 @@
android:id="@+id/contextual_search_iph_tap_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.WhiteBody"
android:textAppearance="@style/TextAppearance.TextMedium.Primary.Light"
android:text="@string/contextual_search_iph_tap"
/>
</LinearLayout>
......@@ -27,13 +27,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/new_tab_otr_title"
android:textAppearance="@style/TextAppearance.WhiteHeadline" />
android:textAppearance="@style/TextAppearance.Headline.Primary.Light" />
<org.chromium.ui.widget.TextViewWithClickableSpans
android:id="@+id/new_tab_incognito_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.WhiteBodyIncognito"
android:textAppearance="@style/TextAppearance.TextMedium.Secondary.Light"
android:lineSpacingExtra="@dimen/md_incognito_ntp_line_spacing" />
<LinearLayout
......@@ -47,14 +47,14 @@
android:id="@+id/new_tab_incognito_features"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.WhiteBodyIncognito"
android:textAppearance="@style/TextAppearance.TextMedium.Secondary.Light"
app:leading="@dimen/text_size_medium_leading" />
<org.chromium.ui.widget.TextViewWithLeading
android:id="@+id/new_tab_incognito_warning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.WhiteBodyIncognito"
android:textAppearance="@style/TextAppearance.TextMedium.Secondary.Light"
app:leading="@dimen/text_size_medium_leading" />
</LinearLayout>
......@@ -89,7 +89,7 @@
<org.chromium.ui.widget.TextViewWithLeading
android:id="@+id/cookie_controls_card_title"
android:text="@string/new_tab_otr_third_party_cookie"
android:textAppearance="@style/TextAppearance.WhiteTitle1"
android:textAppearance="@style/TextAppearance.TextLarge.Primary.Light"
android:layout_marginBottom="@dimen/md_incognito_ntp_line_spacing"
android:layout_alignParentStart="true"
android:layout_height="wrap_content"
......@@ -97,7 +97,7 @@
<org.chromium.ui.widget.TextViewWithLeading
android:text="@string/new_tab_otr_third_party_cookie_sublabel"
android:textAppearance="@style/TextAppearance.WhiteBodyIncognito"
android:textAppearance="@style/TextAppearance.TextMedium.Secondary.Light"
android:layout_alignParentStart="true"
android:layout_toStartOf="@id/cookie_controls_card_toggle"
android:layout_below="@id/cookie_controls_card_title"
......
......@@ -48,7 +48,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginEnd="3dp"
style="@style/TextAppearance.WhiteBody"/>
style="@style/TextAppearance.TextMedium.Primary.Light"/>
<ImageView
android:id="@+id/small_play_button"
......
......@@ -48,7 +48,7 @@
android:layout_gravity="bottom|start"
android:layout_marginStart="16dp"
android:paddingBottom="24dp"
style="@style/TextAppearance.WhiteBody" />
style="@style/TextAppearance.TextMedium.Primary.Light" />
<ImageView
android:id="@+id/mute"
android:layout_width="wrap_content"
......
......@@ -246,7 +246,7 @@
<!-- Manage Space Activity styles -->
<style name="ManageSpaceActionBarModern" parent="SettingsActionBarModern">
<item name="titleTextStyle">@style/TextAppearance.WhiteHeadline</item>
<item name="titleTextStyle">@style/TextAppearance.Headline.Primary.Light</item>
</style>
<style name="ManageSpaceActivityButton">
<item name="android:layout_width">wrap_content</item>
......
......@@ -327,9 +327,10 @@ public class AccessibilityTabModelListItem extends FrameLayout implements OnClic
if (mTab.isIncognito()) {
setBackgroundResource(R.color.dark_primary_color);
mFaviconView.getBackground().setLevel(mIncognitoLevel);
ApiCompatibilityUtils.setTextAppearance(mTitleView, R.style.TextAppearance_WhiteTitle1);
ApiCompatibilityUtils.setTextAppearance(
mDescriptionView, R.style.TextAppearance_WhiteBody);
mTitleView, R.style.TextAppearance_TextLarge_Primary_Light);
ApiCompatibilityUtils.setTextAppearance(
mDescriptionView, R.style.TextAppearance_TextMedium_Primary_Light);
ApiCompatibilityUtils.setImageTintList(mCloseButton, mIncognitoCloseIconColor);
} else {
setBackgroundResource(R.color.modern_primary_color);
......
......@@ -76,7 +76,7 @@ public class AutofillUiUtils {
OffsetProvider offsetProvider, View anchorView, final Runnable dismissAction) {
TextView textView = new TextView(context);
textView.setText(text);
TextViewCompat.setTextAppearance(textView, R.style.TextAppearance_WhiteBody);
TextViewCompat.setTextAppearance(textView, R.style.TextAppearance_TextMedium_Primary_Light);
Resources resources = context.getResources();
int hPadding = resources.getDimensionPixelSize(R.dimen.autofill_tooltip_horizontal_padding);
int vPadding = resources.getDimensionPixelSize(R.dimen.autofill_tooltip_vertical_padding);
......
......@@ -250,7 +250,7 @@ public class OfflineIndicatorController implements ConnectivityDetector.Observer
.setSingleLine(true)
.setProfileImage(icon)
.setBackgroundColor(Color.BLACK)
.setTextAppearance(R.style.TextAppearance_WhiteBody)
.setTextAppearance(R.style.TextAppearance_TextMedium_Primary_Light)
.setDuration(SNACKBAR_DURATION_MS)
.setAction(chromeActivity.getString(
R.string.offline_indicator_view_offline_content),
......
......@@ -47,7 +47,7 @@ public class AutoSigninSnackbarController implements SnackbarManager.SnackbarCon
snackbar.setSingleLine(false)
.setBackgroundColor(backgroundColor)
.setProfileImage(icon)
.setTextAppearance(R.style.TextAppearance_WhiteBody);
.setTextAppearance(R.style.TextAppearance_TextMedium_Primary_Light);
snackbarManager.showSnackbar(snackbar);
}
......
......@@ -118,10 +118,11 @@ class BrowsingModeBottomToolbarMediator implements ThemeColorObserver {
}
FeatureHighlightProvider.getInstance().buildForView(activity, anchor, titleId,
FeatureHighlightProvider.TextAlignment.CENTER, R.style.TextAppearance_WhiteTitle1,
descId, FeatureHighlightProvider.TextAlignment.CENTER,
R.style.TextAppearance_WhiteBody, innerBackgroundColor, finalOuterColor,
finalScrimColor, FeatureHighlightProvider.NO_TIMEOUT, tapToDismiss,
FeatureHighlightProvider.TextAlignment.CENTER,
R.style.TextAppearance_TextLarge_Primary_Light, descId,
FeatureHighlightProvider.TextAlignment.CENTER,
R.style.TextAppearance_TextMedium_Primary_Light, innerBackgroundColor,
finalOuterColor, finalScrimColor, FeatureHighlightProvider.NO_TIMEOUT, tapToDismiss,
completeRunnable);
}
......
......@@ -70,7 +70,7 @@
android:layout_marginBottom="14dp"
android:layout_weight="1"
android:textAlignment="viewStart"
android:textAppearance="@style/TextAppearance.WhiteBody" />
android:textAppearance="@style/TextAppearance.TextMedium.Primary.Light" />
<org.chromium.ui.widget.ButtonCompat
android:id="@+id/snackbar_button"
......
......@@ -134,51 +134,55 @@
on a light background) and light when the app is in dark theme (for
display on a dark background).
-->
<style name="TextAppearance.Headline.Primary" tools:ignore="UnusedResources">
<style name="TextAppearance.Headline.Primary">
<item name="android:textColor">@color/default_text_color_list</item>
</style>
<style name="TextAppearance.TextLarge.Primary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextLarge.Primary">
<item name="android:textColor">@color/default_text_color_list</item>
</style>
<style name="TextAppearance.TextLarge.Secondary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextLarge.Secondary">
<item name="android:textColor">@color/default_text_color_secondary_list</item>
</style>
<style name="TextAppearance.TextLarge.Tertiary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextLarge.Tertiary">
<item name="android:textColor">@color/default_text_color_tertiary</item>
</style>
<style name="TextAppearance.TextMediumThick.Primary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextMediumThick.Primary">
<item name="android:textColor">@color/default_text_color_list</item>
</style>
<style name="TextAppearance.TextMediumThick.Secondary">
<item name="android:textColor">@color/default_text_color_secondary_list</item>
</style>
<style name="TextAppearance.TextAccentMediumThick.Secondary" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_secondary_list</item>
</style>
<style name="TextAppearance.TextMedium.Primary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextMedium.Primary">
<item name="android:textColor">@color/default_text_color_list</item>
</style>
<style name="TextAppearance.TextMedium.Secondary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextMedium.Secondary">
<item name="android:textColor">@color/default_text_color_secondary_list</item>
</style>
<style name="TextAppearance.TextMedium.Tertiary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextMedium.Tertiary">
<item name="android:textColor">@color/default_text_color_tertiary</item>
</style>
<style name="TextAppearance.TextSmall.Primary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextSmall.Primary">
<item name="android:textColor">@color/default_text_color_list</item>
</style>
<style name="TextAppearance.TextSmall.Secondary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextSmall.Secondary">
<item name="android:textColor">@color/default_text_color_secondary_list</item>
</style>
<style name="TextAppearance.TextSmall.Tertiary" tools:ignore="UnusedResources">
<style name="TextAppearance.TextSmall.Tertiary">
<item name="android:textColor">@color/default_text_color_tertiary</item>
</style>
......@@ -193,28 +197,38 @@
<item name="android:textStyle">bold</item>
</style>
<!-- White Text Styles -->
<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>
<!-- Non Adaptive Text Styles -->
<!-- Light version -->
<style name="TextAppearance.Headline.Primary.Light" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_light</item>
</style>
<style name="TextAppearance.WhiteBodyIncognito" tools:ignore="UnusedResources">
<item name="android:textColor">@color/white_alpha_70</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<style name="TextAppearance.TextLarge.Primary.Light" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_light</item>
</style>
<style name="TextAppearance.WhiteBody" tools:ignore="UnusedResources">
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<style name="TextAppearance.TextMediumThick.Primary.Light" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_light</item>
</style>
<style name="TextAppearance.WhiteTitle1" tools:ignore="UnusedResources">
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/text_size_large</item>
<style name="TextAppearance.TextMedium.Primary.Light" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_light</item>
</style>
<style name="TextAppearance.WhiteTitle2" parent="TextAppearance.RobotoMediumStyle" tools:ignore="UnusedResources">
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<style name="TextAppearance.TextSmall.Primary.Light" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_light</item>
</style>
<style name="TextAppearance.TextLarge.Secondary.Light" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_secondary_light</item>
</style>
<style name="TextAppearance.TextMedium.Secondary.Light" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_secondary_light</item>
</style>
<style name="TextAppearance.TextLarge.Tertiary.Light" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_tertiary_light</item>
</style>
<style name="TextAppearance.TextSmall.Tertiary.Light" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_tertiary_light</item>
</style>
<style name="TextAppearance.WhiteButtonText" parent="TextAppearance.AccentMediumStyle">
<item name="android:textColor">@color/default_text_color_inverse</item>
<item name="android:textSize">@dimen/text_size_medium</item>
......@@ -225,14 +239,51 @@
<item name="android:textStyle">bold</item>
</style>
<!-- Dark version -->
<style name="TextAppearance.Headline.Primary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_dark</item>
</style>
<style name="TextAppearance.TextLarge.Primary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_dark</item>
</style>
<style name="TextAppearance.TextMedium.Primary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_dark</item>
</style>
<style name="TextAppearance.TextSmall.Primary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_dark</item>
</style>
<style name="TextAppearance.TextLarge.Secondary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_secondary_dark</item>
</style>
<style name="TextAppearance.TextMedium.Secondary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_secondary_dark</item>
</style>
<style name="TextAppearance.TextSmall.Secondary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_secondary_dark</item>
</style>
<style name="TextAppearance.TextMediumThick.Secondary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_secondary_dark</item>
</style>
<style name="TextAppearance.TextLarge.Tertiary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_tertiary_dark</item>
</style>
<style name="TextAppearance.TextMedium.Tertiary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_tertiary_dark</item>
</style>
<style name="TextAppearance.TextSmall.Tertiary.Dark" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_tertiary_dark</item>
</style>
<!-- Text styles used on dark background on light theme, and light background on dark theme. -->
<style name="TextAppearance.Headline.Inverse" parent="TextAppearance.WhiteHeadline" tools:ignore="UnusedResources">
<style name="TextAppearance.Headline.Inverse" parent="TextAppearance.Headline.Primary" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_inverse</item>
</style>
<style name="TextAppearance.Body.Inverse" parent="TextAppearance.WhiteBody" tools:ignore="UnusedResources">
<style name="TextAppearance.Body.Inverse" parent="TextAppearance.TextMedium.Primary" tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_inverse</item>
</style>
<style name="TextAppearance.Title2.Inverse" parent="TextAppearance.WhiteTitle2"
<style name="TextAppearance.Title2.Inverse" parent="TextAppearance.TextMediumThick.Primary"
tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_inverse</item>
</style>
......
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