Merge "Add isQuickScaleEnabled to ScaleGestureDetector" into klp-dev

This commit is contained in:
Mindy Pereira
2013-09-17 23:57:54 +00:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 4 deletions

View File

@@ -27337,6 +27337,7 @@ package android.view {
method public float getScaleFactor();
method public long getTimeDelta();
method public boolean isInProgress();
method public boolean isQuickScaleEnabled();
method public boolean onTouchEvent(android.view.MotionEvent);
method public void setQuickScaleEnabled(boolean);
}

View File

@@ -130,7 +130,7 @@ public class ScaleGestureDetector {
private float mFocusX;
private float mFocusY;
private boolean mDoubleTapScales;
private boolean mQuickScaleEnabled;
private float mCurrSpan;
private float mPrevSpan;
@@ -307,7 +307,7 @@ public class ScaleGestureDetector {
final int action = event.getActionMasked();
// Forward the event to check for double tap gesture
if (mDoubleTapScales) {
if (mQuickScaleEnabled) {
mGestureDetector.onTouchEvent(event);
}
@@ -456,8 +456,8 @@ public class ScaleGestureDetector {
* @param scales true to enable quick scaling, false to disable
*/
public void setQuickScaleEnabled(boolean scales) {
mDoubleTapScales = scales;
if (mDoubleTapScales && mGestureDetector == null) {
mQuickScaleEnabled = scales;
if (mQuickScaleEnabled && mGestureDetector == null) {
GestureDetector.SimpleOnGestureListener gestureListener =
new GestureDetector.SimpleOnGestureListener() {
@Override
@@ -472,6 +472,14 @@ public class ScaleGestureDetector {
}
}
/**
* Return whether the quick scale gesture, in which the user performs a double tap followed by a
* swipe, should perform scaling. {@see #setQuickScaleEnabled(boolean)}.
*/
public boolean isQuickScaleEnabled() {
return mQuickScaleEnabled;
}
/**
* Returns {@code true} if a scale gesture is in progress.
*/