summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-08-11 17:48:53 -0700
committerJohn Reck <jreck@google.com>2011-08-12 09:05:49 -0700
commit58891907e3cf77b72f1107ef5d9f4c984cb176ed (patch)
treed7074d706a07afe6a04fc7de3776719630dbc8ec
parent31a8579c697615e83ff2f4ddc8131ce3bf1bea8a (diff)
downloadpackages_apps_Browser-58891907e3cf77b72f1107ef5d9f4c984cb176ed.zip
packages_apps_Browser-58891907e3cf77b72f1107ef5d9f4c984cb176ed.tar.gz
packages_apps_Browser-58891907e3cf77b72f1107ef5d9f4c984cb176ed.tar.bz2
Don't hide urlbar when favicon menu is open
Bug: 5144824 Change-Id: I691f094ab594621f14adefabfb44c1ea967fdec2
-rw-r--r--src/com/android/browser/BaseUi.java3
-rw-r--r--src/com/android/browser/NavigationBarBase.java30
-rw-r--r--src/com/android/browser/NavigationBarPhone.java19
-rw-r--r--src/com/android/browser/PhoneUi.java12
4 files changed, 36 insertions, 28 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index f92368e..368021a 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -793,7 +793,8 @@ public abstract class BaseUi implements UI, OnTouchListener {
* as if the user is editing the URL bar or if the page is loading
*/
public void suggestHideTitleBar() {
- if (!isLoading() && !isEditingUrl() && !mTitleBar.wantsToBeVisible()) {
+ if (!isLoading() && !isEditingUrl() && !mTitleBar.wantsToBeVisible()
+ && !mNavigationBar.isMenuShowing()) {
hideTitleBar();
}
}
diff --git a/src/com/android/browser/NavigationBarBase.java b/src/com/android/browser/NavigationBarBase.java
index aa8b79f..94d6530 100644
--- a/src/com/android/browser/NavigationBarBase.java
+++ b/src/com/android/browser/NavigationBarBase.java
@@ -33,6 +33,7 @@ import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
+import android.widget.PopupMenu.OnDismissListener;
import android.widget.PopupMenu.OnMenuItemClickListener;
import com.android.browser.UI.DropdownChangeListener;
@@ -43,7 +44,7 @@ import java.util.List;
public class NavigationBarBase extends LinearLayout implements OnClickListener,
OnMenuItemClickListener, UrlInputListener, OnFocusChangeListener,
- TextChangeWatcher {
+ TextChangeWatcher, OnDismissListener {
protected BaseUi mBaseUi;
protected TitleBar mTitleBar;
@@ -54,6 +55,8 @@ public class NavigationBarBase extends LinearLayout implements OnClickListener,
private ImageView mFavicon;
private ImageView mLockIcon;
private View mUaSwitcher;
+ private boolean mUaSwitcherShowing;
+ private PopupMenu mUaSwitcherMenu;
public NavigationBarBase(Context context) {
super(context);
@@ -116,9 +119,9 @@ public class NavigationBarBase extends LinearLayout implements OnClickListener,
WebView web = mTitleBar.getCurrentWebView();
if (web == null) return;
boolean desktop = settings.hasDesktopUseragent(web);
- PopupMenu popup = new PopupMenu(mContext, mUaSwitcher);
- Menu menu = popup.getMenu();
- popup.getMenuInflater().inflate(R.menu.ua_switcher, menu);
+ mUaSwitcherMenu = new PopupMenu(mContext, mUaSwitcher);
+ Menu menu = mUaSwitcherMenu.getMenu();
+ mUaSwitcherMenu.getMenuInflater().inflate(R.menu.ua_switcher, menu);
menu.findItem(R.id.ua_mobile_menu_id).setChecked(!desktop);
menu.findItem(R.id.ua_desktop_menu_id).setChecked(desktop);
Tab tab = mUiController.getCurrentTab();
@@ -126,8 +129,10 @@ public class NavigationBarBase extends LinearLayout implements OnClickListener,
saveSnapshot.setVisible(tab != null && !tab.isSnapshot());
MenuItem find = menu.findItem(R.id.find_menu_id);
find.setVisible(tab != null && !tab.isSnapshot());
- popup.setOnMenuItemClickListener(this);
- popup.show();
+ mUaSwitcherMenu.setOnMenuItemClickListener(this);
+ mUaSwitcherMenu.setOnDismissListener(this);
+ mUaSwitcherShowing = true;
+ mUaSwitcherMenu.show();
}
}
@@ -335,4 +340,17 @@ public class NavigationBarBase extends LinearLayout implements OnClickListener,
public void onProgressStopped() {
}
+ @Override
+ public void onDismiss(PopupMenu menu) {
+ if (mUaSwitcherMenu == menu) {
+ mUaSwitcherShowing = false;
+ mUaSwitcherMenu = null;
+ mBaseUi.showTitleBarForDuration();
+ }
+ }
+
+ public boolean isMenuShowing() {
+ return mUaSwitcherShowing;
+ }
+
}
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index 49228db..0cb0764 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -15,14 +15,11 @@
*/
package com.android.browser;
-import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
-import android.view.ContextMenu;
import android.view.Menu;
-import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewConfiguration;
@@ -34,7 +31,7 @@ import android.widget.PopupMenu.OnDismissListener;
import com.android.browser.UrlInputView.StateListener;
public class NavigationBarPhone extends NavigationBarBase implements
- StateListener, OnDismissListener {
+ StateListener {
private ImageView mStopButton;
private ImageView mVoiceButton;
@@ -48,7 +45,7 @@ public class NavigationBarPhone extends NavigationBarBase implements
private View mMore;
private Drawable mTextfieldBgDrawable;
private PopupMenu mPopupMenu;
- private boolean mMenuShowing;
+ private boolean mOverflowMenuShowing;
private boolean mNeedsMenu;
public NavigationBarPhone(Context context) {
@@ -162,12 +159,13 @@ public class NavigationBarPhone extends NavigationBarBase implements
}
}
+ @Override
public boolean isMenuShowing() {
- return mMenuShowing;
+ return super.isMenuShowing() || mOverflowMenuShowing;
}
void showMenu(View anchor) {
- mMenuShowing = true;
+ mOverflowMenuShowing = true;
mPopupMenu = new PopupMenu(mContext, anchor);
Menu menu = mPopupMenu.getMenu();
mPopupMenu.getMenuInflater().inflate(R.menu.browser, menu);
@@ -179,7 +177,10 @@ public class NavigationBarPhone extends NavigationBarBase implements
@Override
public void onDismiss(PopupMenu menu) {
- onMenuHidden();
+ if (menu == mPopupMenu) {
+ onMenuHidden();
+ }
+ super.onDismiss(menu);
}
@Override
@@ -193,7 +194,7 @@ public class NavigationBarPhone extends NavigationBarBase implements
}
private void onMenuHidden() {
- mMenuShowing = false;
+ mOverflowMenuShowing = false;
mPopupMenu = null;
mBaseUi.showTitleBarForDuration();
}
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index bb6b63e..e453296 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -141,18 +141,6 @@ public class PhoneUi extends BaseUi {
mTitleBar.setSkipTitleBarAnimations(false);
}
- /**
- * Suggest to the UI that the title bar can be hidden. The UI will then
- * decide whether or not to hide based off a number of factors, such
- * as if the user is editing the URL bar or if the page is loading
- */
- @Override
- public void suggestHideTitleBar() {
- if (!mNavigationBar.isMenuShowing()) {
- super.suggestHideTitleBar();
- }
- }
-
// menu handling callbacks
@Override