diff options
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/browser/BaseUi.java | 4 | ||||
-rw-r--r-- | src/com/android/browser/BrowserActivity.java | 2 | ||||
-rw-r--r-- | src/com/android/browser/Controller.java | 66 | ||||
-rw-r--r-- | src/com/android/browser/PhoneUi.java | 6 | ||||
-rw-r--r-- | src/com/android/browser/UI.java | 3 | ||||
-rw-r--r-- | src/com/android/browser/XLargeUi.java | 21 |
6 files changed, 43 insertions, 59 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java index 568a7e9..02d9199 100644 --- a/src/com/android/browser/BaseUi.java +++ b/src/com/android/browser/BaseUi.java @@ -32,6 +32,7 @@ import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; +import android.view.View.OnKeyListener; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; @@ -113,7 +114,6 @@ public abstract class BaseUi implements UI, WebViewFactory { mCustomViewContainer = (FrameLayout) mBrowserFrameLayout .findViewById(R.id.fullscreen_custom_content); frameLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS); - } /** @@ -286,6 +286,8 @@ public abstract class BaseUi implements UI, WebViewFactory { Log.w(LOGTAG, "mContainer is already attached to content in" + " attachTabToContentView!"); } + mainView.setNextFocusUpId(R.id.url_focused); + mainView.setNextFocusDownId(R.id.url_focused); mUiController.attachSubWindow(tab); } diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index a67b4e6..527f025 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -94,8 +94,6 @@ public class BrowserActivity extends Activity { if (((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE)) .isEnabled()) { setDefaultKeyMode(DEFAULT_KEYS_DISABLE); - } else { - setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); } mController = new Controller(this); diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index 6c6fe0b..16c57c6 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -63,7 +63,6 @@ import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Gravity; import android.view.KeyEvent; -import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -78,7 +77,6 @@ import android.webkit.WebChromeClient; import android.webkit.WebIconDatabase; import android.webkit.WebSettings; import android.webkit.WebView; -import android.widget.TextView; import java.io.ByteArrayOutputStream; import java.io.File; @@ -2020,7 +2018,6 @@ public class Controller } protected void reuseTab(Tab appTab, String appId, UrlData urlData) { - Log.i(LOGTAG, "Reusing tab for " + appId); // Dismiss the subwindow if applicable. dismissSubWindow(appTab); // Since we might kill the WebView, remove it from the @@ -2413,67 +2410,28 @@ public class Controller return true; } break; - case KeyEvent.KEYCODE_B: - if (ctrl) { - bookmarksOrHistoryPicker(false); - return true; - } - break; +// case KeyEvent.KEYCODE_B: // menu case KeyEvent.KEYCODE_C: if (ctrl) { webView.copySelection(); return true; } break; - case KeyEvent.KEYCODE_D: - if (ctrl) { - bookmarkCurrentPage(AddBookmarkPage.DEFAULT_FOLDER_ID); - return true; - } - break; +// case KeyEvent.KEYCODE_D: // menu // case KeyEvent.KEYCODE_E: // in Chrome: puts '?' in URL bar - case KeyEvent.KEYCODE_F: - if (ctrl) { - webView.showFindDialog(null, true); - return true; - } - break; +// case KeyEvent.KEYCODE_F: // menu // case KeyEvent.KEYCODE_G: // in Chrome: finds next match - case KeyEvent.KEYCODE_H: - if (ctrl) { - bookmarksOrHistoryPicker(true); - return true; - } - break; +// case KeyEvent.KEYCODE_H: // menu // case KeyEvent.KEYCODE_I: // unused - case KeyEvent.KEYCODE_J: - if (ctrl) { - viewDownloads(); - return true; - } - break; +// case KeyEvent.KEYCODE_J: // menu // case KeyEvent.KEYCODE_K: // in Chrome: puts '?' in URL bar - case KeyEvent.KEYCODE_L: - if (ctrl) { - editUrl(); - return true; - } - break; +// case KeyEvent.KEYCODE_L: // menu // case KeyEvent.KEYCODE_M: // unused // case KeyEvent.KEYCODE_N: // in Chrome: new window // case KeyEvent.KEYCODE_O: // in Chrome: open file // case KeyEvent.KEYCODE_P: // in Chrome: print page // case KeyEvent.KEYCODE_Q: // unused - case KeyEvent.KEYCODE_R: - if (ctrl) { - if (mInLoad) { - stopLoading(); - } else { - webView.reload(); - } - return true; - } - break; +// case KeyEvent.KEYCODE_R: // case KeyEvent.KEYCODE_S: // in Chrome: saves page case KeyEvent.KEYCODE_T: if (ctrl) { @@ -2487,17 +2445,13 @@ public class Controller break; // case KeyEvent.KEYCODE_U: // in Chrome: opens source of page // case KeyEvent.KEYCODE_V: // text view intercepts to paste - case KeyEvent.KEYCODE_W: - if (ctrl) { - closeCurrentTab(); - return true; - } - break; +// case KeyEvent.KEYCODE_W: // menu // case KeyEvent.KEYCODE_X: // text view intercepts to cut // case KeyEvent.KEYCODE_Y: // unused // case KeyEvent.KEYCODE_Z: // unused } - return false; + // if we get here, it is a regular key and webview is not null + return mUi.dispatchKey(keyCode, event); } boolean onKeyUp(int keyCode, KeyEvent event) { diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java index 99fc4a0..4119c29 100644 --- a/src/com/android/browser/PhoneUi.java +++ b/src/com/android/browser/PhoneUi.java @@ -22,6 +22,7 @@ import android.graphics.PixelFormat; import android.util.Log; import android.view.ActionMode; import android.view.Gravity; +import android.view.KeyEvent; import android.view.Menu; import android.view.View; import android.view.ViewGroup; @@ -269,4 +270,9 @@ public class PhoneUi extends BaseUi { hideFakeTitleBar(); } + @Override + public boolean dispatchKey(int code, KeyEvent event) { + return false; + } + } diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java index 4738522..8de2b19 100644 --- a/src/com/android/browser/UI.java +++ b/src/com/android/browser/UI.java @@ -20,6 +20,7 @@ import android.content.res.Configuration; import android.graphics.Bitmap; import android.os.Bundle; import android.view.ActionMode; +import android.view.KeyEvent; import android.view.Menu; import android.view.View; import android.webkit.WebChromeClient.CustomViewCallback; @@ -117,4 +118,6 @@ public interface UI { void showMaxTabsWarning(); + boolean dispatchKey(int code, KeyEvent event); + } diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java index a9cc9fe..2f27aa1 100644 --- a/src/com/android/browser/XLargeUi.java +++ b/src/com/android/browser/XLargeUi.java @@ -24,6 +24,7 @@ import android.os.Bundle; import android.util.Log; import android.view.ActionMode; import android.view.Gravity; +import android.view.KeyEvent; import android.view.View; import android.webkit.WebChromeClient.CustomViewCallback; import android.webkit.WebView; @@ -396,4 +397,24 @@ public class XLargeUi extends BaseUi implements ScrollListener { mActivity.getActionBar().show(); } } + + @Override + public boolean dispatchKey(int code, KeyEvent event) { + WebView web = getActiveTab().getWebView(); + switch (code) { + case KeyEvent.KEYCODE_TAB: + case KeyEvent.KEYCODE_DPAD_UP: + case KeyEvent.KEYCODE_DPAD_LEFT: + if ((web != null) && web.hasFocus()) { + editUrl(true); + return true; + } + } + if (event.isPrintingKey() && !mFakeTitleBar.isEditingUrl()) { + editUrl(true); + return mContentView.dispatchKeyEvent(event); + } + return false; + } + } |