Skip to content

Commit

Permalink
focus-mode: Add shift animation for sounds view
Browse files Browse the repository at this point in the history
This CL will add the sounds view into the `animatable_views` if it's
visible. So that when task container view shrink/expand, it will shift
with an animation.

Bug: b/361786147
Test: Manual
Change-Id: I11915ac0e427b8f9ec8842971ed003e978ff2656
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5807091
Reviewed-by: Richard Chui <[email protected]>
Commit-Queue: Hongyu Long <[email protected]>
Reviewed-by: Sean Kau <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1346061}
  • Loading branch information
Hongyu Long authored and Chromium LUCI CQ committed Aug 23, 2024
1 parent f11d108 commit fef062e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ash/system/focus_mode/focus_mode_detailed_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ FocusModeDetailedView::FocusModeDetailedView(DetailedViewDelegate* delegate)

const base::flat_set<focus_mode_util::SoundType>& sound_sections =
focus_mode_controller->focus_mode_sounds_controller()->sound_sections();
views::View* sound_view =
focus_mode_sounds_view_ =
scroll_content()->AddChildView(std::make_unique<FocusModeSoundsView>(
sound_sections, is_network_connected));
sound_view->SetID(ViewId::kSoundView);
focus_mode_sounds_view_->SetID(ViewId::kSoundView);

const bool in_focus_session = focus_mode_controller->in_focus_session();

Expand Down Expand Up @@ -775,8 +775,12 @@ void FocusModeDetailedView::CreateTaskView(bool is_network_connected) {
void FocusModeDetailedView::OnTaskViewAnimate(const int shift_height) {
std::vector<views::View*> animatable_views;

// Currently, we only have the `do_not_disturb_view_` below the task view
// container. We only need to insert a new added view into this map in future.
// Add the views that show up below the tasks view container into
// `animatable_views`.
if (focus_mode_sounds_view_->GetVisible()) {
animatable_views.push_back(focus_mode_sounds_view_);
}

if (do_not_disturb_view_->GetVisible()) {
animatable_views.push_back(do_not_disturb_view_);
}
Expand Down
2 changes: 2 additions & 0 deletions ash/system/focus_mode/focus_mode_detailed_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Label;
namespace ash {

class FocusModeCountdownView;
class FocusModeSoundsView;
class FocusModeTaskView;
class HoverHighlightView;
class IconButton;
Expand Down Expand Up @@ -171,6 +172,7 @@ class ASH_EXPORT FocusModeDetailedView : public TrayDetailedView,
// The view contains a header view and a `focus_mode_task_view_`.
raw_ptr<RoundedContainer> task_view_container_ = nullptr;
raw_ptr<FocusModeTaskView> focus_mode_task_view_ = nullptr;
raw_ptr<FocusModeSoundsView> focus_mode_sounds_view_ = nullptr;

// This view contains a toggle for turning on/off DND.
raw_ptr<RoundedContainer> do_not_disturb_view_ = nullptr;
Expand Down

0 comments on commit fef062e

Please sign in to comment.