Commit 4ccbc032 authored by David Black's avatar David Black Committed by Commit Bot

Modify query view behavior.

Per the spec, the query view should remain at the bottom of the UI
container until the response is received. To accomplish this, this CL:

- Adds active_query_view_ pointer.

The lifetime of a query view is now:
- pending_query_view_: created when query is pended.
- committed_query_view_: pointer swapped when query is committed.
- active_query_view_: pointer swapped when query response is received.

A committed query that is aborted will not reach the "active" state
when the motion spec is enabled.

To prevent regression of current UI behavior, when the motion spec is
disabled we immediately "activate" a query when it is committed.

See bug for spec/demos.

Bug: b:112114187
Change-Id: Icea7ebccc9f0a5aa554c88d969fa79000855b9db
Reviewed-on: https://chromium-review.googlesource.com/1159826
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580632}
parent 2d89d852
......@@ -8,6 +8,7 @@
#include <memory>
#include "ash/assistant/model/assistant_interaction_model_observer.h"
#include "ash/assistant/model/assistant_ui_model_observer.h"
#include "base/macros.h"
#include "ui/views/view.h"
#include "ui/views/view_observer.h"
......@@ -28,7 +29,8 @@ class UiElementContainerView;
// affordances for the query, response, as well as suggestions.
class AssistantMainStage : public views::View,
public views::ViewObserver,
public AssistantInteractionModelObserver {
public AssistantInteractionModelObserver,
public AssistantUiModelObserver {
public:
explicit AssistantMainStage(AssistantController* assistant_controller);
~AssistantMainStage() override;
......@@ -44,34 +46,41 @@ class AssistantMainStage : public views::View,
// AssistantInteractionModelObserver:
void OnCommittedQueryChanged(const AssistantQuery& query) override;
void OnCommittedQueryCleared() override;
void OnPendingQueryChanged(const AssistantQuery& query) override;
void OnPendingQueryCleared() override;
void OnResponseChanged(const AssistantResponse& response) override;
// AssistantUiModelObserver:
void OnUiVisibilityChanged(bool visible, AssistantSource source) override;
private:
void InitLayout(AssistantController* assistant_controller);
void InitContentLayoutContainer(AssistantController* assistant_controller);
void InitQueryLayoutContainer(AssistantController* assistant_controller);
void UpdateCommittedQueryViewSpacer();
void UpdateActiveQueryViewSpacer();
void UpdateQueryViewTransform(views::View* query_view);
void UpdateSuggestionContainer();
bool OnCommittedQueryExitAnimationEnded(
void OnActivateQuery();
void OnActiveQueryCleared();
bool OnActiveQueryExitAnimationEnded(
const ui::CallbackLayerAnimationObserver& observer);
AssistantController* const assistant_controller_; // Owned by Shell.
views::View* committed_query_view_spacer_; // Owned by view hierarchy.
views::View* active_query_view_spacer_; // Owned by view hierarchy.
views::View* query_layout_container_; // Owned by view hierarchy.
SuggestionContainerView* suggestion_container_; // Owned by view hierarchy.
UiElementContainerView* ui_element_container_; // Owned by view hierarchy.
// Owned by view hierarchy.
AssistantQueryView* active_query_view_ = nullptr;
AssistantQueryView* committed_query_view_ = nullptr;
AssistantQueryView* pending_query_view_ = nullptr;
std::unique_ptr<ui::CallbackLayerAnimationObserver>
committed_query_exit_animation_observer_;
active_query_exit_animation_observer_;
DISALLOW_COPY_AND_ASSIGN(AssistantMainStage);
};
......
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