-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/modularize-editor
Conflicts: WordPress/src/main/java/org/wordpress/android/ui/accounts/ManageBlogsActivity.java
- Loading branch information
Showing
3 changed files
with
57 additions
and
24 deletions.
There are no files selected for viewing
26 changes: 13 additions & 13 deletions
26
WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
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; | ||
/* | ||
* important: the 404 default means the request will 404 if there is no blavatar | ||
* for the passed site - so the caller needs to trap the 404 to provide a default | ||
*/ | ||
public static String blavatarFromUrl(final String url, int size) { | ||
return "http://gravatar.com/blavatar/" | ||
+ StringUtils.getMd5Hash(UrlUtils.getDomainFromUrl(url)) | ||
+ "?d=404&size=" + Integer.toString(size); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters