summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-10-13 12:47:11 -0700
committerMichael Kolb <kolby@google.com>2011-10-13 14:39:04 -0700
commit315d502edce27bb4e93e53134f1a43b8f5c45588 (patch)
treeaf9f719da63ff6457d78ab28b138b432708bd5d3 /src/com
parent82f00179fa70ecd0d9fe25f4182d5db8986c11d2 (diff)
downloadpackages_apps_Browser-315d502edce27bb4e93e53134f1a43b8f5c45588.zip
packages_apps_Browser-315d502edce27bb4e93e53134f1a43b8f5c45588.tar.gz
packages_apps_Browser-315d502edce27bb4e93e53134f1a43b8f5c45588.tar.bz2
Reduce size of menus
Bug: 5452031 Change-Id: I3cc638b981e50796293b0f61dac2d93b8e3df1a0
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/Controller.java33
-rw-r--r--src/com/android/browser/IntentHandler.java3
-rw-r--r--src/com/android/browser/NavScreen.java5
-rw-r--r--src/com/android/browser/NavigationBarPhone.java3
-rw-r--r--src/com/android/browser/NavigationBarTablet.java4
-rw-r--r--src/com/android/browser/PhoneUi.java31
-rw-r--r--src/com/android/browser/PieControlXLarge.java3
-rw-r--r--src/com/android/browser/SnapshotBar.java4
-rw-r--r--src/com/android/browser/UiController.java5
9 files changed, 56 insertions, 35 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 0fc9b8a..9710669 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -357,7 +357,7 @@ public class Controller
getCurrentWebView().setJsFlags(jsFlags);
}
if (BrowserActivity.ACTION_SHOW_BOOKMARKS.equals(intent.getAction())) {
- bookmarksOrHistoryPicker(false);
+ bookmarksOrHistoryPicker(ComboViews.Bookmarks);
}
}
@@ -474,7 +474,7 @@ public class Controller
public void handleMessage(Message msg) {
switch (msg.what) {
case OPEN_BOOKMARKS:
- bookmarksOrHistoryPicker(false);
+ bookmarksOrHistoryPicker(ComboViews.Bookmarks);
break;
case FOCUS_NODE_HREF:
{
@@ -1204,7 +1204,7 @@ public class Controller
* Otherwise, start with the bookmarks tab.
*/
@Override
- public void bookmarksOrHistoryPicker(boolean startWithHistory) {
+ public void bookmarksOrHistoryPicker(ComboViews startView) {
if (mTabControl.getCurrentWebView() == null) {
return;
}
@@ -1216,8 +1216,7 @@ public class Controller
// Disable opening in a new window if we have maxed out the windows
extras.putBoolean(BrowserBookmarksPage.EXTRA_DISABLE_WINDOW,
!mTabControl.canCreateNewTab());
- mUi.showComboView(startWithHistory
- ? ComboViews.History : ComboViews.Bookmarks, extras);
+ mUi.showComboView(startView, extras);
}
// combo view callbacks
@@ -1520,6 +1519,7 @@ public class Controller
uaSwitcher.setChecked(isDesktopUa);
menu.setGroupVisible(R.id.LIVE_MENU, isLive);
menu.setGroupVisible(R.id.SNAPSHOT_MENU, !isLive);
+ menu.setGroupVisible(R.id.COMBO_MENU, false);
mUi.updateMenuState(tab, menu);
}
@@ -1554,7 +1554,15 @@ public class Controller
break;
case R.id.bookmarks_menu_id:
- bookmarksOrHistoryPicker(false);
+ bookmarksOrHistoryPicker(ComboViews.Bookmarks);
+ break;
+
+ case R.id.history_menu_id:
+ bookmarksOrHistoryPicker(ComboViews.History);
+ break;
+
+ case R.id.snapshots_menu_id:
+ bookmarksOrHistoryPicker(ComboViews.Snapshots);
break;
case R.id.add_bookmark_menu_id:
@@ -1634,17 +1642,13 @@ public class Controller
break;
case R.id.page_info_menu_id:
- mPageDialogsHandler.showPageInfo(mTabControl.getCurrentTab(), false, null);
+ showPageInfo();
break;
case R.id.snapshot_go_live:
goLive();
return true;
- case R.id.classic_history_menu_id:
- bookmarksOrHistoryPicker(true);
- break;
-
case R.id.share_page_menu_id:
Tab currentTab = mTabControl.getCurrentTab();
if (null == currentTab) {
@@ -1713,6 +1717,11 @@ public class Controller
t.loadUrl(t.getUrl(), null);
}
+ @Override
+ public void showPageInfo() {
+ mPageDialogsHandler.showPageInfo(mTabControl.getCurrentTab(), false, null);
+ }
+
public boolean onContextItemSelected(MenuItem item) {
// Let the History and Bookmark fragments handle menus they created.
if (item.getGroupId() == R.id.CONTEXT_MENU) {
@@ -2685,7 +2694,7 @@ public class Controller
switch(keyCode) {
case KeyEvent.KEYCODE_BACK:
if (mUi.isWebShowing()) {
- bookmarksOrHistoryPicker(true);
+ bookmarksOrHistoryPicker(ComboViews.History);
return true;
}
break;
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index c76197d..e5ddb47 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -32,6 +32,7 @@ import android.speech.RecognizerResultsIntent;
import android.text.TextUtils;
import android.util.Patterns;
+import com.android.browser.UI.ComboViews;
import com.android.browser.search.SearchEngine;
import com.android.common.Search;
import com.android.common.speech.LoggingEvents;
@@ -85,7 +86,7 @@ public class IntentHandler {
return;
}
if (BrowserActivity.ACTION_SHOW_BOOKMARKS.equals(action)) {
- mController.bookmarksOrHistoryPicker(false);
+ mController.bookmarksOrHistoryPicker(ComboViews.Bookmarks);
return;
}
diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java
index 14b1e84..d5b4347 100644
--- a/src/com/android/browser/NavScreen.java
+++ b/src/com/android/browser/NavScreen.java
@@ -26,7 +26,6 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
-import android.webkit.WebView;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.ImageButton;
@@ -40,6 +39,7 @@ import android.widget.TextView;
import com.android.browser.NavTabScroller.OnLayoutListener;
import com.android.browser.NavTabScroller.OnRemoveListener;
import com.android.browser.TabControl.OnThumbnailUpdatedListener;
+import com.android.browser.UI.ComboViews;
import java.util.HashMap;
@@ -89,7 +89,6 @@ public class NavScreen extends RelativeLayout
@Override
public boolean onMenuItemClick(MenuItem item) {
- mUi.hideNavScreen(mUiController.getTabControl().getCurrentPosition(), false);
return mUiController.onOptionsItemSelected(item);
}
@@ -148,7 +147,7 @@ public class NavScreen extends RelativeLayout
@Override
public void onClick(View v) {
if (mBookmarks == v) {
- mUiController.bookmarksOrHistoryPicker(false);
+ mUiController.bookmarksOrHistoryPicker(ComboViews.Bookmarks);
} else if (mNewTab == v) {
openNewTab();
} else if (mMore == v) {
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index a1e778d..2e206fb 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -80,6 +80,7 @@ public class NavigationBarPhone extends NavigationBarBase implements
mMore = findViewById(R.id.more);
mMore.setOnClickListener(this);
mComboIcon = findViewById(R.id.iconcombo);
+ mComboIcon.setOnClickListener(this);
mTitleContainer = findViewById(R.id.title_bg);
setFocusState(false);
Resources res = getContext().getResources();
@@ -164,6 +165,8 @@ public class NavigationBarPhone extends NavigationBarBase implements
showMenu(mMore);
} else if (mClearButton == v) {
mUrlInput.setText("");
+ } else if (mComboIcon == v) {
+ mUiController.showPageInfo();
} else {
super.onClick(v);
}
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java
index be3a9ab..ef29a49 100644
--- a/src/com/android/browser/NavigationBarTablet.java
+++ b/src/com/android/browser/NavigationBarTablet.java
@@ -31,6 +31,8 @@ import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
+import com.android.browser.UI.ComboViews;
+
import java.util.List;
public class NavigationBarTablet extends NavigationBarBase {
@@ -173,7 +175,7 @@ public class NavigationBarTablet extends NavigationBarBase {
getContext().startActivity(intent);
}
} else if (mAllButton == v) {
- mUiController.bookmarksOrHistoryPicker(false);
+ mUiController.bookmarksOrHistoryPicker(ComboViews.Bookmarks);
} else if (mSearchButton == v) {
mBaseUi.editUrl(true);
} else if (mStopButton == v) {
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index b0f3d74..56b5276 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -194,34 +194,35 @@ public class PhoneUi extends BaseUi {
@Override
public void updateMenuState(Tab tab, Menu menu) {
- MenuItem bm = menu.findItem(R.id.bookmarks_menu_id);
- if (bm != null) {
- boolean isDataUrl = false;
- if (tab != null) {
- String url = tab.getUrl();
- isDataUrl = DataUri.isDataUri(url);
- }
- bm.setVisible(!showingNavScreen() && !isDataUrl);
- }
- MenuItem nt = menu.findItem(R.id.new_tab_menu_id);
- if (nt != null) {
- nt.setVisible(!showingNavScreen());
- }
MenuItem abm = menu.findItem(R.id.add_bookmark_menu_id);
if (abm != null) {
abm.setVisible((tab != null) && !tab.isSnapshot() && !showingNavScreen());
}
+ MenuItem info = menu.findItem(R.id.page_info_menu_id);
+ if (info != null) {
+ info.setVisible(false);
+ }
+ MenuItem newtab = menu.findItem(R.id.new_tab_menu_id);
+ if (newtab != null && !mUseQuickControls) {
+ newtab.setVisible(false);
+ }
+ MenuItem incognito = menu.findItem(R.id.incognito_menu_id);
+ if (incognito != null) {
+ incognito.setVisible(showingNavScreen() || mUseQuickControls);
+ }
if (showingNavScreen()) {
menu.setGroupVisible(R.id.LIVE_MENU, false);
menu.setGroupVisible(R.id.SNAPSHOT_MENU, false);
- menu.findItem(R.id.page_info_menu_id).setVisible(false);
menu.setGroupVisible(R.id.NAV_MENU, false);
+ menu.setGroupVisible(R.id.COMBO_MENU, true);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- if (showingNavScreen()) {
+ if (showingNavScreen()
+ && (item.getItemId() != R.id.history_menu_id)
+ && (item.getItemId() != R.id.snapshots_menu_id)) {
hideNavScreen(mUiController.getTabControl().getCurrentPosition(), false);
}
return false;
diff --git a/src/com/android/browser/PieControlXLarge.java b/src/com/android/browser/PieControlXLarge.java
index 0072aea..fcc8840 100644
--- a/src/com/android/browser/PieControlXLarge.java
+++ b/src/com/android/browser/PieControlXLarge.java
@@ -30,6 +30,7 @@ import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.TextView;
+import com.android.browser.UI.ComboViews;
import com.android.browser.view.PieItem;
import com.android.browser.view.PieListView;
import com.android.browser.view.PieMenu.PieView.OnLayoutListener;
@@ -148,7 +149,7 @@ public class PieControlXLarge extends PieControlBase implements OnClickListener
} else if (mUrl.getView() == v) {
mUi.editUrl(false);
} else if (mBookmarks.getView() == v) {
- mUiController.bookmarksOrHistoryPicker(false);
+ mUiController.bookmarksOrHistoryPicker(ComboViews.Bookmarks);
} else if (mNewTab.getView() == v) {
mUiController.openTabToHomePage();
mUi.editUrl(false);
diff --git a/src/com/android/browser/SnapshotBar.java b/src/com/android/browser/SnapshotBar.java
index 2fb90d2..51e1226 100644
--- a/src/com/android/browser/SnapshotBar.java
+++ b/src/com/android/browser/SnapshotBar.java
@@ -31,6 +31,8 @@ import android.widget.LinearLayout;
import android.widget.PopupMenu.OnMenuItemClickListener;
import android.widget.TextView;
+import com.android.browser.UI.ComboViews;
+
import java.text.DateFormat;
import java.util.Date;
@@ -164,7 +166,7 @@ public class SnapshotBar extends LinearLayout implements OnClickListener {
@Override
public void onClick(View v) {
if (mBookmarks == v) {
- mTitleBar.getUiController().bookmarksOrHistoryPicker(false);
+ mTitleBar.getUiController().bookmarksOrHistoryPicker(ComboViews.Bookmarks);
} else if (mTabSwitcher == v) {
((PhoneUi) mTitleBar.getUi()).toggleNavScreen();
} else if (mOverflowMenu == v) {
diff --git a/src/com/android/browser/UiController.java b/src/com/android/browser/UiController.java
index 97e99a9..9b48c46 100644
--- a/src/com/android/browser/UiController.java
+++ b/src/com/android/browser/UiController.java
@@ -22,6 +22,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
+import com.android.browser.UI.ComboViews;
import com.android.browser.UI.DropdownChangeListener;
import java.util.List;
@@ -63,7 +64,7 @@ public interface UiController {
Intent createBookmarkCurrentPageIntent(boolean canBeAnEdit);
- void bookmarksOrHistoryPicker(boolean openHistory);
+ void bookmarksOrHistoryPicker(ComboViews startView);
void startVoiceSearch();
@@ -103,4 +104,6 @@ public interface UiController {
Activity getActivity();
+ void showPageInfo();
+
}