Added taskbar in/out animation when the bubble bar is expanded/collapsed
Added taskbar icon animation when the bubble bar expansion changes. If there is enough space to accommodate both bars with spacing in between, the taskbar remains. If there is not enough space, the taskbar is animated out and then animated in when the bubble bar is collapsed. Bug: 346391377 Flag: com.android.wm.shell.enable_bubble_bar Test: Manual. Set taskbar to persistent mode via 3-button navigation or through the taskbar itself. Have enough bubbles to cover the taskbar when the bubble bar is extended. Expand the bubble bar and observe the taskbar icons animating out. Remove a few bubbles so there is enough space to accommodate both bars. Expand the bubble bar and observe that both bars are visible. Change-Id: I0b03a010c1e49ab39a17934f6629d5496fd66978
This commit is contained in:
@@ -72,6 +72,7 @@ public class BubbleBarViewController {
|
||||
private BubbleDragController mBubbleDragController;
|
||||
private TaskbarStashController mTaskbarStashController;
|
||||
private TaskbarInsetsController mTaskbarInsetsController;
|
||||
private TaskbarViewPropertiesProvider mTaskbarViewPropertiesProvider;
|
||||
private View.OnClickListener mBubbleClickListener;
|
||||
private View.OnClickListener mBubbleBarClickListener;
|
||||
private BubbleView.Controller mBubbleViewController;
|
||||
@@ -110,13 +111,16 @@ public class BubbleBarViewController {
|
||||
R.dimen.bubblebar_icon_size);
|
||||
}
|
||||
|
||||
public void init(TaskbarControllers controllers, BubbleControllers bubbleControllers) {
|
||||
/** Initializes controller. */
|
||||
public void init(TaskbarControllers controllers, BubbleControllers bubbleControllers,
|
||||
TaskbarViewPropertiesProvider taskbarViewPropertiesProvider) {
|
||||
mBubbleStashController = bubbleControllers.bubbleStashController;
|
||||
mBubbleBarController = bubbleControllers.bubbleBarController;
|
||||
mBubbleDragController = bubbleControllers.bubbleDragController;
|
||||
mTaskbarStashController = controllers.taskbarStashController;
|
||||
mTaskbarInsetsController = controllers.taskbarInsetsController;
|
||||
mBubbleBarViewAnimator = new BubbleBarViewAnimator(mBarView, mBubbleStashController);
|
||||
mTaskbarViewPropertiesProvider = taskbarViewPropertiesProvider;
|
||||
onBubbleBarConfigurationChanged(/* animate= */ false);
|
||||
mActivity.addOnDeviceProfileChangeListener(
|
||||
dp -> onBubbleBarConfigurationChanged(/* animate= */ true));
|
||||
@@ -347,6 +351,7 @@ public class BubbleBarViewController {
|
||||
if (hidden) {
|
||||
mBarView.setAlpha(0);
|
||||
mBarView.setExpanded(false);
|
||||
updatePersistentTaskbar(/* isBubbleBarExpanded = */ false);
|
||||
}
|
||||
mActivity.bubbleBarVisibilityChanged(!hidden);
|
||||
}
|
||||
@@ -611,6 +616,7 @@ public class BubbleBarViewController {
|
||||
public void setExpanded(boolean isExpanded) {
|
||||
if (isExpanded != mBarView.isExpanded()) {
|
||||
mBarView.setExpanded(isExpanded);
|
||||
updatePersistentTaskbar(isExpanded);
|
||||
if (!isExpanded) {
|
||||
mSystemUiProxy.collapseBubbles();
|
||||
} else {
|
||||
@@ -621,6 +627,25 @@ public class BubbleBarViewController {
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePersistentTaskbar(boolean isBubbleBarExpanded) {
|
||||
if (mBubbleStashController.isTransientTaskBar()) return;
|
||||
boolean hideTaskbar = isBubbleBarExpanded && isIntersectingTaskbar();
|
||||
mTaskbarViewPropertiesProvider
|
||||
.getIconsAlpha()
|
||||
.animateToValue(hideTaskbar ? 0 : 1)
|
||||
.start();
|
||||
}
|
||||
|
||||
/** Return {@code true} if expanded bubble bar would intersect the taskbar. */
|
||||
public boolean isIntersectingTaskbar() {
|
||||
if (mBarView.isExpanding() || mBarView.isExpanded()) {
|
||||
Rect taskbarViewBounds = mTaskbarViewPropertiesProvider.getTaskbarViewBounds();
|
||||
return mBarView.getBubbleBarExpandedBounds().intersect(taskbarViewBounds);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the bubble bar should be expanded. This method is used in response to UI events
|
||||
* from SystemUI.
|
||||
@@ -750,4 +775,14 @@ public class BubbleBarViewController {
|
||||
pw.println(" Bubble bar view is null!");
|
||||
}
|
||||
}
|
||||
|
||||
/** Interface for BubbleBarViewController to get the taskbar view properties. */
|
||||
public interface TaskbarViewPropertiesProvider {
|
||||
|
||||
/** Returns the bounds of the taskbar. */
|
||||
Rect getTaskbarViewBounds();
|
||||
|
||||
/** Returns taskbar icons alpha */
|
||||
MultiPropertyFactory<View>.MultiProperty getIconsAlpha();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user