Encryption in caching Picasso android files

I am planning to implement Picasso with OKHTTP for disk image caching . But I also plan on having encryption in the on-disk image caches. What should I do? I could not find any useful links that can lead me in the right direction. Any help would be greatly appreciated.

+3


source to share


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







All Articles