зеркало из https://github.com/mozilla/gecko-dev.git
Bug 868342 - (Part 2) Get rid of displayTitle variable. r=wesj
This commit is contained in:
Родитель
f4592d0eed
Коммит
236a49c629
|
@ -883,9 +883,8 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -897,30 +896,29 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
|
|||
// 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());
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче