Bug 1236431 - ToolbarDisplayLayout: Only show base domain. r=mcomella
MozReview-Commit-ID: GwH3XDVim4F
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
@@ -115,38 +115,30 @@ public class ToolbarDisplayLayout extend
private static final int LEVEL_DEFAULT_GLOBE = 0;
// Levels for displaying Mixed Content state icons.
private static final int LEVEL_WARNING_MINOR = 3;
private static final int LEVEL_LOCK_DISABLED = 4;
// Levels for displaying Tracking Protection state icons.
private static final int LEVEL_SHIELD_ENABLED = 5;
private static final int LEVEL_SHIELD_DISABLED = 6;
- private final ForegroundColorSpan mUrlColor;
private final ForegroundColorSpan mBlockedColor;
- private final ForegroundColorSpan mDomainColor;
- private final ForegroundColorSpan mPrivateDomainColor;
public ToolbarDisplayLayout(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(HORIZONTAL);
mActivity = (BrowserApp) context;
LayoutInflater.from(context).inflate(R.layout.toolbar_display_layout, this);
mTitle = (ThemedTextView) findViewById(R.id.url_bar_title);
mTitlePadding = mTitle.getPaddingRight();
- final Resources res = getResources();
-
- mUrlColor = new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_urltext));
mBlockedColor = new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_blockedtext));
- mDomainColor = new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_domaintext));
- mPrivateDomainColor = new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_domaintext_private));
mSiteSecurity = (ImageButton) findViewById(R.id.site_security);
mSiteIdentityPopup = new SiteIdentityPopup(mActivity);
mSiteIdentityPopup.setAnchor(this);
mSiteIdentityPopup.setOnVisibilityChangeListener(mActivity);
mStop = (ImageButton) findViewById(R.id.stop);
@@ -252,39 +244,30 @@ public class ToolbarDisplayLayout extend
final SpannableStringBuilder builder = new SpannableStringBuilder(title);
builder.setSpan(mBlockedColor, 0, title.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
setTitle(builder);
return;
}
+ final String baseDomain = tab.getBaseDomain();
+
String strippedURL = stripAboutReaderURL(url);
if (mPrefs.shouldTrimUrls()) {
strippedURL = StringUtils.stripCommonSubdomains(StringUtils.stripScheme(strippedURL));
}
- CharSequence title = strippedURL;
-
- final String baseDomain = tab.getBaseDomain();
if (!TextUtils.isEmpty(baseDomain)) {
- final SpannableStringBuilder builder = new SpannableStringBuilder(title);
-
- 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);
-
- title = builder;
- }
+ setTitle(baseDomain);
+ setContentDescription(strippedURL);
+ } else {
+ setTitle(strippedURL);
}
-
- setTitle(title);
}
private String stripAboutReaderURL(final String url) {
if (!AboutPages.isAboutReader(url)) {
return url;
}
return ReaderModeUtils.getUrlFromAboutReader(url);
--- a/mobile/android/base/resources/values/colors.xml
+++ b/mobile/android/base/resources/values/colors.xml
@@ -105,19 +105,16 @@
<color name="url_bar_text_highlight_pb">#FFD06BFF</color>
<color name="tab_row_pressed">#4D000000</color>
<color name="textbox_background">#FFF</color>
<color name="textbox_background_disabled">#DDD</color>
<color name="textbox_stroke">#000</color>
<color name="textbox_stroke_disabled">#666</color>
- <color name="url_bar_urltext">#A6A6A6</color>
- <color name="url_bar_domaintext">#000</color>
- <color name="url_bar_domaintext_private">#FFF</color>
<color name="url_bar_blockedtext">#b14646</color>
<color name="url_bar_shadow">#12000000</color>
<color name="home_button_bar_bg">#FFF5F7F9</color>
<color name="panel_image_item_background">#D1D9E1</color>
<color name="panel_icon_item_title_background">#32000000</color>
<color name="panel_tab_text_normal">#FFBFBFBF</color>