Commit 0b0aa6de authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Commit Bot

[Autofill Assistant] Fix animation bug when starting regular script.

When starting a regular script after a trigger script was shown, there
used to be an animation glitch while the bottom sheet resized. This was
caused by the progress bar repopulating all of its views.

This CL is a hotfix for this issue. Adding the new icons before
clearing the old ones ensures that the height of the progress bar never
changes.

Bug: b/174014637
Change-Id: I37e836a7f579cefc227feddabcbf8cb864a6bbe6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2554919Reviewed-by: default avatarSandro Maggi <sandromaggi@google.com>
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Cr-Commit-Position: refs/heads/master@{#830210}
parent d8883379
...@@ -380,9 +380,11 @@ public class AssistantStepProgressBar { ...@@ -380,9 +380,11 @@ public class AssistantStepProgressBar {
} }
public void setSteps(List<AssistantDrawable> icons) { public void setSteps(List<AssistantDrawable> icons) {
mView.removeAllViews();
assert icons.size() >= 2; assert icons.size() >= 2;
// NOTE: instead of immediately removing the old icons, we first add the new ones. This
// prevents a change of the bottom sheet height, which was the cause for animation glitches
// (see b/174014637).
int oldNumChilds = mView.getChildCount();
mNumberOfSteps = icons.size(); mNumberOfSteps = icons.size();
mCurrentStep = -1; mCurrentStep = -1;
...@@ -399,6 +401,8 @@ public class AssistantStepProgressBar { ...@@ -399,6 +401,8 @@ public class AssistantStepProgressBar {
Locale.getDefault(), AssistantTagsForTesting.PROGRESSBAR_LINE_TAG, i)); Locale.getDefault(), AssistantTagsForTesting.PROGRESSBAR_LINE_TAG, i));
} }
} }
mView.removeViews(0, oldNumChilds);
} }
public void setVisible(boolean visible) { public void setVisible(boolean visible) {
......
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