Encryption in caching Picasso android files
1 answer
If anyone is looking for an answer, this is how I reached it. First, I switched to UIL as it provides more customization than Picasso .
Then I configured the built-in diskCache engine .
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(getApplicationContext());
builder.threadPriority(Thread.NORM_PRIORITY - 2);
builder.threadPoolSize(5);
builder.imageDownloader(new CustomImageDownaloder(this, new OkHttpClient()));
builder.diskCache(new CustomDiskCache(cacheDir));
Now in CustomDiskCache, just override the methods for reading bytes from the network and save them to disk, read the bytes, encrypt them and save them. Likewise, when you are going to read from a cache file, decode the bytes and convert them to a bitmap.
Hope this helps.
0
source to share