Commit d8115a08 authored by Matthew Mourgos's avatar Matthew Mourgos Committed by Commit Bot

CrOS Shelf: Change hotseat color between in-app and home shelf.

In this change, the hotseat background will change color for different
shelf states and will animate between colors when changing. When in-app
shelf is shown the hotseat color should have an alpha value of 90%.
When the home shelf is shown the hotseat color should have an alpha
value of 60%.

Bug: 1041132
Change-Id: I9459fbb61cbc538029039cd48c04144a98ab82c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003919Reviewed-by: default avatarManu Cornet <manucornet@chromium.org>
Commit-Queue: Matthew Mourgos <mmourgos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734159}
parent 8e4f51d5
......@@ -126,6 +126,9 @@ class HotseatWidget::DelegateView : public views::WidgetDelegateView,
// The WallpaperController, responsible for providing proper colors.
WallpaperControllerImpl* wallpaper_controller_;
// The most recent color that the |opaque_background_| has been animated to.
SkColor target_color_;
DISALLOW_COPY_AND_ASSIGN(DelegateView);
};
......@@ -167,7 +170,20 @@ void HotseatWidget::DelegateView::SetOpaqueBackground(
DCHECK(HotseatWidget::ShouldShowHotseatBackground());
opaque_background_.SetVisible(true);
opaque_background_.SetColor(ShelfConfig::Get()->GetDefaultShelfColor());
if (ShelfConfig::Get()->GetDefaultShelfColor() != target_color_) {
target_color_ = ShelfConfig::Get()->GetDefaultShelfColor();
ui::ScopedLayerAnimationSettings animation_setter(
opaque_background_.GetAnimator());
animation_setter.SetTransitionDuration(
ShelfConfig::Get()->shelf_animation_duration());
animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
animation_setter.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
opaque_background_.SetColor(target_color_);
}
const int radius = ShelfConfig::Get()->hotseat_size() / 2;
gfx::RoundedCornersF rounded_corners = {radius, radius, radius, radius};
......
......@@ -304,10 +304,20 @@ SkColor ShelfConfig::GetDefaultShelfColor() const {
AshColorProvider::AshColorMode::kDark);
}
AshColorProvider::BaseLayerType layer_type;
if (!chromeos::switches::ShouldShowShelfHotseat()) {
layer_type = IsTabletMode()
? AshColorProvider::BaseLayerType::kTransparent60
: AshColorProvider::BaseLayerType::kTransparent74;
} else if (IsTabletMode()) {
layer_type = is_in_app() ? AshColorProvider::BaseLayerType::kTransparent90
: AshColorProvider::BaseLayerType::kTransparent60;
} else {
layer_type = AshColorProvider::BaseLayerType::kTransparent74;
}
SkColor final_color = AshColorProvider::Get()->GetBaseLayerColor(
IsTabletMode() ? AshColorProvider::BaseLayerType::kTransparent60
: AshColorProvider::BaseLayerType::kTransparent74,
AshColorProvider::AshColorMode::kDark);
layer_type, AshColorProvider::AshColorMode::kDark);
return GetThemedColorFromWallpaper(final_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