summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-06-22 13:46:25 -0700
committerJohn Reck <jreck@google.com>2011-06-23 15:39:01 -0700
commit7e5b8b5ab04edd6cfe3acc4dadca42b11ba484c3 (patch)
treef3e801888af11a6630488a2f7dd3c0d2762d8381 /src/com
parent7035ce16de00315ed10784f83c76e924f124cebd (diff)
downloadpackages_apps_Browser-7e5b8b5ab04edd6cfe3acc4dadca42b11ba484c3.zip
packages_apps_Browser-7e5b8b5ab04edd6cfe3acc4dadca42b11ba484c3.tar.gz
packages_apps_Browser-7e5b8b5ab04edd6cfe3acc4dadca42b11ba484c3.tar.bz2
Titlebar Autoshow tweaks
Also consolidate some common code between phone and tablet Change-Id: I2e1be9be84b07726596d4b4fe7345c0074236be1
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/BaseUi.java7
-rw-r--r--src/com/android/browser/TabBar.java9
-rw-r--r--src/com/android/browser/TitleBarBase.java4
-rw-r--r--src/com/android/browser/TitleBarPhone.java3
-rw-r--r--src/com/android/browser/TitleBarXLarge.java32
5 files changed, 11 insertions, 44 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index f7d7a3c..ad45958 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -857,13 +857,14 @@ public abstract class BaseUi implements UI, WebViewFactory, ScrollListener {
@Override
public void onScroll(int visibleTitleHeight, boolean userInitiated) {
WebView view = mActiveTab != null ? mActiveTab.getWebView() : null;
- if (view == null || !userInitiated) {
+ if (view == null) {
return;
}
int scrollY = view.getScrollY();
- if (scrollY < (mLastScrollY - mTitlebarScrollTriggerSlop)) {
+ if (isTitleBarShowing()
+ || scrollY < (mLastScrollY - mTitlebarScrollTriggerSlop)) {
mLastScrollY = scrollY;
- if (visibleTitleHeight == 0) {
+ if (visibleTitleHeight == 0 && userInitiated) {
mHandler.removeMessages(MSG_HIDE_TITLEBAR);
showTitleBar();
Message msg = Message.obtain(mHandler, MSG_HIDE_TITLEBAR);
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index 1ea6071..8584afa 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -276,12 +276,9 @@ public class TabBar extends LinearLayout
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()
- && (!mUi.isEditingUrl() || userInitiated)) {
- mUi.hideTitleBar();
+ if (mTabControl.getCurrentTab() != null) {
+ if (visibleTitleHeight == 0 && !mUi.isTitleBarShowing()) {
+ if (!showsTitleBarIndicator()) {
showTitleBarIndicator(true);
}
} else {
diff --git a/src/com/android/browser/TitleBarBase.java b/src/com/android/browser/TitleBarBase.java
index e2c3432..cf3a6ef 100644
--- a/src/com/android/browser/TitleBarBase.java
+++ b/src/com/android/browser/TitleBarBase.java
@@ -209,7 +209,6 @@ public class TitleBarBase extends RelativeLayout
@Override
public void onAnimationStart(Animator animation) {
mWasCanceled = false;
- mUrlInput.setEnabled(false);
}
@Override
@@ -222,7 +221,6 @@ public class TitleBarBase extends RelativeLayout
setTranslationY(0);
}
mBaseUi.setTitleGravity(Gravity.NO_GRAVITY);
- mUrlInput.setEnabled(true);
}
@Override
@@ -462,6 +460,7 @@ public class TitleBarBase extends RelativeLayout
setFocusState(hasFocus);
}
if (hasFocus) {
+ mBaseUi.showTitleBar();
mUrlInput.forceIme();
if (mInVoiceMode) {
mUrlInput.forceFilter();
@@ -475,6 +474,7 @@ public class TitleBarBase extends RelativeLayout
mUrlInput.setText(currentTab.getUrl(), false);
}
}
+ mBaseUi.suggestHideTitleBar();
}
mUrlInput.clearNeedsUpdate();
}
diff --git a/src/com/android/browser/TitleBarPhone.java b/src/com/android/browser/TitleBarPhone.java
index de5fb7f..1fcaf4d 100644
--- a/src/com/android/browser/TitleBarPhone.java
+++ b/src/com/android/browser/TitleBarPhone.java
@@ -147,9 +147,6 @@ public class TitleBarPhone extends TitleBarBase implements OnFocusChangeListener
}
}
super.onFocusChange(v, hasFocus);
- if (!hasFocus) {
- mBaseUi.hideTitleBar();
- }
}
@Override
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index 69f6949..3d4d2ec 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -123,36 +123,6 @@ public class TitleBarXLarge extends TitleBarBase
}
@Override
- public void onFocusChange(View view, boolean hasFocus) {
- // if losing focus and not in touch mode, leave as is
- if (hasFocus || view.isInTouchMode() || mUrlInput.needsUpdate()) {
- setFocusState(hasFocus);
- mUrlContainer.setBackgroundDrawable(hasFocus
- ? mFocusDrawable : mUnfocusDrawable);
- }
- if (hasFocus) {
- mUrlInput.forceIme();
- if (mInVoiceMode) {
- mUrlInput.forceFilter();
- }
- } else if (!mUrlInput.needsUpdate()) {
- mUrlInput.dismissDropDown();
- mUrlInput.hideIME();
- if (mUseQuickControls) {
- mUi.hideTitleBar();
- }
-
- if (mUrlInput.getText().length() == 0) {
- Tab currentTab = mUiController.getTabControl().getCurrentTab();
- if (currentTab != null) {
- mUrlInput.setText(currentTab.getUrl(), false);
- }
- }
- }
- mUrlInput.clearNeedsUpdate();
- }
-
- @Override
public void setCurrentUrlIsBookmark(boolean isBookmark) {
mStar.setActivated(isBookmark);
}
@@ -226,6 +196,8 @@ public class TitleBarXLarge extends TitleBarBase
}
updateUrlIcon();
}
+ mUrlContainer.setBackgroundDrawable(focus
+ ? mFocusDrawable : mUnfocusDrawable);
}
private void stopOrRefresh() {