Commit 6cabcc94 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Chromium LUCI CQ

Add bounce animation for tray background views

This CL refactors previous animations for tray background views
to use layer transforms and also adds a new bounce animation
to be used for holding space and screen recorder tray buttons.

Bug: 896739
Change-Id: I29ce064d44eda7ebb3b98f856ba9b2171be0c549
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2589454
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837029}
parent 015fd7a9
...@@ -95,6 +95,8 @@ HoldingSpaceTray::HoldingSpaceTray(Shelf* shelf) : TrayBackgroundView(shelf) { ...@@ -95,6 +95,8 @@ HoldingSpaceTray::HoldingSpaceTray(Shelf* shelf) : TrayBackgroundView(shelf) {
// the holding space model will already have been attached. // the holding space model will already have been attached.
if (HoldingSpaceController::Get()->model()) if (HoldingSpaceController::Get()->model())
OnHoldingSpaceModelAttached(HoldingSpaceController::Get()->model()); OnHoldingSpaceModelAttached(HoldingSpaceController::Get()->model());
set_use_bounce_in_animation(true);
} }
HoldingSpaceTray::~HoldingSpaceTray() = default; HoldingSpaceTray::~HoldingSpaceTray() = default;
......
This diff is collapsed.
...@@ -27,7 +27,7 @@ class TrayEventFilter; ...@@ -27,7 +27,7 @@ class TrayEventFilter;
// inherits from ActionableView so that the tray items can override // inherits from ActionableView so that the tray items can override
// PerformAction when clicked on. // PerformAction when clicked on.
class ASH_EXPORT TrayBackgroundView : public ActionableView, class ASH_EXPORT TrayBackgroundView : public ActionableView,
public ui::ImplicitAnimationObserver, public ui::LayerAnimationObserver,
public ShelfBackgroundAnimatorObserver, public ShelfBackgroundAnimatorObserver,
public TrayBubbleView::Delegate, public TrayBubbleView::Delegate,
public VirtualKeyboardModel::Observer { public VirtualKeyboardModel::Observer {
...@@ -153,6 +153,10 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, ...@@ -153,6 +153,10 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
show_with_virtual_keyboard_ = show_with_virtual_keyboard; show_with_virtual_keyboard_ = show_with_virtual_keyboard;
} }
void set_use_bounce_in_animation(bool use_bounce_in_animation) {
use_bounce_in_animation_ = use_bounce_in_animation;
}
private: private:
class TrayWidgetObserver; class TrayWidgetObserver;
...@@ -165,12 +169,16 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, ...@@ -165,12 +169,16 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
const char* GetClassName() const override; const char* GetClassName() const override;
// ui::ImplicitAnimationObserver: // ui::ImplicitAnimationObserver:
void OnImplicitAnimationsCompleted() override; void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override {}
bool RequiresNotificationWhenAnimatorDestroyed() const override; void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override;
void OnLayerAnimationScheduled(
ui::LayerAnimationSequence* sequence) override {}
// Applies transformations to the |layer()| to animate the view when // Applies transformations to the |layer()| to animate the view when
// SetVisible(false) is called. // SetVisible(false) is called.
void HideTransformation(); void HideAnimation();
void FadeInAnimation();
void BounceInAnimation();
// Helper function that calculates background insets relative to local bounds. // Helper function that calculates background insets relative to local bounds.
gfx::Insets GetBackgroundInsets() const; gfx::Insets GetBackgroundInsets() const;
...@@ -204,6 +212,8 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, ...@@ -204,6 +212,8 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
// If true, the view is visible when the status area is collapsed. // If true, the view is visible when the status area is collapsed.
bool show_when_collapsed_; bool show_when_collapsed_;
bool use_bounce_in_animation_ = false;
std::unique_ptr<TrayWidgetObserver> widget_observer_; std::unique_ptr<TrayWidgetObserver> widget_observer_;
std::unique_ptr<TrayEventFilter> tray_event_filter_; std::unique_ptr<TrayEventFilter> tray_event_filter_;
......
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