Closed constambeys closed 5 years ago
It seems it internally is making use of URLConnection which can be cached using HttpResponseCache. I'm not sure what the system sets up in terms of defaults nowadays - but if your use-case needs a cache it appears one can certainly be set up. The other option (which might make more sense from a few perspectives) would be to allow providing a WebContentDownloader or similar through the api of Html2Bitmap and hence control caching / downloading from the call site.
The reason why the library high jacks loading of remote images is to get a better idea of when the webview is finished loading. Without it the webview would report it was done when there were still remote resources in transit. (I beleive we do the same thing for local resources in case you'd be including things of substantial size where io could potentially be a problem.
As a side note the library is unaware of resources initiated through javascript. Adding a slow resource that way will make it fail to get added to the screenshots.
These measures are put in place to allow for the shortest possible sleep between when the webview reports "done" to the library considering the process to be in an idle state.
Does that answer your question?
Ok now I understood why getRemoteFile is needed. I did't know about HttpResponseCache I will try it. Thanks a lot.
@constambeys if you are happy feel free to close
or @MarijanGazica :)
I have 1 question regarding the library.
Why in the class WebViewAssetContent on method loadResourceImpl you do getRemoteFile?
I think webview work without this method and I also think that it bypasses the webview cache policy?