Open TWiStErRob opened 8 years ago
If you find it satisfactory, you can merge https://github.com/Teovald/glide-wiki/blob/master/Caching-and-Cache-Invalidation.md#dialog-with-another-persistence-layer with Glide's wiki.
I don't think I can make a pull request for the wiki, but you can just merge the diff.
Thanks for this
But regarding
https://gist.github.com/Teovald/bfddf6cbddc8e61ade80
I would like an example of how to register it in a Glide Module and how to use it in a usual Glide request.
you can use the samples provided by glide in order to get some examples.
For example, the flickr sample shows you how to use a FlickrModelLoader.
Hi Thanks but this is different from the two classes you have provided in the gist above. I want an example on how to use the ASynchronizableDataFetcher and ASynchronizableImageLoader because the description listed in wiki matches my requirements exactly.
He pointed to those samples because all model loaders needs to be registered the same. Here's a rundown:
GlideModule
•extend both classes found in gist
Hello can you explain this again?, did you mean implement?
At the moment I copied the two classes and created a new class called PieceLoaderbut which class do I extend or implement?
public class PieceLoader extends ASynchronizableDataFetcher<Piece>{
public PieceLoader(@Nullable DataFetcher<InputStream> networkFetcher, @NonNull Piece piece, int width, int height) {
super(networkFetcher, piece, width, height);
}
@Nullable
@Override
public InputStream loadFromSynchro(@NonNull Piece piece, int width, int height) {
return null;
}
@Override
public String getId() {
return null;
}
}
This is what I have so far, I am confused with what I do with ASynchronizableDataFetcher and ASynchronizableImageLoader
Exactly, that's what I meant by extending. Do the same for the other ASync... class and implement the missing methods as you want.
Thanks. So I make another class called PieceFetcher which will extend ASynchronizableImageLoader?
Yes, but try to be a little more consistent with naming... ...Fetcher extends A...Fetcher
and same for Loader.
Thanks, I got them mixed up :) .
Is there a sample I can refer too? I do not know what to do next :S. The Flickr sample seems different with these two classes. My model already contains URLs and absolute file paths to the image content already.
I wish I could point to well-rounded sample, that's why this issue exists, to make some clear and easily adaptable sample/docs.
Thanks. I will play around with it and post my findings, if all goes well I can make a sample :)
IMO, the wiki addition is enough since the rest of the stack is explained either on the wiki or in the samples but I wrote the code so I am obviously biased.
Could you please elaborate on what you are missing Ersen ?
I don't mind writing a 'full' sample if it helps (excluding the implementation of the separate 'pinning' module because that's really up to you).
Hi guys, I hope you had a great Christmas and Happy New Year. I apologise for the late reply. I think a full sample would be great so I decided to start one here to use as a practical example / starting point to demonstrate the usage.
https://github.com/erseno/Glide-Pinning-Image-Sample
However, since I am still trying to find out how it works, I have not written any model loader yet. I prepared a simple app which covers all the mundane things :P
Teovald, I would be extremely grateful if you could fill in the missing implementation and send a pull request.
In the meantime, I will be playing around with this sample to try figure out how to utilise the model loader to achieve what is discussed here. https://github.com/Teovald/glide-wiki/blob/master/Caching-and-Cache-Invalidation.md#dialog-with-another-persistence-layer
Feel free to ask my anything about the sample
Hi,
happy new year to you too.
I will try to have a look asap, but probably not until this weekend.
Many thanks!
done. have a look at : https://github.com/Teovald/Glide-Pinning-Image-Sample
Let me know if you need more information.
I just re-read the wiki article I wrote, I think I will try to clean it up a little bit.
The implementation in the examples is way too detailed for a wiki article.
done. it should be better now.
Hi Teovald, apologies for the late reply again. Thank you for your contribution :+1:
You are welcome.
Between the official glide wiki, my additions and the code sample you should have enough information to figure out how this works.
Still, let me know what you think of the doc & the sample.
FWIIW, we have been using similar ModelLoaders/Fetchers on production with several millions daily active users for almost a year, so I am pretty sure that it is solid. :)
Update the wiki or create a sample app that does this.
See: