Modify Taskbar code to accommodate bubble bar gesture to stash/unstash
* Bubble bar typically follows the behavior of taskbar - if taskbar is shown, the bubble bar is shown, if taskbar hides, bubble bar hides. * The bubble bar has 3 states: stashed, collapsed (unstashed but the bubbles are not expanded), and expanded. When bubbles are expanded, this means WMShell is rendering the bubble expanded view. In this situation taskbar becomes collapsed. Bug: 253318833 Test: manual, with other CLs, see go/bubble-bar-tests Flag: WM_BUBBLE_BAR Change-Id: Ic210c382e7482c259ae543a0dc083fe9305cbf5b
This commit is contained in:
1 parent
39e28c9190
commit
7344766886
10 files changed
+188
-37
No files matched your search
+24
-5
@@ -37,6 +37,7 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.taskbar.TaskbarActivityContext;
|
||||
import com.android.launcher3.taskbar.TaskbarTranslationController.TransitionCallback;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleControllers;
|
||||
import com.android.launcher3.touch.OverScroll;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.quickstep.InputConsumer;
|
||||
@@ -62,6 +63,7 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
|
||||
private final int mTaskbarNavThresholdY;
|
||||
private final boolean mIsTaskbarAllAppsOpen;
|
||||
private boolean mHasPassedTaskbarNavThreshold;
|
||||
private boolean mIsInBubbleBarArea;
|
||||
|
||||
private final PointF mDownPos = new PointF();
|
||||
private final PointF mLastPos = new PointF();
|
||||
@@ -135,7 +137,7 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
|
||||
mHasPassedTaskbarNavThreshold = false;
|
||||
mTaskbarActivityContext.setAutohideSuspendFlag(
|
||||
FLAG_AUTOHIDE_SUSPEND_TOUCHING, true);
|
||||
if (isInArea(x)) {
|
||||
if (isInTaskbarArea(x)) {
|
||||
if (!mIsTransientTaskbar) {
|
||||
mLongPressDownX = x;
|
||||
mLongPressDownY = y;
|
||||
@@ -144,10 +146,12 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
|
||||
mCanceledUnstashHint = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mTransitionCallback != null && !mIsTaskbarAllAppsOpen) {
|
||||
mTransitionCallback.onActionDown();
|
||||
}
|
||||
if (mIsTransientTaskbar && isInBubbleBarArea(x)) {
|
||||
mIsInBubbleBarArea = true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_POINTER_UP:
|
||||
int ptrIdx = ev.getActionIndex();
|
||||
@@ -184,7 +188,11 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
|
||||
|
||||
if (!mHasPassedTaskbarNavThreshold && passedTaskbarNavThreshold) {
|
||||
mHasPassedTaskbarNavThreshold = true;
|
||||
mTaskbarActivityContext.onSwipeToUnstashTaskbar();
|
||||
if (mIsInBubbleBarArea) {
|
||||
mTaskbarActivityContext.onSwipeToOpenBubblebar();
|
||||
} else {
|
||||
mTaskbarActivityContext.onSwipeToUnstashTaskbar();
|
||||
}
|
||||
}
|
||||
|
||||
if (dY < 0) {
|
||||
@@ -207,21 +215,32 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
|
||||
mTransitionCallback.onActionEnd();
|
||||
}
|
||||
mHasPassedTaskbarNavThreshold = false;
|
||||
mIsInBubbleBarArea = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInArea(float x) {
|
||||
private boolean isInTaskbarArea(float x) {
|
||||
float areaFromMiddle = mUnstashArea / 2.0f;
|
||||
float distFromMiddle = Math.abs(mScreenWidth / 2.0f - x);
|
||||
return distFromMiddle < areaFromMiddle;
|
||||
}
|
||||
|
||||
private boolean isInBubbleBarArea(float x) {
|
||||
if (mTaskbarActivityContext != null && mIsTransientTaskbar) {
|
||||
BubbleControllers controllers = mTaskbarActivityContext.getBubbleControllers();
|
||||
if (controllers == null) return false;
|
||||
Rect bubbleBarBounds = controllers.bubbleBarViewController.getBubbleBarBounds();
|
||||
return x >= bubbleBarBounds.left && x <= bubbleBarBounds.right;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void onLongPressDetected(MotionEvent motionEvent) {
|
||||
if (mTaskbarActivityContext != null
|
||||
&& isInArea(motionEvent.getRawX())
|
||||
&& isInTaskbarArea(motionEvent.getRawX())
|
||||
&& !mIsTransientTaskbar) {
|
||||
boolean taskBarPressed = mTaskbarActivityContext.onLongPressToUnstashTaskbar();
|
||||
if (taskBarPressed) {
|
||||
|
||||
Reference in new issue
Block a user