From 84366299404c6a2f1c1fc225f1bc142e935fa65f Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Tue, 10 Feb 2015 13:38:51 -0500 Subject: [PATCH] WPNetworkImageView now accepts a default error image resource, also forcing size when showing blavatars in ReaderBlogAdapter --- .../org/wordpress/android/util/GravatarUtils.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java index 765084b1748a..d4e226d3758a 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java @@ -2,10 +2,10 @@ import android.text.TextUtils; +/** + * see https://en.gravatar.com/site/implement/images/ + */ public class GravatarUtils { - /* - * see https://en.gravatar.com/site/implement/images/ - */ public static enum DefaultImage { MYSTERY_MAN, @@ -42,6 +42,9 @@ public String toString() { * replace it with a new ?s= parameter which requests the avatar at the exact size needed */ public static String fixGravatarUrl(final String imageUrl, int avatarSz) { + return fixGravatarUrl(imageUrl, avatarSz, DefaultImage.MYSTERY_MAN); + } + public static String fixGravatarUrl(final String imageUrl, int avatarSz, DefaultImage defaultImage) { if (TextUtils.isEmpty(imageUrl)) { return ""; } @@ -51,8 +54,8 @@ public static String fixGravatarUrl(final String imageUrl, int avatarSz) { return PhotonUtils.getPhotonImageUrl(imageUrl, avatarSz, avatarSz); } - // remove all other params, then add query string for size and "mystery man" default - return UrlUtils.removeQuery(imageUrl) + "?s=" + avatarSz + "&d=mm"; + // remove all other params, then add query string for size and default image + return UrlUtils.removeQuery(imageUrl) + "?s=" + avatarSz + "&d=" + defaultImage.toString(); } public static String gravatarFromEmail(final String email, int size) {