Skip to content

Commit

Permalink
Added DEFAULT_BLAVATAR constant
Browse files Browse the repository at this point in the history
  • Loading branch information
nbradbury committed Feb 10, 2015
1 parent 2c8ff0b commit 7bb6cc0
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
public class GravatarUtils {

private static final DefaultImage DEFAULT_GRAVATAR = DefaultImage.MYSTERY_MAN;

public static enum DefaultImage {
MYSTERY_MAN,
STATUS_404,
Expand Down Expand Up @@ -42,7 +44,7 @@ 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);
return fixGravatarUrl(imageUrl, avatarSz, DEFAULT_GRAVATAR);
}
public static String fixGravatarUrl(final String imageUrl, int avatarSz, DefaultImage defaultImage) {
if (TextUtils.isEmpty(imageUrl)) {
Expand All @@ -59,7 +61,7 @@ public static String fixGravatarUrl(final String imageUrl, int avatarSz, Default
}

public static String gravatarFromEmail(final String email, int size) {
return gravatarFromEmail(email, size, DefaultImage.MYSTERY_MAN);
return gravatarFromEmail(email, size, DEFAULT_GRAVATAR);
}
public static String gravatarFromEmail(final String email, int size, DefaultImage defaultImage) {
return "http://gravatar.com/avatar/"
Expand All @@ -68,6 +70,9 @@ public static String gravatarFromEmail(final String email, int size, DefaultImag
+ "&size=" + Integer.toString(size);
}

public static String blavatarFromUrl(final String url, int size) {
return blavatarFromUrl(url, size, DEFAULT_GRAVATAR);
}
public static String blavatarFromUrl(final String url, int size, DefaultImage defaultImage) {
return "http://gravatar.com/blavatar/"
+ StringUtils.getMd5Hash(UrlUtils.getDomainFromUrl(url))
Expand Down

0 comments on commit 7bb6cc0

Please sign in to comment.