diff options
author | John Reck <jreck@google.com> | 2011-08-16 15:11:56 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-16 15:11:56 -0700 |
commit | b157656253f19b450cc6f77801791568b1d9f765 (patch) | |
tree | 8e30f13fce61e6ef5d545bec9c1c00cafd6a7ff1 /src/com/android/browser | |
parent | 70f536dc1564fe237b42ddc386d6214cbf1374d7 (diff) | |
parent | 502a353bb815bee8bec6a60f3b741dc62e4729cd (diff) | |
download | packages_apps_Browser-b157656253f19b450cc6f77801791568b1d9f765.zip packages_apps_Browser-b157656253f19b450cc6f77801791568b1d9f765.tar.gz packages_apps_Browser-b157656253f19b450cc6f77801791568b1d9f765.tar.bz2 |
Merge "Add incognito and snapshot icons to tab switcher"
Diffstat (limited to 'src/com/android/browser')
-rw-r--r-- | src/com/android/browser/NavTabView.java | 16 | ||||
-rw-r--r-- | src/com/android/browser/Tab.java | 14 |
2 files changed, 23 insertions, 7 deletions
diff --git a/src/com/android/browser/NavTabView.java b/src/com/android/browser/NavTabView.java index 07ac164..4eec702 100644 --- a/src/com/android/browser/NavTabView.java +++ b/src/com/android/browser/NavTabView.java @@ -90,6 +90,22 @@ public class NavTabView extends LinearLayout { } mTitle.setText(txt); } + if (mTab.isSnapshot()) { + setTitleIcon(R.drawable.ic_history_holo_dark); + } else if (mTab.isPrivateBrowsingEnabled()) { + setTitleIcon(R.drawable.ic_incognito_holo_dark); + } else { + setTitleIcon(0); + } + } + + private void setTitleIcon(int id) { + if (id == 0) { + mTitle.setPadding(mTitle.getCompoundDrawablePadding(), 0, 0, 0); + } else { + mTitle.setPadding(0, 0, 0, 0); + } + mTitle.setCompoundDrawablesWithIntrinsicBounds(id, 0, 0, 0); } protected boolean isHighlighted() { diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index c6808e0..abc2467 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -191,10 +191,12 @@ class Tab implements PictureListener { String mTitle; LockIcon mLockIcon; Bitmap mFavicon; - Boolean mIsBookmarkedSite = false; + boolean mIsBookmarkedSite = false; + boolean mIncognito = false; PageState(Context c, boolean incognito) { - if (incognito) { + mIncognito = incognito; + if (mIncognito) { mOriginalUrl = mUrl = "browser:incognito"; mTitle = c.getString(R.string.new_incognito_tab); } else { @@ -206,6 +208,7 @@ class Tab implements PictureListener { } PageState(Context c, boolean incognito, String url, Bitmap favicon) { + mIncognito = incognito; mOriginalUrl = mUrl = url; mTitle = null; if (URLUtil.isHttpsUrl(url)) { @@ -913,6 +916,7 @@ class Tab implements PictureListener { // but before a provisional load occurred mCurrentState.mLockIcon = LockIcon.LOCK_ICON_UNSECURE; } + mCurrentState.mIncognito = view.isPrivateBrowsingEnabled(); } // Called by DeviceAccountLogin when the Tab needs to have the auto-login UI @@ -1746,11 +1750,7 @@ class Tab implements PictureListener { * @return True if private browsing is enabled. */ boolean isPrivateBrowsingEnabled() { - WebView webView = getWebView(); - if (webView == null) { - return false; - } - return webView.isPrivateBrowsingEnabled(); + return mCurrentState.mIncognito; } /** |