diff options
author | John Reck <jreck@google.com> | 2011-06-14 08:45:00 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-06-14 15:56:32 -0700 |
commit | d8c7452a7d8975a2d60414c5a33842b4a743e631 (patch) | |
tree | 1247519fc0a1e55fa78062e854cf1776461af762 /src/com/android/browser/NavTabView.java | |
parent | 27d0b8858752093b8e6cffec4073429b22444af3 (diff) | |
download | packages_apps_Browser-d8c7452a7d8975a2d60414c5a33842b4a743e631.zip packages_apps_Browser-d8c7452a7d8975a2d60414c5a33842b4a743e631.tar.gz packages_apps_Browser-d8c7452a7d8975a2d60414c5a33842b4a743e631.tar.bz2 |
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
Diffstat (limited to 'src/com/android/browser/NavTabView.java')
-rw-r--r-- | src/com/android/browser/NavTabView.java | 44 |
1 files changed, 18 insertions, 26 deletions
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() { |