diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-04-20 18:18:51 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-04-21 15:17:52 -0700 |
commit | 44bc17c6b517aef35a390c81b5aa79c4f284f744 (patch) | |
tree | b4dabc94a8974f81cf7ea855a93e307205c5b8d7 /test-runner/src | |
parent | 52c03d2cb9a782366e804d1910a7c8f072b05353 (diff) | |
download | frameworks_base-44bc17c6b517aef35a390c81b5aa79c4f284f744.zip frameworks_base-44bc17c6b517aef35a390c81b5aa79c4f284f744.tar.gz frameworks_base-44bc17c6b517aef35a390c81b5aa79c4f284f744.tar.bz2 |
Rework display size access.
Applications now get the display size from the window manager. No
behavior should be changed yet, this is just prep for some real
changes.
Change-Id: I2958a6660895c1cba2b670509600014e55ee9273
Diffstat (limited to 'test-runner/src')
-rw-r--r-- | test-runner/src/android/test/TouchUtils.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/test-runner/src/android/test/TouchUtils.java b/test-runner/src/android/test/TouchUtils.java index 69c6d2d..acbde0b 100644 --- a/test-runner/src/android/test/TouchUtils.java +++ b/test-runner/src/android/test/TouchUtils.java @@ -18,6 +18,7 @@ package android.test; import android.app.Activity; import android.app.Instrumentation; +import android.graphics.Point; import android.os.SystemClock; import android.view.Display; import android.view.Gravity; @@ -53,12 +54,12 @@ public class TouchUtils { */ public static void dragQuarterScreenDown(InstrumentationTestCase test, Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); - int screenHeight = display.getHeight(); - int screenWidth = display.getWidth(); + final Point size = new Point(); + display.getSize(size); - final float x = screenWidth / 2.0f; - final float fromY = screenHeight * 0.5f; - final float toY = screenHeight * 0.75f; + final float x = size.x / 2.0f; + final float fromY = size.y * 0.5f; + final float toY = size.y * 0.75f; drag(test, x, x, fromY, toY, 4); } @@ -83,12 +84,12 @@ public class TouchUtils { */ public static void dragQuarterScreenUp(InstrumentationTestCase test, Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); - int screenHeight = display.getHeight(); - int screenWidth = display.getWidth(); + final Point size = new Point(); + display.getSize(size); - final float x = screenWidth / 2.0f; - final float fromY = screenHeight * 0.5f; - final float toY = screenHeight * 0.25f; + final float x = size.x / 2.0f; + final float fromY = size.y * 0.5f; + final float toY = size.y * 0.25f; drag(test, x, x, fromY, toY, 4); } |