summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/MotionEvent.java
diff options
context:
space:
mode:
authorMitsuru Oshima <>2009-04-28 18:12:09 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-28 18:12:09 -0700
commit8169daed2f7a8731d478b884b1f455c747b88478 (patch)
tree3ab1f44b128cef2f18f470af7483a8405329da23 /core/java/android/view/MotionEvent.java
parent8d112675879a2b83197d3b4ae4fb623abd1a1ec3 (diff)
downloadframeworks_base-8169daed2f7a8731d478b884b1f455c747b88478.zip
frameworks_base-8169daed2f7a8731d478b884b1f455c747b88478.tar.gz
frameworks_base-8169daed2f7a8731d478b884b1f455c747b88478.tar.bz2
AI 147976: Compatibility mode support. Part 2.
* Introduced ApplicationScale (may not be good name. CompatibilityScale? CanvasScale? Pls let me know if you have better idea) * Changes to RootView / SurfaceView - Makes the app believe it's running in the supported density/resolution. - Makes the window manager believe it's running at the right density/resolution. * Added methods to Rect/Event for scaling up/down. Known issues: * certain kind of images (such as nine patch for buttons) seesm to be loaded not by app, thus does not take the scale into account, which, in turn, is causing layout issue. * ZoomButton in MapView is rendered in wrong place * Transparent region on Surface is not correct * Specifying different densities in one process is not working. BUG=1770627 Automated import of CL 147976
Diffstat (limited to 'core/java/android/view/MotionEvent.java')
-rw-r--r--core/java/android/view/MotionEvent.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index 882a079..2402660 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -102,7 +102,7 @@ public final class MotionEvent implements Parcelable {
private float mYPrecision;
private int mDeviceId;
private int mEdgeFlags;
-
+
private MotionEvent mNext;
private RuntimeException mRecycledLocation;
private boolean mRecycled;
@@ -210,7 +210,29 @@ public final class MotionEvent implements Parcelable {
return ev;
}
-
+
+ /**
+ * Scales down the cood of this event by the given scale.
+ *
+ * @hide
+ */
+ public void scale(float scale) {
+ if (scale != 1.0f) {
+ mX *= scale;
+ mY *= scale;
+ mRawX *= scale;
+ mRawY *= scale;
+ mSize *= scale;
+ mXPrecision *= scale;
+ mYPrecision *= scale;
+ float[] history = mHistory;
+ int length = history.length;
+ for (int i = 0; i < length; i++) {
+ history[i] *= scale;
+ }
+ }
+ }
+
/**
* Create a new MotionEvent, copying from an existing one.
*/
@@ -682,4 +704,3 @@ public final class MotionEvent implements Parcelable {
}
}
-