Bug 868342 - (Part 2) Get rid of displayTitle variable. r=wesj
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -878,54 +878,52 @@ public class BrowserToolbar implements T
visible &= !(url == null || (url.startsWith("about:") &&
!url.equals("about:blank")));
if ((mShadow.getVisibility() == View.VISIBLE) != visible) {
mShadow.setVisibility(visible ? View.VISIBLE : View.GONE);
}
}
- private void setTitle(String title) {
+ private void setTitle(CharSequence title) {
Tab tab = Tabs.getInstance().getSelectedTab();
- CharSequence displayTitle = title;
if (tab != null) {
// Keep the title unchanged if the tab is entering reader mode
if (tab.isEnteringReaderMode()) {
return;
}
// Setting a null title will ensure we just see the "Enter Search or Address"
// placeholder text. Because "about:home" and "about:privatebrowsing" don't
// have titles, their display titles will always match their URLs.
if ("about:home".equals(title) || "about:privatebrowsing".equals(title)) {
- displayTitle = null;
+ title = null;
}
- if (mShowUrl && displayTitle != null) {
+ if (mShowUrl && title != null) {
title = StringUtils.stripScheme(tab.getURL());
- title = StringUtils.stripCommonSubdomains(title);
- displayTitle = title;
+ title = StringUtils.stripCommonSubdomains(title.toString());
// highlight the domain name if we find one
String baseDomain = tab.getBaseDomain();
if (!TextUtils.isEmpty(baseDomain)) {
SpannableStringBuilder builder = new SpannableStringBuilder(title);
- int index = title.indexOf(baseDomain);
+ int index = title.toString().indexOf(baseDomain);
if (index > -1) {
builder.setSpan(mUrlColor, 0, title.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
builder.setSpan(tab.isPrivate() ? mPrivateDomainColor : mDomainColor, index, index+baseDomain.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
- displayTitle = builder;
+ title = builder;
}
}
}
}
- mTitle.setText(displayTitle);
+ mTitle.setText(title);
mLayout.setContentDescription(title != null ? title : mTitle.getHint());
}
private void setFavicon(Bitmap image) {
if (Tabs.getInstance().getSelectedTab().getState() == Tab.STATE_LOADING)
return;
if (image != null) {