Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: ui/views/animation/ink_drop_animation_controller_impl.h

Issue 1422593003: Made material design ink drop QUICK_ACTION animation more visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed varkha@'s comments and minor fixes. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/animation/ink_drop_animation_controller_impl.h
diff --git a/ui/views/animation/ink_drop_animation_controller_impl.h b/ui/views/animation/ink_drop_animation_controller_impl.h
index 5ca25633ba16cb6687e34b07ac96af79fdb7ad75..14e14fb3f768d7874963b9f334fba3e1b25519ab 100644
--- a/ui/views/animation/ink_drop_animation_controller_impl.h
+++ b/ui/views/animation/ink_drop_animation_controller_impl.h
@@ -12,9 +12,15 @@
#include "ui/views/animation/ink_drop_animation_observer.h"
#include "ui/views/views_export.h"
+namespace base {
+class OneShotTimer;
+} // namespace base
+
namespace views {
class InkDropAnimation;
+class InkDropConsumer;
class InkDropHost;
+class InkDropHover;
// A functional implementation of an InkDropAnimationController.
class VIEWS_EXPORT InkDropAnimationControllerImpl
@@ -23,12 +29,16 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl
public:
// Constructs an ink drop controller that will attach the ink drop to the
// given |ink_drop_host|.
- explicit InkDropAnimationControllerImpl(InkDropHost* ink_drop_host);
+ InkDropAnimationControllerImpl(InkDropHost* ink_drop_host,
+ InkDropConsumer* ink_drop_consumer);
~InkDropAnimationControllerImpl() override;
// InkDropAnimationController:
InkDropState GetInkDropState() const override;
void AnimateToState(InkDropState ink_drop_state) override;
+ bool WillAutoAnimateToHidden() const override;
+ void SetHovered(bool is_hovered) override;
+ bool IsHovered() const override;
gfx::Size GetInkDropLargeSize() const override;
void SetInkDropSize(const gfx::Size& large_size,
int large_corner_radius,
@@ -45,14 +55,40 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl
// Destroys the current |ink_drop_animation_|.
void DestroyInkDropAnimation();
+ // Creates a new InkDropHover and sets it to |hover_|. If |hover_| wasn't null
+ // then it will be destroyed using DestroyInkDropHover().
+ void CreateInkDropHover();
+
+ // Destroys the current |hover_|.
+ void DestroyInkDropHover();
+
// views::InkDropAnimationObserver:
void InkDropAnimationStarted(InkDropState ink_drop_state) override;
void InkDropAnimationEnded(InkDropState ink_drop_state,
InkDropAnimationEndedReason reason) override;
+ // Enables or disables the hover state based on |is_hovered| and if an
+ // animation is triggered it will be scheduled to have the given
+ // |animation_duration|.
+ void SetHoveredInternal(bool is_hovered, base::TimeDelta animation_duration);
+
+ // Starts the |hover_after_animation_timer_| timer. This will stop the current
+ // |hover_after_animation_timer_| instance if it exists.
+ void StartHoverAfterAnimationTimer();
+
+ // Stops and destroys the current |hover_after_animation_timer_| instance.
+ void StopHoverAfterAnimationTimer();
+
+ // Callback for when the |hover_after_animation_timer_| fires.
+ void HoverAfterAnimationTimerFired();
+
// The host of the ink drop.
InkDropHost* ink_drop_host_;
+ // The consuming surface of the ink drop. Used to poll for information such as
+ // whether the hover should be shown or not.
+ InkDropConsumer* ink_drop_consumer_;
+
// Cached size for the ink drop's large size animations.
gfx::Size ink_drop_large_size_;
@@ -68,10 +104,25 @@ class VIEWS_EXPORT InkDropAnimationControllerImpl
// Cached center point for the ink drop.
gfx::Point ink_drop_center_;
+ // The root Layer that parents the InkDropAnimation layers and the
+ // InkDropHover layers. The |root_layer_| is the one that is added and removed
+ // from the InkDropHost.
+ scoped_ptr<ui::Layer> root_layer_;
+
+ // The current InkDropHover. Lazily created using CreateInkDropHover();
+ scoped_ptr<InkDropHover> hover_;
+
// The current InkDropAnimation. Created on demand using
// CreateInkDropAnimation().
scoped_ptr<InkDropAnimation> ink_drop_animation_;
+ // Tracks whether the InkDropAnimation can be destroyed when a
+ // InkDropState::HIDDEN animation completes.
+ bool can_destroy_after_hidden_animation_;
+
+ // The timer used to delay the hover fade in after an ink drop animation.
+ scoped_ptr<base::OneShotTimer> hover_after_animation_timer_;
+
DISALLOW_COPY_AND_ASSIGN(InkDropAnimationControllerImpl);
};

Powered by Google App Engine
This is Rietveld 408576698