Bug 1071878 - Put an empty rectangle for websites without favicons on new tablet. r=lucasr

This commit is contained in:
Michael Comella committed 2014-09-24 16:38:33 -07:00
1 parent b08f31ede3
commit 1372075297
6 files changed
+13 -4

No files matched your search

+12 -3
View File
@@ -8,6 +8,7 @@ package org.mozilla.gecko.favicons;
import org.mozilla.gecko.AboutPages;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.NewTabletUI;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
@@ -393,15 +394,23 @@ public class Favicons {
return;
}
final boolean isNewTabletEnabled = NewTabletUI.isEnabled(context);
final Resources res = context.getResources();
// Decode the default Favicon ready for use.
defaultFavicon = BitmapFactory.decodeResource(res, R.drawable.favicon);
// Decode the default Favicon ready for use. We'd preferably override the drawable for
// different screen sizes, but since we need phone's default favicon on tablet (in
// ToolbarDisplayLayout), we can't.
final int defaultFaviconDrawableID =
isNewTabletEnabled ? R.drawable.new_tablet_default_favicon : R.drawable.favicon;
defaultFavicon = BitmapFactory.decodeResource(res, defaultFaviconDrawableID);
if (defaultFavicon == null) {
throw new IllegalStateException("Null default favicon was returned from the resources system!");
}
defaultFaviconSize = res.getDimensionPixelSize(R.dimen.favicon_bg);
// TODO: Remove this branch when old tablet is removed.
final int defaultFaviconSizeDimenID =
isNewTabletEnabled ? R.dimen.tab_strip_favicon_size : R.dimen.favicon_bg;
defaultFaviconSize = res.getDimensionPixelSize(defaultFaviconSizeDimenID);
// Screen-density-adjusted upper limit on favicon size. Favicons larger than this are
// downscaled to this size or discarded.
File renamed without changes.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 242 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 148 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 282 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 470 B

After

Width:  |  Height:  |  Size: 470 B

@@ -205,7 +205,7 @@ public class TabStripItemView extends ThemedLinearLayout
private void updateFavicon(final Bitmap favicon) {
if (favicon == null) {
lastFavicon = null;
faviconView.setImageResource(R.drawable.favicon_none);
faviconView.setImageResource(R.drawable.new_tablet_default_favicon);
return;
} else if (favicon == lastFavicon) {
return;