When I load an image with something like this:
String url = "https://example.com/user/123123/profile_pic"
Glide.with(context).load(url).into(imageView);
server response is in base64 and glide doesn't handle it by default
My current solution:
load image with retrofit -> pass image encoded to glide
in this case I would lose glide caching. I wonder if there is a way to make that request with glide and handle base64 response?
Use custom ModelLoader for Glide
https://bumptech.github.io/glide/tut/custom-modelloader.html
good manual for this problem
In class Base64DataFetcher
->
public void loadData(@NonNull Priority priority, @NonNull DataCallback<? super ByteBuffer> callback) {
String base64Section = getBase64SectionOfModel();
// get this from Retrofit or another
.........
}