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:
@@ -212,7 +212,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
* stashed handle to wrap around the hotseat items.
|
||||
*/
|
||||
public Animator createRevealAnimToIsStashed(boolean isStashed, Rect taskbarToHotseatOffsets) {
|
||||
Rect visualBounds = new Rect(mControllers.taskbarViewController.getIconLayoutBounds());
|
||||
Rect visualBounds = mControllers.taskbarViewController.getIconLayoutVisualBounds();
|
||||
float startRadius = mStashedHandleRadius;
|
||||
|
||||
if (DisplayController.isTransientTaskbar(mActivity)) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.view.animation.Interpolator;
|
||||
import android.view.animation.PathInterpolator;
|
||||
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleControllers;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
@@ -97,10 +98,20 @@ public class TaskbarScrimViewController implements TaskbarControllers.LoggableTa
|
||||
private boolean shouldShowScrim() {
|
||||
final boolean bubblesExpanded = (mSysUiStateFlags & SYSUI_STATE_BUBBLES_EXPANDED) != 0;
|
||||
boolean isShadeVisible = (mSysUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE) != 0;
|
||||
BubbleControllers bubbleControllers = mActivity.getBubbleControllers();
|
||||
boolean isBubbleControllersPresented = bubbleControllers != null;
|
||||
// when the taskbar is in persistent mode, we hide the task bar icons on bubble bar expand,
|
||||
// which makes the taskbar invisible, so need to check if the bubble bar is not on home
|
||||
// to show the scrim view
|
||||
boolean showScrimForBubbles = bubblesExpanded
|
||||
&& !mTaskbarVisible
|
||||
&& isBubbleControllersPresented
|
||||
&& !DisplayController.isTransientTaskbar(mActivity)
|
||||
&& !bubbleControllers.bubbleStashController.isBubblesShowingOnHome();
|
||||
return bubblesExpanded && !mControllers.navbarButtonsViewController.isImeVisible()
|
||||
&& !isShadeVisible
|
||||
&& !mControllers.taskbarStashController.isStashed()
|
||||
&& mTaskbarVisible;
|
||||
&& (mTaskbarVisible || showScrimForBubbles);
|
||||
}
|
||||
|
||||
private float getScrimAlpha() {
|
||||
|
||||
@@ -669,8 +669,20 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
return isShown() && mIconLayoutBounds.contains(xInOurCoordinates, yInOurCoorindates);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets visual bounds of the taskbar view. The visual bounds correspond to the taskbar touch
|
||||
* area, rather than layout placement in the parent view.
|
||||
*/
|
||||
public Rect getIconLayoutVisualBounds() {
|
||||
return new Rect(mIconLayoutBounds);
|
||||
}
|
||||
|
||||
/** Gets taskbar layout bounds in parent view. */
|
||||
public Rect getIconLayoutBounds() {
|
||||
return mIconLayoutBounds;
|
||||
Rect actualBounds = new Rect(mIconLayoutBounds);
|
||||
actualBounds.top = getTop();
|
||||
actualBounds.bottom = getBottom();
|
||||
return actualBounds;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,7 +96,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
public static final int ALPHA_INDEX_NOTIFICATION_EXPANDED = 4;
|
||||
public static final int ALPHA_INDEX_ASSISTANT_INVOKED = 5;
|
||||
public static final int ALPHA_INDEX_SMALL_SCREEN = 6;
|
||||
private static final int NUM_ALPHA_CHANNELS = 7;
|
||||
|
||||
public static final int ALPHA_INDEX_BUBBLE_BAR = 7;
|
||||
private static final int NUM_ALPHA_CHANNELS = 8;
|
||||
|
||||
private static boolean sEnableModelLoadingForTests = true;
|
||||
|
||||
@@ -272,6 +274,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
OneShotPreDrawListener.add(mTaskbarView, listener);
|
||||
}
|
||||
|
||||
public Rect getIconLayoutVisualBounds() {
|
||||
return mTaskbarView.getIconLayoutVisualBounds();
|
||||
}
|
||||
|
||||
public Rect getIconLayoutBounds() {
|
||||
return mTaskbarView.getIconLayoutBounds();
|
||||
}
|
||||
@@ -462,14 +468,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
if (mControllers.getSharedState().startTaskbarVariantIsTransient) {
|
||||
float transY =
|
||||
mTransientTaskbarDp.taskbarBottomMargin + (mTransientTaskbarDp.taskbarHeight
|
||||
- mTaskbarView.getIconLayoutBounds().bottom)
|
||||
- mTaskbarView.getIconLayoutVisualBounds().bottom)
|
||||
- (mPersistentTaskbarDp.taskbarHeight
|
||||
- mTransientTaskbarDp.taskbarIconSize) / 2f;
|
||||
taskbarIconTranslationYForPinningValue = mapRange(scale, 0f, transY);
|
||||
} else {
|
||||
float transY =
|
||||
-mTransientTaskbarDp.taskbarBottomMargin + (mPersistentTaskbarDp.taskbarHeight
|
||||
- mTaskbarView.getIconLayoutBounds().bottom)
|
||||
- mTaskbarView.getIconLayoutVisualBounds().bottom)
|
||||
- (mTransientTaskbarDp.taskbarHeight
|
||||
- mTransientTaskbarDp.taskbarIconSize) / 2f;
|
||||
taskbarIconTranslationYForPinningValue = mapRange(scale, transY, 0f);
|
||||
|
||||
@@ -661,13 +661,25 @@ public class BubbleBarView extends FrameLayout {
|
||||
return displayHeight - bubbleBarHeight + (int) mController.getBubbleBarTranslationY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the bounds with translation that may have been applied and returns the result.
|
||||
*/
|
||||
/** Returns the bounds with translation that may have been applied. */
|
||||
public Rect getBubbleBarBounds() {
|
||||
mBubbleBarBounds.top = getTop() + (int) getTranslationY() + mPointerSize;
|
||||
mBubbleBarBounds.bottom = getBottom() + (int) getTranslationY();
|
||||
return mBubbleBarBounds;
|
||||
Rect bounds = new Rect(mBubbleBarBounds);
|
||||
bounds.top = getTop() + (int) getTranslationY() + mPointerSize;
|
||||
bounds.bottom = getBottom() + (int) getTranslationY();
|
||||
return bounds;
|
||||
}
|
||||
|
||||
/** Returns the expanded bounds with translation that may have been applied. */
|
||||
public Rect getBubbleBarExpandedBounds() {
|
||||
Rect expandedBounds = getBubbleBarBounds();
|
||||
if (!isExpanded() || isExpanding()) {
|
||||
if (mBubbleBarLocation.isOnLeft(isLayoutRtl())) {
|
||||
expandedBounds.right = expandedBounds.left + (int) expandedWidth();
|
||||
} else {
|
||||
expandedBounds.left = expandedBounds.right - (int) expandedWidth();
|
||||
}
|
||||
}
|
||||
return expandedBounds;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1279,6 +1291,13 @@ public class BubbleBarView extends FrameLayout {
|
||||
return mIsBarExpanded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the bubble bar is expanding.
|
||||
*/
|
||||
public boolean isExpanding() {
|
||||
return mWidthAnimator.isRunning() && mIsBarExpanded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get width of the bubble bar as if it would be expanded.
|
||||
*
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,15 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar.bubbles;
|
||||
|
||||
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_BUBBLE_BAR;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.taskbar.TaskbarControllers;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarViewController.TaskbarViewPropertiesProvider;
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -79,7 +86,20 @@ public class BubbleControllers {
|
||||
bubbleStashedHandleViewController.orElse(null),
|
||||
taskbarControllers::runAfterInit
|
||||
);
|
||||
bubbleBarViewController.init(taskbarControllers, /* bubbleControllers = */ this);
|
||||
bubbleBarViewController.init(taskbarControllers, /* bubbleControllers = */ this,
|
||||
new TaskbarViewPropertiesProvider() {
|
||||
@Override
|
||||
public Rect getTaskbarViewBounds() {
|
||||
return taskbarControllers.taskbarViewController.getIconLayoutBounds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiPropertyFactory<View>.MultiProperty getIconsAlpha() {
|
||||
return taskbarControllers.taskbarViewController
|
||||
.getTaskbarIconAlpha()
|
||||
.get(ALPHA_INDEX_BUBBLE_BAR);
|
||||
}
|
||||
});
|
||||
bubbleDragController.init(/* bubbleControllers = */ this);
|
||||
bubbleDismissController.init(/* bubbleControllers = */ this);
|
||||
bubbleBarPinController.init(this);
|
||||
|
||||
Reference in New Issue
Block a user