summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-08-01 11:55:38 -0700
committerMichael Kolb <kolby@google.com>2011-08-01 12:02:10 -0700
commit7bdee0b303d8969aace4d3e43be5bb9f16e276bf (patch)
tree2795d07bf27ec94c2802c660ed9ff3be678f9b17 /src
parent3bb854b7830f82923af016d7b6731496c5e70c74 (diff)
downloadpackages_apps_Browser-7bdee0b303d8969aace4d3e43be5bb9f16e276bf.zip
packages_apps_Browser-7bdee0b303d8969aace4d3e43be5bb9f16e276bf.tar.gz
packages_apps_Browser-7bdee0b303d8969aace4d3e43be5bb9f16e276bf.tar.bz2
fix action bar and menu
Bug: 5077207 Bug: 5097486 cleaned up action bar items dynamically change menu items based on context bookmarks option added to nav bar menu new tab added to navbar menu find/addbookmark only on real pages removed new incognito tab from tab switcher action bar Change-Id: I973f20a13bb7d9900041f717aff012e7a2c735b8
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/BaseUi.java4
-rw-r--r--src/com/android/browser/Controller.java1
-rw-r--r--src/com/android/browser/NavScreen.java6
-rw-r--r--src/com/android/browser/PhoneUi.java23
-rw-r--r--src/com/android/browser/UI.java2
5 files changed, 29 insertions, 7 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 091126c..372f2a9 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -646,6 +646,10 @@ public abstract class BaseUi implements UI, OnTouchListener {
}
@Override
+ public void updateMenuState(Tab tab, Menu menu) {
+ }
+
+ @Override
public void onOptionsMenuOpened() {
}
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 457c2e0..f20968b 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1520,6 +1520,7 @@ public class Controller
MenuItem saveSnapshot = menu.findItem(R.id.save_snapshot_menu_id);
saveSnapshot.setVisible(tab != null && !tab.isSnapshot());
+ mUi.updateMenuState(tab, menu);
}
public boolean onOptionsItemSelected(MenuItem item) {
diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java
index 9c12ccf..face39e 100644
--- a/src/com/android/browser/NavScreen.java
+++ b/src/com/android/browser/NavScreen.java
@@ -52,7 +52,6 @@ public class NavScreen extends RelativeLayout
ImageButton mBookmarks;
ImageButton mMore;
ImageButton mNewTab;
- ImageButton mNewIncognito;
FrameLayout mHolder;
TextView mTitle;
@@ -115,11 +114,9 @@ public class NavScreen extends RelativeLayout
R.string.accessibility_transition_navscreen));
mBookmarks = (ImageButton) findViewById(R.id.bookmarks);
mNewTab = (ImageButton) findViewById(R.id.newtab);
- mNewIncognito = (ImageButton) findViewById(R.id.newincognito);
mMore = (ImageButton) findViewById(R.id.more);
mBookmarks.setOnClickListener(this);
mNewTab.setOnClickListener(this);
- mNewIncognito.setOnClickListener(this);
mMore.setOnClickListener(this);
mScroller = (NavTabGallery) findViewById(R.id.scroller);
mAdapter = new TabAdapter(mContext, mUiController.getTabControl());
@@ -160,9 +157,6 @@ public class NavScreen extends RelativeLayout
openNewTab();
} else if (mMore == v) {
showMenu();
- } else if (mNewIncognito == v) {
- mUi.hideNavScreen(true);
- mUiController.openIncognitoTab();
} else if (mTitle == v) {
mUi.getTitleBar().setSkipTitleBarAnimations(true);
close(false);
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index 853d935..901f5bd 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -164,11 +164,32 @@ public class PhoneUi extends BaseUi {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
- menu.setGroupVisible(R.id.NAV_MENU, (mNavScreen == null));
+ updateMenuState(mActiveTab, menu);
return true;
}
@Override
+ public void updateMenuState(Tab tab, Menu menu) {
+ menu.setGroupVisible(R.id.NAV_MENU, (mNavScreen == null));
+ MenuItem bm = menu.findItem(R.id.bookmarks_menu_id);
+ if (bm != null) {
+ bm.setVisible(mNavScreen == null);
+ }
+ MenuItem nt = menu.findItem(R.id.new_tab_menu_id);
+ if (nt != null) {
+ nt.setVisible(mNavScreen == null);
+ }
+ MenuItem find = menu.findItem(R.id.find_menu_id);
+ if (find != null) {
+ find.setVisible(((tab != null) && !tab.isSnapshot()));
+ }
+ MenuItem abm = menu.findItem(R.id.add_bookmark_menu_id);
+ if (abm != null) {
+ abm.setVisible((tab != null) && !tab.isSnapshot());
+ }
+ }
+
+ @Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mNavScreen != null) {
hideNavScreen(false);
diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java
index 2984d5c..bc4c0cf 100644
--- a/src/com/android/browser/UI.java
+++ b/src/com/android/browser/UI.java
@@ -99,6 +99,8 @@ public interface UI {
public boolean onPrepareOptionsMenu(Menu menu);
+ public void updateMenuState(Tab tab, Menu menu);
+
public void onOptionsMenuOpened();
public void onExtendedMenuOpened();