Scale bubble bar to the width of the handle

When animating bubble bar from the stash handle, scale the width to the
handle.
Bubble bar is already almost the size of the handle, but a small scale
is still added.

Bug: 345488489
Flag: com.android.wm.shell.enable_bubble_bar
Test: atest TransientBubbleStashControllerTest
Test: slow animations down and unstash and stash bubble bar, observe
  that the width of the bubble bar scales down to the handle
Change-Id: I54dc228fa41d4d494bfb15e191d2ba563c0970c7
This commit is contained in:
Ats Jenk committed 2024-08-30 10:17:29 -07:00
1 parent 9ab2b8c785
commit da9e36e4e7
5 files changed
+77 -26

No files matched your search

@@ -80,6 +80,7 @@ public class BubbleBarViewController {
// These are exposed to {@link BubbleStashController} to animate for stashing/un-stashing
private final MultiValueAlpha mBubbleBarAlpha;
private final AnimatedFloat mBubbleBarScaleX = new AnimatedFloat(this::updateScaleX);
private final AnimatedFloat mBubbleBarScaleY = new AnimatedFloat(this::updateScaleY);
private final AnimatedFloat mBubbleBarTranslationY = new AnimatedFloat(
this::updateTranslationY);
@@ -257,6 +258,10 @@ public class BubbleBarViewController {
return mBubbleBarAlpha;
}
public AnimatedFloat getBubbleBarScaleX() {
return mBubbleBarScaleX;
}
public AnimatedFloat getBubbleBarScaleY() {
return mBubbleBarScaleY;
}
@@ -265,6 +270,10 @@ public class BubbleBarViewController {
return mBubbleBarTranslationY;
}
public float getBubbleBarCollapsedWidth() {
return mBarView.collapsedWidth();
}
public float getBubbleBarCollapsedHeight() {
return mBarView.getBubbleBarCollapsedHeight();
}
@@ -309,6 +318,14 @@ public class BubbleBarViewController {
return mBarView.getBubbleBarLocation();
}
/**
* @return {@code true} if bubble bar is on the left edge of the screen, {@code false} if on
* the right
*/
public boolean isBubbleBarOnLeft() {
return mBarView.getBubbleBarLocation().isOnLeft(mBarView.isLayoutRtl());
}
/**
* Update bar {@link BubbleBarLocation}
*/
@@ -510,6 +527,10 @@ public class BubbleBarViewController {
+ mBubbleBarStashTranslationY);
}
private void updateScaleX(float scale) {
mBarView.setScaleX(scale);
}
private void updateScaleY(float scale) {
mBarView.setScaleY(scale);
}