summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/NavigationBarPhone.java
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-07-18 14:50:21 -0700
committerMichael Kolb <kolby@google.com>2011-07-18 14:58:37 -0700
commit8441d4bdc99f8e4a84d8292c7c2a6cdf4e562fff (patch)
treee66c8610e1a5248f3a7281d416db45a35fc41dca /src/com/android/browser/NavigationBarPhone.java
parentadb0e605def2c4011735cacd46835ca1e38e2eb3 (diff)
downloadpackages_apps_Browser-8441d4bdc99f8e4a84d8292c7c2a6cdf4e562fff.zip
packages_apps_Browser-8441d4bdc99f8e4a84d8292c7c2a6cdf4e562fff.tar.gz
packages_apps_Browser-8441d4bdc99f8e4a84d8292c7c2a6cdf4e562fff.tar.bz2
show menu on phone with menu key
Bug: 5017628 show the menu anchored to the tab switcher button Change-Id: I99baa1978d4c0a99b0fe17fee198ddd5b7db1b76
Diffstat (limited to 'src/com/android/browser/NavigationBarPhone.java')
-rw-r--r--src/com/android/browser/NavigationBarPhone.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index 684f986..2da0424 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -45,7 +45,7 @@ public class NavigationBarPhone extends NavigationBarBase implements
private View mTitleContainer;
private View mMore;
private Drawable mTextfieldBgDrawable;
- private boolean mMenuShowing;
+ private PopupMenu mPopupMenu;
private boolean mNeedsMenu;
public NavigationBarPhone(Context context) {
@@ -163,18 +163,28 @@ public class NavigationBarPhone extends NavigationBarBase implements
}
public boolean isMenuShowing() {
- return mMenuShowing;
+ return (mPopupMenu != null);
+ }
+
+ void showMenu() {
+ // called from menu key, use tab switcher as anchor
+ showMenu(mTabSwitcher);
}
void showMenu(View anchor) {
- mMenuShowing = true;
- PopupMenu popup = new PopupMenu(mContext, anchor);
- Menu menu = popup.getMenu();
- popup.getMenuInflater().inflate(R.menu.browser, menu);
+ mPopupMenu = new PopupMenu(mContext, anchor);
+ Menu menu = mPopupMenu.getMenu();
+ mPopupMenu.getMenuInflater().inflate(R.menu.browser, menu);
mUiController.updateMenuState(mBaseUi.getActiveTab(), menu);
- popup.setOnMenuItemClickListener(this);
- popup.setOnDismissListener(this);
- popup.show();
+ mPopupMenu.setOnMenuItemClickListener(this);
+ mPopupMenu.setOnDismissListener(this);
+ mPopupMenu.show();
+ }
+
+ void dismissMenu() {
+ if (mPopupMenu != null) {
+ mPopupMenu.dismiss();
+ }
}
@Override
@@ -193,7 +203,7 @@ public class NavigationBarPhone extends NavigationBarBase implements
}
private void onMenuHidden() {
- mMenuShowing = false;
+ mPopupMenu = null;
mBaseUi.showTitleBarForDuration();
}