Merge "Using correct slop for checking quickstep gesture" into qt-dev
am: 6f72636bb6
Change-Id: Ibec1b1cbdca8dbf0bacd18f635ebc1d29c343f14
This commit is contained in:
@@ -21,7 +21,9 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.WindowManagerPolicyConstants;
|
||||
|
||||
import com.android.internal.policy.ScreenDecorationsUtils;
|
||||
@@ -100,6 +102,18 @@ public class QuickStepContract {
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ratio of quickstep touch slop (when system takes over the touch) to view touch slop
|
||||
*/
|
||||
public static final float QUICKSTEP_TOUCH_SLOP_RATIO = 3;
|
||||
|
||||
/**
|
||||
* Touch slop for quickstep gesture
|
||||
*/
|
||||
public static final float getQuickStepTouchSlopPx(Context context) {
|
||||
return QUICKSTEP_TOUCH_SLOP_RATIO * ViewConfiguration.get(context).getScaledTouchSlop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Touch slopes and thresholds for quick step operations. Drag slop is the point where the
|
||||
* home button press/long press over are ignored and will start to drag when exceeded and the
|
||||
|
||||
@@ -249,13 +249,8 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
|
||||
x = (int)ev.getRawX();
|
||||
y = (int)ev.getRawY();
|
||||
|
||||
boolean exceededTouchSlopX = Math.abs(x - mTouchDownX) > (mIsVertical
|
||||
? QuickStepContract.getQuickScrubTouchSlopPx()
|
||||
: QuickStepContract.getQuickStepTouchSlopPx());
|
||||
boolean exceededTouchSlopY = Math.abs(y - mTouchDownY) > (mIsVertical
|
||||
? QuickStepContract.getQuickStepTouchSlopPx()
|
||||
: QuickStepContract.getQuickScrubTouchSlopPx());
|
||||
if (exceededTouchSlopX || exceededTouchSlopY) {
|
||||
float slop = QuickStepContract.getQuickStepTouchSlopPx(getContext());
|
||||
if (Math.abs(x - mTouchDownX) > slop || Math.abs(y - mTouchDownY) > slop) {
|
||||
// When quick step is enabled, prevent animating the ripple triggered by
|
||||
// setPressed and decide to run it on touch up
|
||||
setPressed(false);
|
||||
|
||||
Reference in New Issue
Block a user