am d5ada83c: ScaleGestureDetector needs to query the displaymetrics for the width/height on each touch down as orientation can change.
Merge commit 'd5ada83c719d366d3063572ca6ce5ab8918fd39b' into eclair-plus-aosp * commit 'd5ada83c719d366d3063572ca6ce5ab8918fd39b': ScaleGestureDetector needs to query the displaymetrics
This commit is contained in:
@@ -147,12 +147,9 @@ public class ScaleGestureDetector {
|
|||||||
|
|
||||||
public ScaleGestureDetector(Context context, OnScaleGestureListener listener) {
|
public ScaleGestureDetector(Context context, OnScaleGestureListener listener) {
|
||||||
ViewConfiguration config = ViewConfiguration.get(context);
|
ViewConfiguration config = ViewConfiguration.get(context);
|
||||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
mEdgeSlop = config.getScaledEdgeSlop();
|
mEdgeSlop = config.getScaledEdgeSlop();
|
||||||
mRightSlopEdge = metrics.widthPixels - mEdgeSlop;
|
|
||||||
mBottomSlopEdge = metrics.heightPixels - mEdgeSlop;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
@@ -165,6 +162,11 @@ public class ScaleGestureDetector {
|
|||||||
event.getPointerCount() >= 2) {
|
event.getPointerCount() >= 2) {
|
||||||
// We have a new multi-finger gesture
|
// We have a new multi-finger gesture
|
||||||
|
|
||||||
|
// as orientation can change, query the metrics in touch down
|
||||||
|
DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
|
||||||
|
mRightSlopEdge = metrics.widthPixels - mEdgeSlop;
|
||||||
|
mBottomSlopEdge = metrics.heightPixels - mEdgeSlop;
|
||||||
|
|
||||||
// Be paranoid in case we missed an event
|
// Be paranoid in case we missed an event
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user