From d8c7452a7d8975a2d60414c5a33842b4a743e631 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 14 Jun 2011 08:45:00 -0700 Subject: Persistent frozen tabs On Tablet WebViews for frozen tabs are created on demand On Phone WebViews for frozen tabs are tied to the lifecycle of the SnapshotTab for nav screen reasons (for now) Change-Id: I80cb48e748c4dd4b8564426d5e05b92f3eea7a36 --- src/com/android/browser/NavTabView.java | 44 ++++++++++++++------------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'src/com/android/browser/NavTabView.java') diff --git a/src/com/android/browser/NavTabView.java b/src/com/android/browser/NavTabView.java index f170b0f..daa5013 100644 --- a/src/com/android/browser/NavTabView.java +++ b/src/com/android/browser/NavTabView.java @@ -49,7 +49,6 @@ public class NavTabView extends LinearLayout { private Drawable mUrlBg; private float mMediumTextSize; private float mSmallTextSize; - private boolean mPaused; public NavTabView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); @@ -85,20 +84,6 @@ public class NavTabView extends LinearLayout { setState(false); } - protected void pause() { - mPaused = true; - mWebView.onPause(); - } - - protected void resume() { - mPaused = false; - mWebView.onResume(); - } - - protected boolean isPaused() { - return mPaused; - } - protected boolean isRefresh(View v) { return v == mRefresh; } @@ -128,10 +113,8 @@ public class NavTabView extends LinearLayout { private void setState(boolean highlighted) { if (highlighted) { setAlpha(1.0f); - mRefresh.setVisibility(View.VISIBLE); mFavicon.setVisibility(View.VISIBLE); - mForward.setVisibility(mWebView.canGoForward() - ? View.VISIBLE : View.GONE); + setupButtons(); mTitleBar.setBackgroundDrawable(mTitleBg); mClose.setVisibility(View.VISIBLE); mTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMediumTextSize); @@ -166,18 +149,27 @@ public class NavTabView extends LinearLayout { protected void setWebView(PhoneUi ui, Tab tab) { mTab = tab; + mFavicon.setImageDrawable(ui.getFaviconDrawable(tab.getFavicon())); + setTitle(); BrowserWebView web = (BrowserWebView) tab.getWebView(); - if (web == null) return; - mWebView = web; - removeFromParent(mWebView); - mProxy = new WebProxyView(mContext, mWebView); - mContainer.addView(mProxy, 0); - if (mWebView != null) { + if (web != null) { + mWebView = web; + removeFromParent(mWebView); + mProxy = new WebProxyView(mContext, mWebView); + mContainer.addView(mProxy, 0); + } + setupButtons(); + } + + void setupButtons() { + if (mTab.isSnapshot()) { + mForward.setVisibility(View.GONE); + mRefresh.setVisibility(View.GONE); + } else if (mWebView != null) { mForward.setVisibility(mWebView.canGoForward() ? View.VISIBLE : View.GONE); + mRefresh.setVisibility(View.VISIBLE); } - mFavicon.setImageDrawable(ui.getFaviconDrawable(tab.getFavicon())); - setTitle(); } protected void hideTitle() { -- cgit v1.1