diff options
author | liyuqian <liyuqian@google.com> | 2016-05-17 12:44:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-17 12:44:20 -0700 |
commit | d3cdbcad65673596ae37e65fec842d8d4d81c5a7 (patch) | |
tree | f7b71e933a44a18e17af1d93d996ac4b2d0c4f59 /platform_tools | |
parent | 1483d0f73ea484bf582b81f031222082f33d6d35 (diff) |
Implement touch control
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1982643004
Review-Url: https://codereview.chromium.org/1982643004
Diffstat (limited to 'platform_tools')
-rw-r--r-- | platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java index d6fe710aeb..49f711d517 100644 --- a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java +++ b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java @@ -32,6 +32,7 @@ public class ViewerActivity private native void onSurfaceChanged(long handle, Surface surface); private native void onSurfaceDestroyed(long handle); private native void onKeyPressed(long handle, int keycode); + private native void onTouched(long handle, int owner, int state, float x, float y); @Override public boolean onCreateOptionsMenu(Menu menu) { @@ -96,6 +97,14 @@ public class ViewerActivity @Override public boolean onTouch(View v, MotionEvent event) { - return false; // TODO pass the touch event to native code + int count = event.getPointerCount(); + for (int i = 0; i < count; i++) { + final float x = event.getX(i); + final float y = event.getY(i); + final int owner = event.getPointerId(i); + int action = event.getAction() & MotionEvent.ACTION_MASK; + onTouched(mApplication.getNativeHandle(), owner, action, x, y); + } + return true; } } |