Merge "Shared touch and drag slops for quick step changes with density (1/3)" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
87d71db19a
@@ -33,10 +33,21 @@ public class NavigationBarCompat {
|
||||
* touch slop is when the respected operation will occur when exceeded. Touch slop must be
|
||||
* larger than the drag slop.
|
||||
*/
|
||||
public static final int QUICK_STEP_DRAG_SLOP_PX = convertDpToPixel(10);
|
||||
public static final int QUICK_SCRUB_DRAG_SLOP_PX = convertDpToPixel(20);
|
||||
public static final int QUICK_STEP_TOUCH_SLOP_PX = convertDpToPixel(24);
|
||||
public static final int QUICK_SCRUB_TOUCH_SLOP_PX = convertDpToPixel(35);
|
||||
public static int getQuickStepDragSlopPx() {
|
||||
return convertDpToPixel(10);
|
||||
}
|
||||
|
||||
public static int getQuickScrubDragSlopPx() {
|
||||
return convertDpToPixel(20);
|
||||
}
|
||||
|
||||
public static int getQuickStepTouchSlopPx() {
|
||||
return convertDpToPixel(24);
|
||||
}
|
||||
|
||||
public static int getQuickScrubTouchSlopPx() {
|
||||
return convertDpToPixel(35);
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({HIT_TARGET_NONE, HIT_TARGET_BACK, HIT_TARGET_HOME, HIT_TARGET_OVERVIEW})
|
||||
|
||||
@@ -34,7 +34,6 @@ import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.WindowManagerGlobal;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
@@ -45,16 +44,13 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.statusbar.phone.NavGesture.GestureHelper;
|
||||
import com.android.systemui.shared.recents.IOverviewProxy;
|
||||
import com.android.systemui.shared.recents.utilities.Utilities;
|
||||
import com.android.systemui.shared.system.NavigationBarCompat;
|
||||
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_LEFT;
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_BOTTOM;
|
||||
import static com.android.systemui.OverviewProxyService.DEBUG_OVERVIEW_PROXY;
|
||||
import static com.android.systemui.OverviewProxyService.TAG_OPS;
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_HOME;
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.QUICK_SCRUB_DRAG_SLOP_PX;
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.QUICK_SCRUB_TOUCH_SLOP_PX;
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.QUICK_STEP_DRAG_SLOP_PX;
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.QUICK_STEP_TOUCH_SLOP_PX;
|
||||
|
||||
/**
|
||||
* Class to detect gestures on the navigation bar and implement quick scrub.
|
||||
@@ -215,17 +211,23 @@ public class QuickStepController implements GestureHelper {
|
||||
int pos, touchDown, offset, trackSize;
|
||||
|
||||
if (mIsVertical) {
|
||||
exceededScrubTouchSlop = yDiff > QUICK_SCRUB_TOUCH_SLOP_PX && yDiff > xDiff;
|
||||
exceededSwipeUpTouchSlop = xDiff > QUICK_STEP_TOUCH_SLOP_PX && xDiff > yDiff;
|
||||
exceededScrubDragSlop = yDiff > QUICK_SCRUB_DRAG_SLOP_PX && yDiff > xDiff;
|
||||
exceededScrubTouchSlop =
|
||||
yDiff > NavigationBarCompat.getQuickScrubTouchSlopPx() && yDiff > xDiff;
|
||||
exceededSwipeUpTouchSlop =
|
||||
xDiff > NavigationBarCompat.getQuickStepTouchSlopPx() && xDiff > yDiff;
|
||||
exceededScrubDragSlop =
|
||||
yDiff > NavigationBarCompat.getQuickScrubDragSlopPx() && yDiff > xDiff;
|
||||
pos = y;
|
||||
touchDown = mTouchDownY;
|
||||
offset = pos - mTrackRect.top;
|
||||
trackSize = mTrackRect.height();
|
||||
} else {
|
||||
exceededScrubTouchSlop = xDiff > QUICK_SCRUB_TOUCH_SLOP_PX && xDiff > yDiff;
|
||||
exceededSwipeUpTouchSlop = yDiff > QUICK_STEP_TOUCH_SLOP_PX && yDiff > xDiff;
|
||||
exceededScrubDragSlop = xDiff > QUICK_SCRUB_DRAG_SLOP_PX && xDiff > yDiff;
|
||||
exceededScrubTouchSlop =
|
||||
xDiff > NavigationBarCompat.getQuickScrubTouchSlopPx() && xDiff > yDiff;
|
||||
exceededSwipeUpTouchSlop =
|
||||
yDiff > NavigationBarCompat.getQuickStepTouchSlopPx() && yDiff > xDiff;
|
||||
exceededScrubDragSlop =
|
||||
xDiff > NavigationBarCompat.getQuickScrubDragSlopPx() && xDiff > yDiff;
|
||||
pos = x;
|
||||
touchDown = mTouchDownX;
|
||||
offset = pos - mTrackRect.left;
|
||||
|
||||
@@ -49,12 +49,11 @@ import com.android.systemui.OverviewProxyService;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.statusbar.phone.NavBarButtonProvider.ButtonInterface;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.NavigationBarCompat;
|
||||
|
||||
import static android.view.KeyEvent.KEYCODE_HOME;
|
||||
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK;
|
||||
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_LONG_CLICK;
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.QUICK_SCRUB_TOUCH_SLOP_PX;
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.QUICK_STEP_TOUCH_SLOP_PX;
|
||||
|
||||
public class KeyButtonView extends ImageView implements ButtonInterface {
|
||||
private static final String TAG = KeyButtonView.class.getSimpleName();
|
||||
@@ -234,10 +233,12 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
|
||||
x = (int)ev.getRawX();
|
||||
y = (int)ev.getRawY();
|
||||
|
||||
boolean exceededTouchSlopX = Math.abs(x - mTouchDownX) >
|
||||
(mIsVertical ? QUICK_SCRUB_TOUCH_SLOP_PX : QUICK_STEP_TOUCH_SLOP_PX);
|
||||
boolean exceededTouchSlopY = Math.abs(y - mTouchDownY) >
|
||||
(mIsVertical ? QUICK_STEP_TOUCH_SLOP_PX : QUICK_SCRUB_TOUCH_SLOP_PX);
|
||||
boolean exceededTouchSlopX = Math.abs(x - mTouchDownX) > (mIsVertical
|
||||
? NavigationBarCompat.getQuickScrubTouchSlopPx()
|
||||
: NavigationBarCompat.getQuickStepTouchSlopPx());
|
||||
boolean exceededTouchSlopY = Math.abs(y - mTouchDownY) > (mIsVertical
|
||||
? NavigationBarCompat.getQuickStepTouchSlopPx()
|
||||
: NavigationBarCompat.getQuickScrubTouchSlopPx());
|
||||
if (exceededTouchSlopX || exceededTouchSlopY) {
|
||||
// When quick step is enabled, prevent animating the ripple triggered by
|
||||
// setPressed and decide to run it on touch up
|
||||
|
||||
Reference in New Issue
Block a user