Position KQS to the bottom if opened via taskbar.
Bug: 368119679
Test: open KQS via taskbar, observe view at bottom of screen
open KQS via keyboard, observe view at top of screen
Flag: com.android.launcher3.taskbar_overflow
Change-Id: I3e6f0d2ba51ec15cf7cb1f41ddc2a4414dfd60d6
This commit is contained in:
1 parent
9ce27637d7
commit
deaca33cc2
2 files changed
+26
-7
No files matched your search
@@ -102,16 +102,16 @@ public final class KeyboardQuickSwitchController implements
|
||||
* @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 @@ public final class KeyboardQuickSwitchController implements
|
||||
? 0 : currentFocusedIndex,
|
||||
onDesktop,
|
||||
mHasDesktopTask,
|
||||
mWasDesktopTaskFilteredOut);
|
||||
mWasDesktopTaskFilteredOut,
|
||||
wasOpenedFromTaskbar);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,7 +169,8 @@ public final class KeyboardQuickSwitchController implements
|
||||
? 0 : currentFocusedIndex,
|
||||
onDesktop,
|
||||
mHasDesktopTask,
|
||||
mWasDesktopTaskFilteredOut);
|
||||
mWasDesktopTaskFilteredOut,
|
||||
wasOpenedFromTaskbar);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
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.internal.jank.Cuj;
|
||||
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 @@ public class KeyboardQuickSwitchViewController {
|
||||
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 @@ public class KeyboardQuickSwitchViewController {
|
||||
/* 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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user