summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-02-18 15:47:21 -0800
committerMichael Kolb <kolby@google.com>2011-02-18 15:53:43 -0800
commit5ee018e25ecda8955f865cbf7b0b946bcad2b294 (patch)
tree94d4c41440b4d073e649459e222fd0b5aec8e929 /src/com/android
parentd695037e94f7d231535f2e4c9e7f0ba332af0f2f (diff)
downloadpackages_apps_Browser-5ee018e25ecda8955f865cbf7b0b946bcad2b294.zip
packages_apps_Browser-5ee018e25ecda8955f865cbf7b0b946bcad2b294.tar.gz
packages_apps_Browser-5ee018e25ecda8955f865cbf7b0b946bcad2b294.tar.bz2
don't scroll title bar while editing
Bug: 3405814 Check if scroll is user initiated and if user is editing url before hiding titlebar when scrolling Change-Id: Icc32ef1cc83018021ebe12402aec016c9555e3a9
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/browser/ScrollWebView.java17
-rw-r--r--src/com/android/browser/TabBar.java7
-rw-r--r--src/com/android/browser/XLargeUi.java8
3 files changed, 25 insertions, 7 deletions
diff --git a/src/com/android/browser/ScrollWebView.java b/src/com/android/browser/ScrollWebView.java
index e2ef902..1d7f23a 100644
--- a/src/com/android/browser/ScrollWebView.java
+++ b/src/com/android/browser/ScrollWebView.java
@@ -18,6 +18,7 @@ package com.android.browser;
import android.content.Context;
import android.util.AttributeSet;
+import android.view.MotionEvent;
import android.view.View;
import android.webkit.WebView;
@@ -31,6 +32,7 @@ public class ScrollWebView extends WebView implements Runnable {
private ScrollListener mScrollListener;
private boolean mIsCancelled;
private boolean mBackgroundRemoved = false;
+ private boolean mUserInitiated = false;
/**
* @param context
@@ -71,7 +73,7 @@ public class ScrollWebView extends WebView implements Runnable {
// scroll runnable implementation
public void run() {
if (!mIsCancelled && (mScrollListener != null)) {
- mScrollListener.onScroll(getVisibleTitleHeight());
+ mScrollListener.onScroll(getVisibleTitleHeight(), mUserInitiated);
}
}
@@ -89,6 +91,17 @@ public class ScrollWebView extends WebView implements Runnable {
}
@Override
+ public boolean onTouchEvent(MotionEvent evt) {
+ if (MotionEvent.ACTION_DOWN == evt.getActionMasked()) {
+ mUserInitiated = true;
+ } else if (MotionEvent.ACTION_UP == evt.getActionMasked()
+ || (MotionEvent.ACTION_CANCEL == evt.getActionMasked())) {
+ mUserInitiated = false;
+ }
+ return super.onTouchEvent(evt);
+ }
+
+ @Override
public void stopScroll() {
mIsCancelled = true;
super.stopScroll();
@@ -111,7 +124,7 @@ public class ScrollWebView extends WebView implements Runnable {
// callback for scroll events
interface ScrollListener {
- public void onScroll(int visibleTitleHeight);
+ public void onScroll(int visibleTitleHeight, boolean userInitiated);
}
@Override
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index 4fb3ad4..9da1927 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -262,13 +262,14 @@ public class TabBar extends LinearLayout
// webview scroll listener
@Override
- public void onScroll(int visibleTitleHeight) {
+ public void onScroll(int visibleTitleHeight, boolean userInitiated) {
if (mUseQuickControls) return;
// isLoading is using the current tab, which initially might not be set yet
if (mTabControl.getCurrentTab() != null
&& !isLoading()) {
if (visibleTitleHeight == 0) {
- if (!showsTitleBarIndicator()) {
+ if (!showsTitleBarIndicator()
+ && (!mUi.isEditingUrl() || userInitiated)) {
mUi.hideTitleBar();
showTitleBarIndicator(true);
}
@@ -606,7 +607,7 @@ public class TabBar extends LinearLayout
WebView webview = tab.getWebView();
if (webview != null) {
int h = webview.getVisibleTitleHeight();
- onScroll(h);
+ onScroll(h, true);
}
}
}
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index 90e3683..8684042 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -147,8 +147,8 @@ public class XLargeUi extends BaseUi implements ScrollListener {
}
@Override
- public void onScroll(int visibleTitleHeight) {
- mTabBar.onScroll(visibleTitleHeight);
+ public void onScroll(int visibleTitleHeight, boolean userInitiated) {
+ mTabBar.onScroll(visibleTitleHeight, userInitiated);
}
void stopWebViewScrolling() {
@@ -297,6 +297,10 @@ public class XLargeUi extends BaseUi implements ScrollListener {
}
}
+ public boolean isEditingUrl() {
+ return mTitleBar.isEditingUrl();
+ }
+
@Override
protected TitleBarBase getTitleBar() {
return mTitleBar;