Commit 4923e7e1 authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[Avatar button] Increase the icon size to 22dp

This CL increases the icon size (in non-touch-ui) from 20dp to 22dp.
This is the maximum size that can be achieved for a 28dp element  while
having 1dp border and 2dp padding, as required by the UX specs.

This change only applies for the kAnimatedAvatarButton feature.

Bug: 967317
Change-Id: I81a6a7fe07d7469f61f933afbcd25a7f9389df5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825519
Auto-Submit: Jan Krcal <jkrcal@chromium.org>
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Reviewed-by: default avatarThomas Tangl <tangltom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700165}
parent d9738a38
......@@ -70,6 +70,15 @@ bool IsGenericProfile(const ProfileAttributesEntry& entry) {
.GetNumberOfProfiles() == 1;
}
int GetIconSizeForNonTouchUi() {
// Note that the non-touchable icon size is larger than the default to
// make the avatar icon easier to read.
if (base::FeatureList::IsEnabled(features::kAnimatedAvatarButton)) {
return 22;
}
return 20;
}
} // namespace
AvatarToolbarButton::AvatarToolbarButton(Browser* browser)
......@@ -414,10 +423,9 @@ base::string16 AvatarToolbarButton::GetProfileName() const {
gfx::ImageSkia AvatarToolbarButton::GetAvatarIcon(
const gfx::Image& gaia_image) const {
// Note that the non-touchable icon size is larger than the default to
// make the avatar icon easier to read.
const int icon_size =
ui::MaterialDesignController::touch_ui() ? kDefaultTouchableIconSize : 20;
const int icon_size = ui::MaterialDesignController::touch_ui()
? kDefaultTouchableIconSize
: GetIconSizeForNonTouchUi();
SkColor icon_color =
GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
......@@ -532,9 +540,12 @@ AvatarToolbarButton::State AvatarToolbarButton::GetState() const {
}
void AvatarToolbarButton::SetInsets() {
// In non-touch mode we use a larger-than-normal icon size for avatars as 16dp
// is hard to read for user avatars, so we need to set corresponding insets.
gfx::Insets layout_insets(ui::MaterialDesignController::touch_ui() ? 0 : -2);
// In non-touch mode we use a larger-than-normal icon size for avatars so we
// need to compensate it by smaller insets.
gfx::Insets layout_insets(
ui::MaterialDesignController::touch_ui()
? 0
: (kDefaultIconSize - GetIconSizeForNonTouchUi()) / 2);
SetLayoutInsetDelta(layout_insets);
}
......
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