Merge "Squish!" into jb-mr1-dev
This commit is contained in:
@@ -137,6 +137,7 @@ public class ScaleGestureDetector {
|
|||||||
private long mPrevTime;
|
private long mPrevTime;
|
||||||
private boolean mInProgress;
|
private boolean mInProgress;
|
||||||
private int mSpanSlop;
|
private int mSpanSlop;
|
||||||
|
private int mMinSpan;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Consistency verifier for debugging purposes.
|
* Consistency verifier for debugging purposes.
|
||||||
@@ -149,6 +150,8 @@ public class ScaleGestureDetector {
|
|||||||
mContext = context;
|
mContext = context;
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
mSpanSlop = ViewConfiguration.get(context).getScaledTouchSlop() * 2;
|
mSpanSlop = ViewConfiguration.get(context).getScaledTouchSlop() * 2;
|
||||||
|
mMinSpan = context.getResources().getDimensionPixelSize(
|
||||||
|
com.android.internal.R.dimen.config_minScalingSpan);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,8 +212,12 @@ public class ScaleGestureDetector {
|
|||||||
float devSumX = 0, devSumY = 0;
|
float devSumX = 0, devSumY = 0;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (skipIndex == i) continue;
|
if (skipIndex == i) continue;
|
||||||
devSumX += Math.abs(event.getX(i) - focusX);
|
|
||||||
devSumY += Math.abs(event.getY(i) - focusY);
|
// touchMajor/Minor are axes of an ellipse; average them together and
|
||||||
|
// convert the resulting 'diameter' into a radius.
|
||||||
|
final float touchSize = (event.getTouchMajor(i) + event.getTouchMinor(i)) / 4;
|
||||||
|
devSumX += Math.abs(event.getX(i) - focusX) + touchSize;
|
||||||
|
devSumY += Math.abs(event.getY(i) - focusY) + touchSize;
|
||||||
}
|
}
|
||||||
final float devX = devSumX / div;
|
final float devX = devSumX / div;
|
||||||
final float devY = devSumY / div;
|
final float devY = devSumY / div;
|
||||||
@@ -228,7 +235,7 @@ public class ScaleGestureDetector {
|
|||||||
final boolean wasInProgress = mInProgress;
|
final boolean wasInProgress = mInProgress;
|
||||||
mFocusX = focusX;
|
mFocusX = focusX;
|
||||||
mFocusY = focusY;
|
mFocusY = focusY;
|
||||||
if (mInProgress && (span == 0 || configChanged)) {
|
if (mInProgress && (span < mMinSpan || configChanged)) {
|
||||||
mListener.onScaleEnd(this);
|
mListener.onScaleEnd(this);
|
||||||
mInProgress = false;
|
mInProgress = false;
|
||||||
mInitialSpan = span;
|
mInitialSpan = span;
|
||||||
@@ -238,7 +245,7 @@ public class ScaleGestureDetector {
|
|||||||
mPrevSpanY = mCurrSpanY = spanY;
|
mPrevSpanY = mCurrSpanY = spanY;
|
||||||
mInitialSpan = mPrevSpan = mCurrSpan = span;
|
mInitialSpan = mPrevSpan = mCurrSpan = span;
|
||||||
}
|
}
|
||||||
if (!mInProgress && span != 0 &&
|
if (!mInProgress && span > mMinSpan &&
|
||||||
(wasInProgress || Math.abs(span - mInitialSpan) > mSpanSlop)) {
|
(wasInProgress || Math.abs(span - mInitialSpan) > mSpanSlop)) {
|
||||||
mPrevSpanX = mCurrSpanX = spanX;
|
mPrevSpanX = mCurrSpanX = spanX;
|
||||||
mPrevSpanY = mCurrSpanY = spanY;
|
mPrevSpanY = mCurrSpanY = spanY;
|
||||||
|
|||||||
@@ -925,4 +925,10 @@
|
|||||||
|
|
||||||
<!-- Maximum number of supported users -->
|
<!-- Maximum number of supported users -->
|
||||||
<integer name="config_multiuserMaximumUsers">1</integer>
|
<integer name="config_multiuserMaximumUsers">1</integer>
|
||||||
|
|
||||||
|
<!-- Minimum span needed to begin a touch scaling gesture.
|
||||||
|
This also takes into account the size of any active touch points.
|
||||||
|
Devices with screens that deviate too far from their assigned density
|
||||||
|
bucket should consider tuning this value in a device-specific overlay. -->
|
||||||
|
<dimen name="config_minScalingSpan">25mm</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1112,6 +1112,8 @@
|
|||||||
<java-symbol type="layout" name="media_route_list_item_collapse_group" />
|
<java-symbol type="layout" name="media_route_list_item_collapse_group" />
|
||||||
<java-symbol type="string" name="bluetooth_a2dp_audio_route_name" />
|
<java-symbol type="string" name="bluetooth_a2dp_audio_route_name" />
|
||||||
|
|
||||||
|
<java-symbol type="dimen" name="config_minScalingSpan" />
|
||||||
|
|
||||||
<!-- From android.policy -->
|
<!-- From android.policy -->
|
||||||
<java-symbol type="anim" name="app_starting_exit" />
|
<java-symbol type="anim" name="app_starting_exit" />
|
||||||
<java-symbol type="anim" name="lock_screen_behind_enter" />
|
<java-symbol type="anim" name="lock_screen_behind_enter" />
|
||||||
|
|||||||
Reference in New Issue
Block a user