Bug 1055601 - Don't flicker about:home URL when new tab is created (r=mcomella)

This commit is contained in:
Lucas Rocha 2014-10-30 10:26:23 +00:00
Родитель 3f26f678fc
Коммит d73e85faba
4 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -388,6 +388,9 @@ size. -->
text underneath empty thumbnails in the Top Sites page on about:home. --> text underneath empty thumbnails in the Top Sites page on about:home. -->
<!ENTITY home_top_sites_add "Add a site"> <!ENTITY home_top_sites_add "Add a site">
<!-- Localization note (home_title): This string should be kept in sync
with the page title defined in aboutHome.dtd -->
<!ENTITY home_title "&brandShortName; Home">
<!ENTITY home_history_title "History"> <!ENTITY home_history_title "History">
<!ENTITY home_clear_history_button "Clear browsing history"> <!ENTITY home_clear_history_button "Clear browsing history">
<!ENTITY home_clear_history_confirm "Are you sure you want to clear your history?"> <!ENTITY home_clear_history_confirm "Are you sure you want to clear your history?">

Просмотреть файл

@ -343,6 +343,7 @@
<string name="button_yes">&button_yes;</string> <string name="button_yes">&button_yes;</string>
<string name="button_no">&button_no;</string> <string name="button_no">&button_no;</string>
<string name="home_title">&home_title;</string>
<string name="home_top_sites_title">&home_top_sites_title;</string> <string name="home_top_sites_title">&home_top_sites_title;</string>
<string name="home_top_sites_add">&home_top_sites_add;</string> <string name="home_top_sites_add">&home_top_sites_add;</string>
<string name="home_history_title">&home_history_title;</string> <string name="home_history_title">&home_history_title;</string>

Просмотреть файл

@ -5,6 +5,7 @@
package org.mozilla.gecko.tabs; package org.mozilla.gecko.tabs;
import org.mozilla.gecko.AboutPages;
import org.mozilla.gecko.R; import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab; import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs; import org.mozilla.gecko.Tabs;
@ -20,6 +21,7 @@ import android.graphics.Path;
import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode; import android.graphics.PorterDuffXfermode;
import android.graphics.Region; import android.graphics.Region;
import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -199,11 +201,25 @@ public class TabStripItemView extends ThemedLinearLayout
} }
id = tab.getId(); id = tab.getId();
updateTitle(tab);
updateFavicon(tab.getFavicon()); updateFavicon(tab.getFavicon());
titleView.setText(tab.getDisplayTitle());
setPrivateMode(tab.isPrivate()); setPrivateMode(tab.isPrivate());
} }
private void updateTitle(Tab tab) {
final String title;
// Avoid flickering the about:home URL on every load given how often
// this page is used in the UI.
if (AboutPages.isAboutHome(tab.getURL())) {
titleView.setText(R.string.home_title);
} else {
titleView.setText(tab.getDisplayTitle());
}
}
private void updateFavicon(final Bitmap favicon) { private void updateFavicon(final Bitmap favicon) {
if (favicon == null) { if (favicon == null) {
lastFavicon = null; lastFavicon = null;

Просмотреть файл

@ -2,4 +2,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!-- This string should be kept in sync with the home_title string
in android_strings.dtd -->
<!ENTITY abouthome.title "&brandShortName; Home"> <!ENTITY abouthome.title "&brandShortName; Home">