Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(945)

Unified Diff: platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java

Issue 1982643004: Implement touch control (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkMutex Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/viewer.gyp ('k') | tools/viewer/Viewer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java
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 d6fe710aeb0fa8fa0f8a3b9daf2f8f11886de67b..49f711d517171556670b14cd8432a3cff7a2e474 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;
}
}
« no previous file with comments | « gyp/viewer.gyp ('k') | tools/viewer/Viewer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698