Bug 872556 - Add check for missing learnmoreURL in recommended-addons.json. r=mfinkle
authorBrian Nicholson <bnicholson@mozilla.com>
Mon, 20 May 2013 12:04:54 -0700
changeset 143940 b0d07be09b86c25f018504cc4852ccb63f9e8775
parent 143939 ea47a388215ddff7bbb6e2f9ce47cbd9fb224e2a
child 143941 97663ef54fef9defcd8ce8925477452c8d1bd4e9
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs872556
milestone24.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 872556 - Add check for missing learnmoreURL in recommended-addons.json. r=mfinkle
mobile/android/base/widget/AddonsSection.java
--- a/mobile/android/base/widget/AddonsSection.java
+++ b/mobile/android/base/widget/AddonsSection.java
@@ -17,16 +17,17 @@ import org.json.JSONException;
 import org.json.JSONObject;
 
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.Rect;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.text.SpannableString;
+import android.text.TextUtils;
 import android.text.style.TextAppearanceSpan;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.TextView;
 
@@ -201,22 +202,26 @@ public class AddonsSection extends About
         drawable.setBounds(sIconBounds);
         row.setCompoundDrawables(drawable, null, null, null);
 
         String iconUrl = addonJSON.getString("iconURL");
         String pageUrl = getPageUrlFromIconUrl(iconUrl);
 
         // homepageURL may point to non-AMO installs. For now we use learnmoreURL instead
         // which is more likely to point to a mobile AMO page
-        final String homepageUrl = addonJSON.getString("learnmoreURL");
+        String homepageUrl = addonJSON.optString("learnmoreURL");
+        if (TextUtils.isEmpty(homepageUrl)) {
+            homepageUrl = addonJSON.getString("homepageURL");
+        }
+        final String addonUrl = homepageUrl;
         row.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 if (mUriLoadListener != null)
-                    mUriLoadListener.onAboutHomeUriLoad(homepageUrl);
+                    mUriLoadListener.onAboutHomeUriLoad(addonUrl);
             }
         });
         row.setOnKeyListener(GamepadUtils.getClickDispatcher());
 
         Favicons favicons = Favicons.getInstance();
         favicons.loadFavicon(pageUrl, iconUrl, true,
                 new Favicons.OnFaviconLoadedListener() {
             @Override