Limit the touch area for opening search to the right edge of the textfield.
Now all single taps to the title bar will result in either
a search or opening the bookmarks picker, depending on whether
they were past the right edge of the textfield.
Fixes http://b/issue?id=2113429
Also move the lock icon in between the favicon and the url. See
http://b/issue?id=2085847
Change-Id: I30447aa7517b6fc801d3cf34eff233db3a4ce635
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index adb9b7d..66a0d43 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -90,6 +90,7 @@
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
@@ -946,17 +947,31 @@
private void showFakeTitleBar() {
if (mFakeTitleBar == null) {
- WebView webView = getTopWindow();
+ final WebView webView = getTopWindow();
mFakeTitleBar = new TitleBar(this, webView);
mFakeTitleBar.setTitleAndUrl(null, webView.getUrl());
mFakeTitleBar.setProgress(webView.getProgress());
mFakeTitleBar.setFavicon(webView.getFavicon());
updateLockIconToLatest();
- View title = mFakeTitleBar.findViewById(R.id.title);
- title.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- onSearchRequested();
- closeOptionsMenu();
+ final View title = mFakeTitleBar.findViewById(R.id.title);
+ mFakeTitleBar.setOnTouchListener(new View.OnTouchListener() {
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_UP) {
+ if (event.getX() > title.getRight()) {
+ if (webView != null
+ && webView.getProgress() < 100) {
+ if (webView != null) {
+ webView.stopLoading();
+ }
+ } else {
+ bookmarksOrHistoryPicker(false);
+ }
+ } else {
+ onSearchRequested();
+ }
+ closeOptionsMenu();
+ }
+ return true;
}
});