Merge "Fix some taskbar stashing issues" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ff705eabe6
@@ -243,7 +243,19 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
if (!mTouchEnabled) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,11 @@ public class TaskbarViewController {
|
||||
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 y = motionEvent.getRawY();
|
||||
switch (motionEvent.getAction()) {
|
||||
@@ -239,6 +243,7 @@ public class TaskbarViewController {
|
||||
mControllers.taskbarStashController.startStashHint(
|
||||
/* animateForward= */ false);
|
||||
mCanceledStashHint = true;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
@@ -249,6 +254,7 @@ public class TaskbarViewController {
|
||||
}
|
||||
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
|
||||
*/
|
||||
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()
|
||||
|| x < getPaddingLeft()
|
||||
|| y > getHeight() - getPaddingBottom()
|
||||
|
||||
Reference in New Issue
Block a user