Bug 999853 - Never pass an empty image path to Picasso. r=lucasr
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Thu, 24 Apr 2014 10:43:37 -0700
changeset 198604 ebe3125cd74f09496251f0d85e85400f0d1b8f11
parent 198603 09e329985ca22d60286cf58cae3f5abdb423cf62
child 198605 43feed75916e326c5d74d1bf40f9d8112dee8c60
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs999853
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 999853 - Never pass an empty image path to Picasso. r=lucasr
mobile/android/base/home/PanelBackItemView.java
mobile/android/base/home/PanelLayout.java
--- a/mobile/android/base/home/PanelBackItemView.java
+++ b/mobile/android/base/home/PanelBackItemView.java
@@ -24,20 +24,25 @@ class PanelBackItemView extends LinearLa
         super(context);
 
         LayoutInflater.from(context).inflate(R.layout.panel_back_item, this);
         setOrientation(HORIZONTAL);
 
         title = (TextView) findViewById(R.id.title);
 
         final ImageView image = (ImageView) findViewById(R.id.image);
-        Picasso.with(getContext())
-               .load(backImageUrl)
-               .placeholder(R.drawable.folder_up)
-               .into(image);
+
+        if (TextUtils.isEmpty(backImageUrl)) {
+            image.setImageResource(R.drawable.folder_up);
+        } else {
+            Picasso.with(getContext())
+                   .load(backImageUrl)
+                   .placeholder(R.drawable.folder_up)
+                   .into(image);
+        }
     }
 
     public void updateFromFilter(FilterDetail filter) {
         final String backText = getResources()
             .getString(R.string.home_move_up_to_filter, filter.title);
         title.setText(backText);
     }
 }
--- a/mobile/android/base/home/PanelLayout.java
+++ b/mobile/android/base/home/PanelLayout.java
@@ -432,20 +432,18 @@ abstract class PanelLayout extends Frame
                 textView.setText(R.string.home_default_empty);
             } else {
                 textView.setText(text);
             }
 
             final String imageUrl = (emptyViewConfig == null) ? null : emptyViewConfig.getImageUrl();
             final ImageView imageView = (ImageView) view.findViewById(R.id.home_empty_image);
 
-            if (imageUrl == null) {
-                Picasso.with(getContext())
-                       .load(R.drawable.icon_home_empty_firefox)
-                       .into(imageView);
+            if (TextUtils.isEmpty(imageUrl)) {
+                imageView.setImageResource(R.drawable.icon_home_empty_firefox);
             } else {
                 Picasso.with(getContext())
                        .load(imageUrl)
                        .error(R.drawable.icon_home_empty_firefox)
                        .into(imageView);
             }
 
             viewState.setEmptyView(view);