From 9d58f074c3f3112ca027baa89ba9f5d1e5d1bc3d Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Fri, 6 Feb 2015 14:02:46 -0500 Subject: [PATCH] Added blavatars to ManageBlogsActivity --- .../wordpress/android/util/GravatarUtils.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 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 c10ce69c81e8..b8dc48d9d823 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java @@ -1,22 +1,18 @@ package org.wordpress.android.util; -import android.text.TextUtils; - public class GravatarUtils { /* * see https://en.gravatar.com/site/implement/images/ */ - public static String gravatarUrlFromEmail(final String email, int size) { - if (TextUtils.isEmpty(email)) - return ""; - - String url = "http://gravatar.com/avatar/" - + StringUtils.getMd5Hash(email) - + "?d=mm"; - - if (size > 0) - url += "&s=" + Integer.toString(size); + public static String gravatarFromEmail(final String email, int size) { + return "http://gravatar.com/avatar/" + + StringUtils.getMd5Hash(StringUtils.notNullStr(email)) + + "?d=mm&size=" + Integer.toString(size); + } - return url; + public static String blavatarFromUrl(final String url, int size) { + return "http://gravatar.com/blavatar/" + + StringUtils.getMd5Hash(UrlUtils.getDomainFromUrl(url)) + + "?d=mm&size=" + Integer.toString(size); } }