Merge "Position KQS to the bottom if opened via taskbar." into main
diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java
index f98245d..7792d47 100644
--- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java
@@ -102,16 +102,16 @@
* @param taskIdsToExclude A list of tasks to exclude in the opened view.
*/
void openQuickSwitchView(@NonNull Set<Integer> taskIdsToExclude) {
- openQuickSwitchView(-1, taskIdsToExclude);
+ openQuickSwitchView(-1, taskIdsToExclude, true);
}
-
private void openQuickSwitchView(int currentFocusedIndex) {
- openQuickSwitchView(currentFocusedIndex, Collections.emptySet());
+ openQuickSwitchView(currentFocusedIndex, Collections.emptySet(), false);
}
private void openQuickSwitchView(int currentFocusedIndex,
- @NonNull Set<Integer> taskIdsToExclude) {
+ @NonNull Set<Integer> taskIdsToExclude,
+ boolean wasOpenedFromTaskbar) {
if (mQuickSwitchViewController != null) {
if (!mQuickSwitchViewController.isCloseAnimationRunning()) {
return;
@@ -146,7 +146,8 @@
? 0 : currentFocusedIndex,
onDesktop,
mHasDesktopTask,
- mWasDesktopTaskFilteredOut);
+ mWasDesktopTaskFilteredOut,
+ wasOpenedFromTaskbar);
return;
}
@@ -168,7 +169,8 @@
? 0 : currentFocusedIndex,
onDesktop,
mHasDesktopTask,
- mWasDesktopTaskFilteredOut);
+ mWasDesktopTaskFilteredOut,
+ wasOpenedFromTaskbar);
});
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java
index 40e77e2..fd1dc4a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java
@@ -19,6 +19,7 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+import android.view.Gravity;
import android.view.KeyEvent;
import android.view.animation.AnimationUtils;
import android.window.RemoteTransition;
@@ -30,6 +31,7 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
+import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.SlideInRemoteTransition;
@@ -83,7 +85,9 @@
int currentFocusIndexOverride,
boolean onDesktop,
boolean hasDesktopTask,
- boolean wasDesktopTaskFilteredOut) {
+ boolean wasDesktopTaskFilteredOut,
+ boolean wasOpenedFromTaskbar) {
+ positionView(wasOpenedFromTaskbar);
mOverlayContext.getDragLayer().addView(mKeyboardQuickSwitchView);
mOnDesktop = onDesktop;
mWasDesktopTaskFilteredOut = wasDesktopTaskFilteredOut;
@@ -98,6 +102,19 @@
/* useDesktopTaskView= */ !onDesktop && hasDesktopTask);
}
+ protected void positionView(boolean wasOpenedFromTaskbar) {
+ if (!wasOpenedFromTaskbar) {
+ // Keep the default positioning.
+ return;
+ }
+
+ BaseDragLayer.LayoutParams lp = new BaseDragLayer.LayoutParams(
+ mKeyboardQuickSwitchView.getLayoutParams());
+ lp.width = BaseDragLayer.LayoutParams.WRAP_CONTENT;
+ lp.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
+ mKeyboardQuickSwitchView.setLayoutParams(lp);
+ }
+
boolean isCloseAnimationRunning() {
return mCloseAnimation != null;
}