From 69ed08ef862937c8983d38e5eee3d262ed63dcb5 Mon Sep 17 00:00:00 2001 From: Wen-Chien Wang Date: Wed, 23 Oct 2024 03:38:00 +0000 Subject: [PATCH] Add margins to KQS view that is triggered from taskbar Bug: 368119679 Test: open KQS via taskbar and observe the bounds change Flag: com.android.launcher3.taskbar_overflow Change-Id: I5060a339cf0cdf70a2a11b57a325767405772ef8 --- quickstep/res/values/dimens.xml | 1 + .../taskbar/KeyboardQuickSwitchViewController.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 9836172cb3..96fe1898a5 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -504,6 +504,7 @@ 20dp 32dp 56dp + 24dp 16dp 16dp 4dp diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java index a80c11cc17..2902d55cb1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java @@ -20,6 +20,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; +import android.content.res.Resources; import android.view.Gravity; import android.view.KeyEvent; import android.view.MotionEvent; @@ -30,6 +31,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.internal.jank.Cuj; +import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.desktop.DesktopAppLaunchTransition; @@ -115,6 +117,12 @@ public class KeyboardQuickSwitchViewController { BaseDragLayer.LayoutParams lp = new BaseDragLayer.LayoutParams( mKeyboardQuickSwitchView.getLayoutParams()); + final Resources resources = mKeyboardQuickSwitchView.getResources(); + final int marginHorizontal = resources.getDimensionPixelSize( + R.dimen.keyboard_quick_switch_margin_ends); + final int marginBottom = 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; mKeyboardQuickSwitchView.setLayoutParams(lp);