Commit d7f7b381 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Modify style of volume slider bubble.

As UX spec is now ready, this CL updates the style of slider bubbles
e.g. volume slider and brightness slider.

TEST=manual
BUG=870473

Change-Id: I8c3ca92e6fd2f8d834c494144578bf06d78276b2
Reviewed-on: https://chromium-review.googlesource.com/1166779
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581808}
parent 44eef5ff
......@@ -4,6 +4,7 @@
#include "ash/system/unified/unified_slider_bubble_controller.h"
#include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/system/audio/unified_volume_slider_controller.h"
......@@ -12,6 +13,7 @@
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/unified/unified_system_tray.h"
#include "ash/system/unified/unified_system_tray_view.h"
using chromeos::CrasAudioHandler;
......@@ -28,6 +30,12 @@ bool IsAnyMainBubbleShown() {
return false;
}
void ConfigureSliderViewStyle(views::View* slider_view) {
slider_view->SetBackground(UnifiedSystemTrayView::CreateBackground());
slider_view->SetBorder(
views::CreateEmptyBorder(kUnifiedTopShortcutSpacing, 0, 0, 0));
}
} // namespace
UnifiedSliderBubbleController::UnifiedSliderBubbleController(
......@@ -124,6 +132,7 @@ void UnifiedSliderBubbleController::ShowBubble(SliderType slider_type) {
UnifiedSliderView* slider_view =
static_cast<UnifiedSliderView*>(slider_controller_->CreateView());
ConfigureSliderViewStyle(slider_view);
bubble_view_->AddChildView(slider_view);
bubble_view_->Layout();
}
......@@ -148,14 +157,16 @@ void UnifiedSliderBubbleController::ShowBubble(SliderType slider_type) {
init_params.parent_window = tray_->GetBubbleWindowContainer();
init_params.anchor_view =
tray_->shelf()->GetSystemTrayAnchor()->GetBubbleAnchor();
init_params.corner_radius = kUnifiedTrayCornerRadius;
init_params.has_shadow = false;
bubble_view_ = new views::TrayBubbleView(init_params);
UnifiedSliderView* slider_view =
static_cast<UnifiedSliderView*>(slider_controller_->CreateView());
ConfigureSliderViewStyle(slider_view);
bubble_view_->AddChildView(slider_view);
bubble_view_->SetBorder(
views::CreateEmptyBorder(kUnifiedTopShortcutSpacing, 0, 0, 0));
bubble_view_->set_color(kUnifiedMenuBackgroundColor);
bubble_view_->set_color(SK_ColorTRANSPARENT);
bubble_view_->layer()->SetFillsBoundsOpaquely(false);
bubble_view_->set_anchor_view_insets(
tray_->shelf()->GetSystemTrayAnchor()->GetBubbleAnchorInsets());
......@@ -164,6 +175,11 @@ void UnifiedSliderBubbleController::ShowBubble(SliderType slider_type) {
TrayBackgroundView::InitializeBubbleAnimations(bubble_widget_);
bubble_view_->InitializeAndShowBubble();
if (app_list::features::IsBackgroundBlurEnabled()) {
bubble_widget_->client_view()->layer()->SetBackgroundBlur(
kUnifiedMenuBackgroundBlur);
}
// Notify value change accessibility event because the popup is triggered by
// changing value using an accessor key like VolUp.
slider_view->slider()->NotifyAccessibilityEvent(
......
......@@ -60,15 +60,6 @@ views::View* CreateNotificationHiddenView() {
return view;
}
std::unique_ptr<views::Background> CreateUnifiedBackground() {
return views::CreateBackgroundFromPainter(
views::Painter::CreateSolidRoundRectPainter(
app_list::features::IsBackgroundBlurEnabled()
? kUnifiedMenuBackgroundColorWithBlur
: kUnifiedMenuBackgroundColor,
kUnifiedTrayCornerRadius));
}
// Border applied to SystemTrayContainer and DetailedViewContainer to iminate
// notification list scrolling under SystemTray part of UnifiedSystemTray.
// The border paints mock notification frame behind the top corners based on
......@@ -120,7 +111,7 @@ class SystemTrayContainer : public views::View {
SystemTrayContainer() {
SetLayoutManager(
std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical));
SetBackground(CreateUnifiedBackground());
SetBackground(UnifiedSystemTrayView::CreateBackground());
SetBorder(std::make_unique<TopCornerBorder>());
}
......@@ -138,7 +129,7 @@ class SystemTrayContainer : public views::View {
class DetailedViewContainer : public views::View {
public:
DetailedViewContainer() {
SetBackground(CreateUnifiedBackground());
SetBackground(UnifiedSystemTrayView::CreateBackground());
SetBorder(std::make_unique<TopCornerBorder>());
}
......@@ -267,7 +258,7 @@ UnifiedSystemTrayView::UnifiedSystemTrayView(
auto* layout = SetLayoutManager(
std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical));
SetBackground(CreateUnifiedBackground());
SetBackground(CreateBackground());
SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false);
......@@ -410,6 +401,16 @@ void UnifiedSystemTrayView::SetNotificationHeightBelowScroll(
SchedulePaint();
}
// static
std::unique_ptr<views::Background> UnifiedSystemTrayView::CreateBackground() {
return views::CreateBackgroundFromPainter(
views::Painter::CreateSolidRoundRectPainter(
app_list::features::IsBackgroundBlurEnabled()
? kUnifiedMenuBackgroundColorWithBlur
: kUnifiedMenuBackgroundColor,
kUnifiedTrayCornerRadius));
}
void UnifiedSystemTrayView::OnGestureEvent(ui::GestureEvent* event) {
gfx::Point screen_location = event->location();
ConvertPointToScreen(this, &screen_location);
......
......@@ -99,6 +99,10 @@ class ASH_EXPORT UnifiedSystemTrayView : public views::View,
// scrolling under SystemTray. |height_below_scroll| should not be negative.
void SetNotificationHeightBelowScroll(int height_below_scroll);
// Create background of UnifiedSystemTray that is semi-transparent and has
// rounded corners.
static std::unique_ptr<views::Background> CreateBackground();
// views::View:
void OnGestureEvent(ui::GestureEvent* event) override;
void ChildPreferredSizeChanged(views::View* child) override;
......
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