Bug 1106935 - Remove new tablet branch in selecting default toolbar favicons. r=mhaigh

As a cleanup, this required the move of favicon -> favicon_globe and the
creation of new resources toolbar_favicon_default, which is aliased to
favicon_globe on phones.
This commit is contained in:
Michael Comella 2015-02-03 18:18:21 -08:00
parent b2f9f4203e
commit 71c694876b
16 changed files with 13 additions and 17 deletions

View File

@ -450,15 +450,9 @@ public class Favicons {
return;
}
final boolean isNewTabletEnabled = NewTabletUI.isEnabled(context);
final Resources res = context.getResources();
// 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);
defaultFavicon = BitmapFactory.decodeResource(res, R.drawable.toolbar_favicon_default);
if (defaultFavicon == null) {
throw new IllegalStateException("Null default favicon was returned from the resources system!");
}

View File

@ -35,6 +35,8 @@ public class TopSitesGridItemView extends RelativeLayout {
private static final ScaleType SCALE_TYPE_THUMBNAIL = ScaleType.CENTER_CROP;
private static final ScaleType SCALE_TYPE_URL = ScaleType.CENTER_INSIDE;
private static final int THUMBNAIL_DEFAULT_FAVICON_ID = R.drawable.favicon_globe;
// Child views.
private final TextView mTitleView;
private final TopSitesThumbnailView mThumbnailView;
@ -216,7 +218,7 @@ public class TopSitesGridItemView extends RelativeLayout {
public void displayThumbnail(Bitmap thumbnail) {
if (thumbnail == null) {
// Show a favicon based view instead.
displayThumbnail(R.drawable.favicon);
displayThumbnail(THUMBNAIL_DEFAULT_FAVICON_ID);
return;
}
mThumbnailSet = true;
@ -242,7 +244,7 @@ public class TopSitesGridItemView extends RelativeLayout {
ImageLoader.with(getContext())
.load(imageUrl)
.noFade()
.error(R.drawable.favicon)
.error(THUMBNAIL_DEFAULT_FAVICON_ID)
.into(mThumbnailView);
}
@ -270,7 +272,7 @@ public class TopSitesGridItemView extends RelativeLayout {
if (favicon == null) {
// Should show default favicon.
displayThumbnail(R.drawable.favicon);
displayThumbnail(THUMBNAIL_DEFAULT_FAVICON_ID);
return;
}

View File

@ -659,7 +659,7 @@ public class TopSitesPanel extends HomeFragment {
}
// Otherwise, do this until the async lookup returns.
view.displayThumbnail(R.drawable.favicon);
view.displayThumbnail(R.drawable.favicon_globe);
// Give each side enough information to shake hands later.
listener.setLoadId(loadId);

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -7,6 +7,6 @@
lock icons so we offset it using this drawable to compensate. -->
<inset
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/favicon"
android:drawable="@drawable/favicon_globe"
android:insetTop="@dimen/new_tablet_site_security_unknown_inset_top"
android:insetBottom="@dimen/new_tablet_site_security_unknown_inset_bottom"/>

View File

Before

Width:  |  Height:  |  Size: 950 B

After

Width:  |  Height:  |  Size: 950 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -4,4 +4,4 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@null"/>
android:src="@drawable/favicon_globe" />

View File

@ -12,7 +12,7 @@
android:layout_width="@dimen/favicon_bg"
android:layout_height="@dimen/favicon_bg"
android:layout_margin="16dp"
tools:background="@drawable/favicon"/>
tools:background="@drawable/favicon_globe"/>
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

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

View File

@ -409,7 +409,7 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout
image = Bitmap.createScaledBitmap(image, mFaviconSize, mFaviconSize, false);
mFavicon.setImageBitmap(image);
} else {
mFavicon.setImageResource(R.drawable.favicon);
mFavicon.setImageResource(R.drawable.favicon_globe);
}
}

View File

@ -214,7 +214,7 @@ public class FaviconView extends ImageView {
}
public void showDefaultFavicon() {
setImageResource(R.drawable.favicon);
setImageResource(R.drawable.favicon_globe);
mDominantColor = 0;
}