diff options
-rw-r--r-- | res/layout/nav_tab_view.xml | 5 | ||||
-rw-r--r-- | src/com/android/browser/NavTabView.java | 16 | ||||
-rw-r--r-- | src/com/android/browser/Tab.java | 14 |
3 files changed, 26 insertions, 9 deletions
diff --git a/res/layout/nav_tab_view.xml b/res/layout/nav_tab_view.xml index 31df29b..cdfcda7 100644 --- a/res/layout/nav_tab_view.xml +++ b/res/layout/nav_tab_view.xml @@ -28,7 +28,7 @@ android:layout_width="match_parent" android:layout_height="48dip" android:layout_gravity="center_horizontal" - android:paddingLeft="16dip" > + android:paddingLeft="8dip" > <TextView android:id="@+id/title" android:layout_width="0dip" @@ -39,7 +39,8 @@ android:ellipsize="end" android:lines="1" android:textAppearance="?android:attr/textAppearanceSmall" - android:scrollHorizontally="true" /> + android:scrollHorizontally="true" + android:drawablePadding="8dip" /> <ImageView android:id="@+id/closetab" android:src="@drawable/ic_stop_holo_dark" 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; } /** |