Commit e8f5e85d authored by David Black's avatar David Black Committed by Commit Bot

Open mic when launching via long press.

When enter via the long press on the app list button, we should open
the mic by starting a voice interaction automatically.

Bug: b:113298342
Change-Id: I8755d3f86b6f5b3c7a5d5f328b4477c1f5851d21
Reviewed-on: https://chromium-review.googlesource.com/1194255
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587008}
parent 23fb1e11
......@@ -119,10 +119,11 @@ void AssistantInteractionController::OnUiVisibilityChanged(
assistant_interaction_model_.SetInputModality(InputModality::kKeyboard);
break;
case AssistantVisibility::kVisible:
// TODO(dmblack): When the UI becomes visible, we may need to immediately
// start a voice interaction depending on |source| and user preference.
if (source == AssistantSource::kStylus)
if (source == AssistantSource::kLongPressLauncher) {
StartVoiceInteraction();
} else if (source == AssistantSource::kStylus) {
assistant_interaction_model_.SetInputModality(InputModality::kStylus);
}
break;
}
}
......
......@@ -7,6 +7,7 @@
#include "ash/assistant/assistant_controller.h"
#include "ash/assistant/assistant_interaction_controller.h"
#include "ash/assistant/assistant_ui_controller.h"
#include "ash/assistant/model/assistant_query.h"
#include "ash/assistant/ui/assistant_ui_constants.h"
#include "ash/assistant/ui/main_stage/assistant_footer_view.h"
#include "ash/assistant/ui/main_stage/assistant_header_view.h"
......@@ -544,14 +545,25 @@ void AssistantMainStage::OnUiVisibilityChanged(
kGreetingAnimationFadeInDelay),
CreateOpacityElement(1.f, kGreetingAnimationFadeInDuration))});
// Animate the footer from 0% to 100% opacity with delay.
// Set up our pre-animation values.
footer_->layer()->SetOpacity(0.f);
footer_->layer()->GetAnimator()->StartAnimation(
CreateLayerAnimationSequence(
ui::LayerAnimationElement::CreatePauseElement(
ui::LayerAnimationElement::AnimatableProperty::OPACITY,
kFooterEntryAnimationFadeInDelay),
CreateOpacityElement(1.f, kFooterEntryAnimationFadeInDuration)));
const AssistantQuery& pending_query =
assistant_controller_->interaction_controller()
->model()
->pending_query();
// We only animate in the footer when a pending query is absent. Otherwise
// the footer should be hidden to make room for the pending query view.
if (pending_query.type() == AssistantQueryType::kNull) {
// Animate the footer to 100% opacity with delay.
footer_->layer()->GetAnimator()->StartAnimation(
CreateLayerAnimationSequence(
ui::LayerAnimationElement::CreatePauseElement(
ui::LayerAnimationElement::AnimatableProperty::OPACITY,
kFooterEntryAnimationFadeInDelay),
CreateOpacityElement(1.f, kFooterEntryAnimationFadeInDuration)));
}
return;
}
......
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