diff options
author | John Reck <jreck@google.com> | 2011-08-19 13:26:43 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-08-19 13:26:43 -0700 |
commit | 42229bcdea8a1623d9ac3fce099793a3767fb14d (patch) | |
tree | 3069825c505174e5b67d4be65bd5714db75f27f3 /src/com/android/browser/NavigationBarBase.java | |
parent | 0d7c69e9621a860f467a3e3171ee4962ad793df9 (diff) | |
download | packages_apps_Browser-42229bcdea8a1623d9ac3fce099793a3767fb14d.zip packages_apps_Browser-42229bcdea8a1623d9ac3fce099793a3767fb14d.tar.gz packages_apps_Browser-42229bcdea8a1623d9ac3fce099793a3767fb14d.tar.bz2 |
YAMR - Yet Another Menu Reorg
Bug: 5186166
Change-Id: Icd459c8f9cd557659a5402431a843a856fb1b134
Diffstat (limited to 'src/com/android/browser/NavigationBarBase.java')
-rw-r--r-- | src/com/android/browser/NavigationBarBase.java | 77 |
1 files changed, 4 insertions, 73 deletions
diff --git a/src/com/android/browser/NavigationBarBase.java b/src/com/android/browser/NavigationBarBase.java index ab79b37..bfdd9a0 100644 --- a/src/com/android/browser/NavigationBarBase.java +++ b/src/com/android/browser/NavigationBarBase.java @@ -24,17 +24,11 @@ import android.os.Bundle; import android.speech.RecognizerResultsIntent; import android.util.AttributeSet; import android.view.KeyEvent; -import android.view.Menu; -import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; -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; import com.android.browser.UrlInputView.UrlInputListener; @@ -42,9 +36,9 @@ import com.android.browser.autocomplete.SuggestedTextController.TextChangeWatche import java.util.List; -public class NavigationBarBase extends LinearLayout implements OnClickListener, - OnMenuItemClickListener, UrlInputListener, OnFocusChangeListener, - TextChangeWatcher, OnDismissListener { +public class NavigationBarBase extends LinearLayout implements + OnClickListener, UrlInputListener, OnFocusChangeListener, + TextChangeWatcher { protected BaseUi mBaseUi; protected TitleBar mTitleBar; @@ -54,9 +48,6 @@ 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); @@ -104,59 +95,8 @@ public class NavigationBarBase extends LinearLayout implements OnClickListener, mFavicon.setImageDrawable(mBaseUi.getFaviconDrawable(icon)); } - public void setUaSwitcher(View v) { - if (mUaSwitcher != null) { - mUaSwitcher.setOnClickListener(null); - } - mUaSwitcher = v; - mUaSwitcher.setOnClickListener(this); - } - @Override public void onClick(View v) { - if (mUaSwitcher == v) { - BrowserSettings settings = BrowserSettings.getInstance(); - WebView web = mTitleBar.getCurrentWebView(); - if (web == null) return; - boolean desktop = settings.hasDesktopUseragent(web); - 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(); - MenuItem saveSnapshot = menu.findItem(R.id.save_snapshot_menu_id); - saveSnapshot.setVisible(tab != null && !tab.isSnapshot()); - MenuItem find = menu.findItem(R.id.find_menu_id); - find.setVisible(tab != null && !tab.isSnapshot()); - mUaSwitcherMenu.setOnMenuItemClickListener(this); - mUaSwitcherMenu.setOnDismissListener(this); - mUaSwitcherShowing = true; - mUaSwitcherMenu.show(); - } - } - - @Override - public boolean onMenuItemClick(MenuItem item) { - BrowserSettings settings = BrowserSettings.getInstance(); - WebView web = mTitleBar.getCurrentWebView(); - if (web == null) return false; - boolean desktop = settings.hasDesktopUseragent(web); - switch (item.getItemId()) { - case R.id.ua_mobile_menu_id: - if (desktop) { - settings.toggleDesktopUseragent(web); - web.loadUrl(web.getOriginalUrl()); - } - return true; - case R.id.ua_desktop_menu_id: - if (!desktop) { - settings.toggleDesktopUseragent(web); - web.loadUrl(web.getOriginalUrl()); - } - return true; - } - return mUiController.onOptionsItemSelected(item); } @Override @@ -340,17 +280,8 @@ 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; + return false; } public void onTabDataChanged(Tab tab) { |