Fixed favicon bug
Bug: 2955542
Fixed a bug where navigating from a site with a favicon to a site
without a favicon displayed the old site's favicon instead of a
generic icon.
Change-Id: I830706166283d2ae425f4a9680cdbb4ef31b1de9
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index b2c687d..9d58675 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -68,6 +68,8 @@
private boolean mTitleVisible;
private boolean mShowUrlMode;
+ private Drawable mGenericFavicon;
+
public TabBar(BrowserActivity context, TabControl tabcontrol, TitleBarXLarge titlebar) {
super(context);
Resources res = context.getResources();
@@ -86,6 +88,7 @@
mTabs = (TabScrollView) findViewById(R.id.tabs);
mNewTab = (ImageButton) findViewById(R.id.newtab);
mNewTab.setOnClickListener(this);
+ mGenericFavicon = res.getDrawable(R.drawable.app_web_browser_sm);
// TODO: Change enabled states based on whether you can go
// back/forward. Probably should be done inside onPageStarted.
@@ -365,7 +368,7 @@
array[0] = new PaintDrawable(Color.BLACK);
array[1] = new PaintDrawable(Color.WHITE);
if (icon == null) {
-// array[2] = mGenericFavicon;
+ array[2] = mGenericFavicon;
} else {
array[2] = new BitmapDrawable(icon);
}
@@ -441,7 +444,11 @@
}
@Override
- public void onPageStarted(Tab tab) {
+ public void onPageStarted(Tab tab, Bitmap favicon) {
+ TabViewData tvd = mTabMap.get(tab);
+ if (tvd != null) {
+ tvd.setFavicon(favicon);
+ }
}