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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 33823005: Dynamically enable spatial navigation based on events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 2 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 | « no previous file | android_webview/java/src/org/chromium/android_webview/AwSettings.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 5e1ab63f707d0c5ef8f95bc87ac6bf7f6255afb1..ef26bf681c5492bb2bc119d4818e0504165a63fa 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -1223,10 +1223,27 @@ public class AwContents {
return mContentViewCore.onKeyUp(keyCode, event);
}
+ private boolean isDpadEvent(KeyEvent event) {
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ switch (event.getKeyCode()) {
+ case KeyEvent.KEYCODE_DPAD_CENTER:
+ case KeyEvent.KEYCODE_DPAD_DOWN:
+ case KeyEvent.KEYCODE_DPAD_UP:
+ case KeyEvent.KEYCODE_DPAD_LEFT:
+ case KeyEvent.KEYCODE_DPAD_RIGHT:
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* @see android.webkit.WebView#dispatchKeyEvent(KeyEvent)
*/
public boolean dispatchKeyEvent(KeyEvent event) {
+ if (isDpadEvent(event)) {
+ mSettings.setSpatialNavigationEnabled(true);
+ }
return mContentViewCore.dispatchKeyEvent(event);
}
@@ -1485,6 +1502,10 @@ public class AwContents {
public boolean onTouchEvent(MotionEvent event) {
if (mNativeAwContents == 0) return false;
+ if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
+ mSettings.setSpatialNavigationEnabled(false);
+ }
+
mScrollOffsetManager.setProcessingTouchEvent(true);
boolean rv = mContentViewCore.onTouchEvent(event);
mScrollOffsetManager.setProcessingTouchEvent(false);
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwSettings.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698