Add margins to KQS view that is triggered from transient taskbar
This cl adds additional bottom margins to the KQS view for the transient taskbar. Also adds a behavior that when the KQS view is showing, the transient taskbar won't be stashed. Screenshots with the new layout after this cl is uploaded to the buganizer. Bug: 368119679 Test: open KQS via transient taskbar and observe the bounds change Flag: com.android.launcher3.taskbar_overflow Change-Id: Ie50e768f828a24f0111df4cdba474a6482a4e1c7
This commit is contained in:
@@ -31,12 +31,14 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.jank.Cuj;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.desktop.DesktopAppLaunchTransition;
|
||||
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
|
||||
import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
@@ -101,7 +103,16 @@ public class KeyboardQuickSwitchViewController {
|
||||
boolean hasDesktopTask,
|
||||
boolean wasDesktopTaskFilteredOut,
|
||||
boolean wasOpenedFromTaskbar) {
|
||||
positionView(wasOpenedFromTaskbar);
|
||||
final boolean isTransientTaskBar = DisplayController.isTransientTaskbar(
|
||||
mControllers.taskbarActivityContext);
|
||||
positionView(wasOpenedFromTaskbar, isTransientTaskBar);
|
||||
|
||||
// Keep the taskbar unstashed if the KQS is opened.
|
||||
if (wasOpenedFromTaskbar && isTransientTaskBar) {
|
||||
mControllers.taskbarStashController.updateTaskbarTimeout(/* isAutohideSuspended= */
|
||||
true);
|
||||
}
|
||||
|
||||
mOverlayContext.getDragLayer().addView(mKeyboardQuickSwitchView);
|
||||
mOnDesktop = onDesktop;
|
||||
mWasDesktopTaskFilteredOut = wasDesktopTaskFilteredOut;
|
||||
@@ -117,7 +128,7 @@ public class KeyboardQuickSwitchViewController {
|
||||
/* useDesktopTaskView= */ !onDesktop && hasDesktopTask);
|
||||
}
|
||||
|
||||
protected void positionView(boolean wasOpenedFromTaskbar) {
|
||||
protected void positionView(boolean wasOpenedFromTaskbar, boolean isTransientTaskbar) {
|
||||
if (!wasOpenedFromTaskbar) {
|
||||
// Keep the default positioning.
|
||||
return;
|
||||
@@ -128,8 +139,16 @@ public class KeyboardQuickSwitchViewController {
|
||||
final Resources resources = mKeyboardQuickSwitchView.getResources();
|
||||
final int marginHorizontal = resources.getDimensionPixelSize(
|
||||
R.dimen.keyboard_quick_switch_margin_ends);
|
||||
final int marginBottom = resources.getDimensionPixelSize(
|
||||
|
||||
final DeviceProfile dp = mControllers.taskbarActivityContext.getDeviceProfile();
|
||||
// Calculate the additional margin space that the KQS should move up for the transient
|
||||
// taskbar. The value of spaceForTaskbar is the distance between the bottom of the KQS
|
||||
// view with 0 bottom margin to the top of the transient taskbar view.
|
||||
final int spaceForTaskbar = isTransientTaskbar ? dp.taskbarHeight + dp.taskbarBottomMargin
|
||||
- dp.stashedTaskbarHeight : 0;
|
||||
final int marginBottom = spaceForTaskbar + resources.getDimensionPixelSize(
|
||||
R.dimen.keyboard_quick_switch_margin_bottom);
|
||||
|
||||
lp.setMargins(marginHorizontal, 0, marginHorizontal, marginBottom);
|
||||
lp.width = BaseDragLayer.LayoutParams.WRAP_CONTENT;
|
||||
lp.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
|
||||
|
||||
Reference in New Issue
Block a user