Merge "Fix some taskbar stashing issues" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-08-31 22:38:01 +00:00
committed by Android (Google) Code Review
3 changed files with 24 additions and 2 deletions
@@ -243,7 +243,19 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
if (!mTouchEnabled) { if (!mTouchEnabled) {
return true; return true;
} }
mControllerCallbacks.onTouchEvent(event); if (mIconLayoutBounds.contains((int) event.getX(), (int) event.getY())) {
// Don't allow long pressing between icons.
return true;
}
if (mControllerCallbacks.onTouchEvent(event)) {
int oldAction = event.getAction();
try {
event.setAction(MotionEvent.ACTION_CANCEL);
return super.onTouchEvent(event);
} finally {
event.setAction(oldAction);
}
}
return super.onTouchEvent(event); return super.onTouchEvent(event);
} }
@@ -223,7 +223,11 @@ public class TaskbarViewController {
return view -> mControllers.taskbarStashController.updateAndAnimateIsStashedInApp(true); return view -> mControllers.taskbarStashController.updateAndAnimateIsStashedInApp(true);
} }
public void onTouchEvent(MotionEvent motionEvent) { /**
* Get the first chance to handle TaskbarView#onTouchEvent, and return whether we want to
* consume the touch so TaskbarView treats it as an ACTION_CANCEL.
*/
public boolean onTouchEvent(MotionEvent motionEvent) {
final float x = motionEvent.getRawX(); final float x = motionEvent.getRawX();
final float y = motionEvent.getRawY(); final float y = motionEvent.getRawY();
switch (motionEvent.getAction()) { switch (motionEvent.getAction()) {
@@ -239,6 +243,7 @@ public class TaskbarViewController {
mControllers.taskbarStashController.startStashHint( mControllers.taskbarStashController.startStashHint(
/* animateForward= */ false); /* animateForward= */ false);
mCanceledStashHint = true; mCanceledStashHint = true;
return true;
} }
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
@@ -249,6 +254,7 @@ public class TaskbarViewController {
} }
break; break;
} }
return false;
} }
} }
} }
@@ -409,6 +409,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
* Returns true if the touch down at the provided position be ignored * Returns true if the touch down at the provided position be ignored
*/ */
protected boolean shouldIgnoreTouchDown(float x, float y) { protected boolean shouldIgnoreTouchDown(float x, float y) {
if (mDisplay == DISPLAY_TASKBAR) {
// Allow touching within padding on taskbar, given icon sizes are smaller.
return false;
}
return y < getPaddingTop() return y < getPaddingTop()
|| x < getPaddingLeft() || x < getPaddingLeft()
|| y > getHeight() - getPaddingBottom() || y > getHeight() - getPaddingBottom()