PublicPhoto is a library which enables you to fetch user's public photo as published on Gravatar. If no image is published against the given email, then you can fetch a palceholder instead (similar to Github & Stackoverflow).
In your Settings.gradle.kts, add:
maven { url = uri("https://jitpack.io") }
and in your app level build.gradle.kts, add:
implementation("com.github.TusharGogna:PublicPhoto:LATEST_VERSION")
Current version is 1.0
Then, in order to fetch the public Gravatar photo, simply call the method: getPublicPhoto(...) which returns a URL in the form of a String. The method looks something like this:
getPublicPhoto(EMAIL (String), IMAGE_SIZE (Int), IS_DEFAULT (Boolean) , DEFAULT_IMAGE_TYPE (ENUM of Type PlaceHolderType))
Example:
getPublicPhoto("[email protected]", 400, true, PlaceHolderType.ROBOHASH)
Similarly, you can use different PlaceHolderType as per your needs. Following are the different types available:
MP
IDENTICON
MONSTERID
WAVATAR
RETRO
ROBOHASH
BLANK