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

Unified Diff: sky/shell/org/domokit/sky/shell/PlatformView.java

Issue 969493002: Add support for scroll and fling gestures to SkyShell. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: updated Created 5 years, 10 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 | « sky/shell/org/domokit/sky/shell/GestureProvider.java ('k') | sky/shell/ui/input_event_converter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/org/domokit/sky/shell/PlatformView.java
diff --git a/sky/shell/org/domokit/sky/shell/PlatformView.java b/sky/shell/org/domokit/sky/shell/PlatformView.java
index e24cbdf44da9b53a31de65b9c75960cc5f7dd905..07af2b46745bbbae2b91eb6994e55d44779fe19f 100644
--- a/sky/shell/org/domokit/sky/shell/PlatformView.java
+++ b/sky/shell/org/domokit/sky/shell/PlatformView.java
@@ -26,10 +26,14 @@ import org.chromium.mojom.sky.ViewportObserver;
* A view containing Sky
*/
@JNINamespace("sky::shell")
-public class PlatformView extends SurfaceView {
+public class PlatformView extends SurfaceView
+ implements GestureProvider.OnGestureListener {
+ private static final String TAG = "PlatformView";
+
private long mNativePlatformView;
private ViewportObserver.Proxy mViewportObserver;
private final SurfaceHolder.Callback mSurfaceCallback;
+ private GestureProvider mGestureProvider;
public PlatformView(Context context) {
super(context);
@@ -62,6 +66,8 @@ public class PlatformView extends SurfaceView {
}
};
getHolder().addCallback(mSurfaceCallback);
+
+ mGestureProvider = new GestureProvider(context, this);
}
@Override
@@ -116,6 +122,8 @@ public class PlatformView extends SurfaceView {
@Override
public boolean onTouchEvent(MotionEvent event) {
+ mGestureProvider.onTouchEvent(event);
+
int maskedAction = event.getActionMasked();
// ACTION_UP, ACTION_POINTER_UP, ACTION_DOWN, and ACTION_POINTER_DOWN
// only apply to a single pointer, other events apply to all pointers.
@@ -135,6 +143,11 @@ public class PlatformView extends SurfaceView {
return true;
}
+ @Override
+ public void onGestureEvent(InputEvent event) {
+ mViewportObserver.onInputEvent(event);
+ }
+
public void loadUrl(String url) {
mViewportObserver.loadUrl(url);
}
« no previous file with comments | « sky/shell/org/domokit/sky/shell/GestureProvider.java ('k') | sky/shell/ui/input_event_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698