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

Remove standalone UI code from AssistantProgressIndicator.

Bug: b:148080975
Change-Id: I5553e75f42bc8d4d08cba33cc8dce9f164306f0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036395Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#738015}
parent f901a63d
......@@ -25,31 +25,16 @@ namespace {
// Appearance.
constexpr int kDotCount = 3;
constexpr float kDotLargeSizeDip = 9.f;
constexpr float kDotSmallSizeDip = 6.f;
constexpr int kSpacingDip = 4;
constexpr float kEmbeddedUiDotLargeSizeDip = 6.f;
constexpr float kEmbeddedUiDotSmallSizeDip = 4.f;
constexpr int kEmbeddedUiSpacingDip = 3;
constexpr int kEmbeddedUiPreferredHeightDip = 9;
float GetDotLargeSizeDip() {
return app_list_features::IsAssistantLauncherUIEnabled()
? kEmbeddedUiDotLargeSizeDip
: kDotLargeSizeDip;
}
constexpr float kDotLargeSizeDip = 6.f;
constexpr float kDotSmallSizeDip = 4.f;
constexpr int kDotSpacingDip = 3;
constexpr int kPreferredHeightDip = 9;
float GetDotSmallSizeDip() {
return app_list_features::IsAssistantLauncherUIEnabled()
? kEmbeddedUiDotSmallSizeDip
: kDotSmallSizeDip;
}
// Animation.
constexpr float kTranslationDip = -(kDotLargeSizeDip - kDotSmallSizeDip) / 2.f;
constexpr float kScaleFactor = kDotLargeSizeDip / kDotSmallSizeDip;
int GetDotSpacingDip() {
return app_list_features::IsAssistantLauncherUIEnabled()
? kEmbeddedUiSpacingDip
: kSpacingDip;
}
// Helpers ---------------------------------------------------------------------
bool AreAnimationsEnabled() {
return ui::ScopedAnimationDurationScaleMode::duration_scale_mode() !=
......@@ -100,9 +85,7 @@ gfx::Size AssistantProgressIndicator::CalculatePreferredSize() const {
}
int AssistantProgressIndicator::GetHeightForWidth(int width) const {
return app_list_features::IsAssistantLauncherUIEnabled()
? kEmbeddedUiPreferredHeightDip
: views::View::GetHeightForWidth(width);
return kPreferredHeightDip;
}
void AssistantProgressIndicator::AddedToWidget() {
......@@ -144,11 +127,8 @@ void AssistantProgressIndicator::VisibilityChanged(views::View* starting_from,
// illusion that scaling is being performed about the center of the view as
// the transformation origin, we also need to perform a translation.
gfx::Transform transform;
const float translation_dip =
-(GetDotLargeSizeDip() - GetDotSmallSizeDip()) / 2.f;
const float scale_factor = GetDotLargeSizeDip() / GetDotSmallSizeDip();
transform.Translate(translation_dip, translation_dip);
transform.Scale(scale_factor, scale_factor);
transform.Translate(kTranslationDip, kTranslationDip);
transform.Scale(kScaleFactor, kScaleFactor);
// Don't animate if animations are disabled (during unittests).
// Otherwise we get in an infinite loop due to the cyclic animation used here
......@@ -188,7 +168,7 @@ void AssistantProgressIndicator::InitLayout() {
views::BoxLayout* layout_manager =
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal, gfx::Insets(),
GetDotSpacingDip()));
kDotSpacingDip));
layout_manager->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kCenter);
......@@ -197,8 +177,7 @@ void AssistantProgressIndicator::InitLayout() {
for (int i = 0; i < kDotCount; ++i) {
views::View* dot_view = new views::View();
dot_view->SetBackground(std::make_unique<DotBackground>());
dot_view->SetPreferredSize(
gfx::Size(GetDotSmallSizeDip(), GetDotSmallSizeDip()));
dot_view->SetPreferredSize(gfx::Size(kDotSmallSizeDip, kDotSmallSizeDip));
// Dots will animate on their own layers.
dot_view->SetPaintToLayer();
......
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