summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/Controller.java
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2011-01-10 11:17:07 -0500
committerCary Clark <cary@android.com>2011-01-10 12:43:27 -0500
commit160bbb9565b63302c88b032e4653f8268553175f (patch)
tree2a337918c105115c03071d00d1643f64f29ee056 /src/com/android/browser/Controller.java
parenta06ac9c63910eda7028bee2ba6ff4897e534a0bc (diff)
downloadpackages_apps_Browser-160bbb9565b63302c88b032e4653f8268553175f.tar.gz
packages_apps_Browser-160bbb9565b63302c88b032e4653f8268553175f.tar.bz2
packages_apps_Browser-160bbb9565b63302c88b032e4653f8268553175f.zip
be exact about key acceleration
Make the key acceleration detection exact; if accelerator requires shift, allow only shift, and so on. bug:3301564 Change-Id: I9b0ff27d5bb1d91f8aa0eae0af37a6fe4dabc54e
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r--src/com/android/browser/Controller.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index a5a60902c..e707e3649 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -2352,9 +2352,11 @@ public class Controller
* @return true if handled, false to pass to super
*/
boolean onKeyDown(int keyCode, KeyEvent event) {
+ boolean noModifiers = event.hasNoModifiers();
+
// Even if MENU is already held down, we need to call to super to open
// the IME on long press.
- if (KeyEvent.KEYCODE_MENU == keyCode) {
+ if (!noModifiers && KeyEvent.KEYCODE_MENU == keyCode) {
mMenuIsDown = true;
return false;
}
@@ -2366,23 +2368,26 @@ public class Controller
WebView webView = getCurrentTopWebView();
if (webView == null) return false;
- boolean ctrl = event.isCtrlPressed();
+ boolean ctrl = event.hasModifiers(KeyEvent.META_CTRL_ON);
+ boolean shift = event.hasModifiers(KeyEvent.META_SHIFT_ON);
switch(keyCode) {
case KeyEvent.KEYCODE_ESCAPE:
+ if (!noModifiers) break;
stopLoading();
return true;
case KeyEvent.KEYCODE_SPACE:
// WebView/WebTextView handle the keys in the KeyDown. As
// the Activity's shortcut keys are only handled when WebView
// doesn't, have to do it in onKeyDown instead of onKeyUp.
- if (event.isShiftPressed()) {
+ if (shift) {
pageUp();
- } else {
+ } else if (noModifiers) {
pageDown();
}
return true;
case KeyEvent.KEYCODE_BACK:
+ if (!noModifiers) break;
if (event.getRepeatCount() == 0) {
event.startTracking();
return true;
@@ -2498,6 +2503,7 @@ public class Controller
}
boolean onKeyUp(int keyCode, KeyEvent event) {
+ if (!event.hasNoModifiers()) return false;
switch(keyCode) {
case KeyEvent.KEYCODE_MENU:
mMenuIsDown = false;