Skip to content

Commit

Permalink
Added blavatars to ManageBlogsActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
nbradbury committed Feb 6, 2015
1 parent 3b085ce commit 9d58f07
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 9d58f07

Please sign in to comment.