Commit ae84ee84 authored by Gang Wu's avatar Gang Wu Committed by Commit Bot

Update chip shapes and dark mode style for app menu

Bug: 1145671

Change-Id: I17ea9d42403b106a9f8ca00646e78c67ac3d1eb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2521165
Commit-Queue: Gang Wu <gangwu@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarLijin Shen <lazzzis@google.com>
Cr-Commit-Position: refs/heads/master@{#826897}
parent 457bb54e
......@@ -27,7 +27,7 @@
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginEnd="16dp"
style="@style/Chip"
style="@style/MenuChip"
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
......@@ -97,8 +97,6 @@ class ChipViewMenuItemViewBinder implements CustomViewBinder {
holder.chipView.setVisibility(View.VISIBLE);
holder.chipView.getPrimaryTextView().setText(chipViewMenuItem.getTitle());
holder.chipView.setEnabled(chipViewMenuItem.isEnabled());
// Use selected chip color.
holder.chipView.setSelected(true);
final MenuItem finalChipViewMenuItem = chipViewMenuItem;
holder.chipView.setOnClickListener(
v -> appMenuClickHandler.onItemClick(finalChipViewMenuItem));
......
......@@ -371,8 +371,8 @@ public class TabbedAppMenuTest {
int downloadRowIndex = findIndexOfMenuItemById(R.id.downloads_row_menu_id);
Assert.assertNotEquals("No download row found.", -1, downloadRowIndex);
mRenderTestRule.render(
getListView().getChildAt(downloadRowIndex), "download_row_action_chip_view");
mRenderTestRule.render(getListView().getChildAt(downloadRowIndex),
"download_row_rounded_action_chip_view");
MenuItem bookmarkRow = AppMenuTestSupport.getMenu(mActivityTestRule.getAppMenuCoordinator())
.findItem(R.id.all_bookmarks_row_menu_id);
......@@ -380,8 +380,8 @@ public class TabbedAppMenuTest {
Assert.assertFalse("Bookmark item should not be checked.", bookmarkMenuItem.isChecked());
int bookmarkRowIndex = findIndexOfMenuItemById(R.id.all_bookmarks_row_menu_id);
Assert.assertTrue("No bookmark row found.", bookmarkRowIndex != -1);
mRenderTestRule.render(
getListView().getChildAt(bookmarkRowIndex), "bookmark_row_action_chip_view");
mRenderTestRule.render(getListView().getChildAt(bookmarkRowIndex),
"bookmark_row_rounded_action_chip_view");
TestThreadUtils.runOnUiThreadBlocking(() -> mAppMenuHandler.hideAppMenu());
AppMenuPropertiesDelegateImpl.setPageBookmarkedForTesting(true);
......@@ -393,7 +393,7 @@ public class TabbedAppMenuTest {
bookmarkMenuItem = bookmarkRow.getSubMenu().getItem(1);
Assert.assertTrue("Bookmark item should be checked.", bookmarkMenuItem.isChecked());
mRenderTestRule.render(getListView().getChildAt(bookmarkRowIndex),
"bookmark_row_action_chip_view_bookmarked");
"bookmark_row_rounded_action_chip_view_bookmarked");
AppMenuPropertiesDelegateImpl.setPageBookmarkedForTesting(null);
}
......@@ -413,8 +413,8 @@ public class TabbedAppMenuTest {
int downloadRowIndex = findIndexOfMenuItemById(R.id.downloads_row_menu_id);
Assert.assertNotEquals("No download row found.", -1, downloadRowIndex);
mRenderTestRule.render(
getListView().getChildAt(downloadRowIndex), "download_row_destination_chip_view");
mRenderTestRule.render(getListView().getChildAt(downloadRowIndex),
"download_row_rounded_destination_chip_view");
MenuItem bookmarkRow = AppMenuTestSupport.getMenu(mActivityTestRule.getAppMenuCoordinator())
.findItem(R.id.all_bookmarks_row_menu_id);
......@@ -422,8 +422,8 @@ public class TabbedAppMenuTest {
Assert.assertFalse("Bookmark item should not be checked.", bookmarkMenuItem.isChecked());
int bookmarkRowIndex = findIndexOfMenuItemById(R.id.all_bookmarks_row_menu_id);
Assert.assertTrue("No bookmark row found.", bookmarkRowIndex != -1);
mRenderTestRule.render(
getListView().getChildAt(bookmarkRowIndex), "bookmark_row_destination_chip_view");
mRenderTestRule.render(getListView().getChildAt(bookmarkRowIndex),
"bookmark_row_rounded_destination_chip_view");
TestThreadUtils.runOnUiThreadBlocking(() -> mAppMenuHandler.hideAppMenu());
AppMenuPropertiesDelegateImpl.setPageBookmarkedForTesting(true);
......@@ -435,7 +435,7 @@ public class TabbedAppMenuTest {
bookmarkMenuItem = bookmarkRow.getSubMenu().getItem(1);
Assert.assertTrue("Bookmark item should be checked.", bookmarkMenuItem.isChecked());
mRenderTestRule.render(getListView().getChildAt(bookmarkRowIndex),
"bookmark_row_destination_chip_view_bookmarked");
"bookmark_row_rounded_destination_chip_view_bookmarked");
AppMenuPropertiesDelegateImpl.setPageBookmarkedForTesting(null);
}
......
......@@ -152,6 +152,7 @@ android_resources("ui_java_resources") {
"java/res/color/default_text_color_secondary_list.xml",
"java/res/color/filled_button_bg.xml",
"java/res/color/filled_button_ripple_color.xml",
"java/res/color/menu_chip_background.xml",
"java/res/color/text_button_ripple_color.xml",
"java/res/drawable-hdpi/btn_close.png",
"java/res/drawable-hdpi/ic_expand_less_black_24dp.png",
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/menu_chip_background_color_disabled" android:state_enabled="false" />
<item android:color="@color/menu_chip_background_color"/>
</selector>
\ No newline at end of file
......@@ -79,4 +79,6 @@
<color name="image_loading_color">@color/image_loading_color_light</color>
<color name="promo_illustration_bg_color">@color/promo_illustration_bg_color_dark</color>
<color name="preference_highlighted_bg_color">@color/preference_highlighted_bg_color_light</color>
<color name="menu_chip_background_color">@color/menu_chip_background_color_light</color>
<color name="menu_chip_background_color_disabled">@color/menu_chip_background_color_disabled_light</color>
</resources>
......@@ -103,6 +103,14 @@
<item name="android:textAlignment">center</item>
</style>
<style name="MenuChip" parent="Chip">
<item name="cornerRadius">@dimen/chip_default_height</item>
<item name="primaryTextAppearance">@style/TextAppearance.MenuChip.Text.Blue</item>
<item name="chipColor">@color/menu_chip_background</item>
<item name="solidColorChip">true</item>
<item name="verticalInset">@dimen/menu_chip_vertical_inset</item>
</style>
<!-- Used by Chrome and Content -->
<style name="TextAppearance" parent="android:TextAppearance" tools:ignore="UnusedResources" />
<style name="TextAppearance.RobotoMediumStyle">
......@@ -335,6 +343,9 @@
tools:ignore="UnusedResources">
<item name="android:textColor">@color/default_text_color_inverse_list</item>
</style>
<style name="TextAppearance.MenuChip.Text.Blue" parent="TextAppearance.Button.Text.Blue">
<item name="android:textSize">@dimen/text_size_small</item>
</style>
<!-- Blue Non Adaptive Text Styles -->
<style name="TextAppearance.TextMedium.Blue.Light" tools:ignore="UnusedResources">
......
......@@ -11,6 +11,7 @@
<color name="modern_blue_300_alpha_10" tools:ignore="UnusedResources">#198AB4F8</color>
<color name="modern_blue_300_alpha_55" tools:ignore="UnusedResources">#5A7198</color>
<color name="modern_blue_600">#1A73E8</color>
<color name="modern_blue_600_alpha_6">#0F1A73E8</color>
<color name="modern_blue_600_alpha_10" tools:ignore="UnusedResources">#191A73E8</color>
<color name="modern_blue_600_alpha_12">#1F1A73E8</color>
<color name="modern_blue_600_alpha_65" tools:ignore="UnusedResources">#6AA4F0</color>
......@@ -41,6 +42,7 @@
<color name="black_alpha_38" tools:ignore="UnusedResources">#61000000</color>
<color name="black_alpha_65" tools:ignore="UnusedResources">#A6000000</color>
<color name="white_alpha_6">#0FFFFFFF</color>
<color name="white_alpha_8" tools:ignore="UnusedResources">#14FFFFFF</color>
<color name="white_alpha_10" tools:ignore="UnusedResources">#1AFFFFFF</color>
<color name="white_alpha_12" tools:ignore="UnusedResources">#1FFFFFFF</color>
......
......@@ -52,6 +52,8 @@
<dimen name="chip_end_padding_with_end_icon">6dp</dimen>
<dimen name="chip_extended_end_padding_with_end_icon">16dp</dimen>
<dimen name="chip_text_multiline_vertical_padding">12dp</dimen>
<!-- ( listPreferredItemHeightSmall(40dp) - text size(12sp) - top and bottom padding(8dp) ) / 2 -->
<dimen name="menu_chip_vertical_inset">10dp</dimen>
<!-- Dropdown default measures -->
<dimen name="dropdown_item_height">50dp</dimen>
......
......@@ -115,4 +115,6 @@
<color name="image_loading_color" tools:ignore="UnusedResources">@color/image_loading_color_dark</color>
<color name="promo_illustration_bg_color" tools:ignore="UnusedResources">@color/promo_illustration_bg_color_light</color>
<color name="preference_highlighted_bg_color">@color/preference_highlighted_bg_color_dark</color>
<color name="menu_chip_background_color">@color/menu_chip_background_color_dark</color>
<color name="menu_chip_background_color_disabled">@color/menu_chip_background_color_disabled_dark</color>
</resources>
......@@ -71,6 +71,10 @@
<color name="chip_selected_focused_dark">@color/modern_blue_600_alpha_12</color>
<color name="chip_selected_hover_and_focused_light">@color/white_alpha_24</color>
<color name="chip_selected_hover_and_focused_dark">@color/modern_blue_600_alpha_12</color>
<color name="menu_chip_background_color_dark">@color/modern_blue_600_alpha_6</color>
<color name="menu_chip_background_color_light">@color/modern_blue_300_alpha_10</color>
<color name="menu_chip_background_color_disabled_dark">@color/modern_grey_100_alpha_38</color>
<color name="menu_chip_background_color_disabled_light">@color/white_alpha_6</color>
<!-- Colors used for Widgets (checkboxes, switches, buttons, etc)-->
<color name="default_control_color_active_light" tools:ignore="UnusedResources">@color/modern_blue_600</color>
......
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