Adding caching to picasso service (#345)
Merge remote-tracking branch 'remotes/main/master' into picasso-img-cache Some improvements including size management and easy customization. Improvements to picasso cache Making PicassoCache public Moving PicassoCache to helpers/ Merge branch 'master' into picasso-img-cache Adding options for customisation. (Hopefully) final bug fixes. Additional fixes. Hotfix. Prevent NullPointerException. Formatting stuff. Removing unnecessary permission. Adding permission. Adding PicassoCache. Using max-stale now. Adding caching to picasso service Co-authored-by: anonTree1417 <example@example.com> Co-authored-by: M M Arif <mmarif@swatian.com> Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/345 Reviewed-by: 6543 <6543@noreply.gitea.io> Reviewed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
@@ -4,9 +4,10 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.squareup.picasso.OkHttp3Downloader;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import org.mian.gitnex.helpers.PicassoCache;
|
||||
import org.mian.gitnex.helpers.ssl.MemorizingTrustManager;
|
||||
import java.io.File;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Objects;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
@@ -44,7 +45,11 @@ public class PicassoService {
|
||||
|
||||
});
|
||||
|
||||
picasso = builder.build();
|
||||
File cachePath = new File(context.getCacheDir() + "/picasso_cache/");
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
cachePath.mkdirs();
|
||||
|
||||
picasso = builder.memoryCache(new PicassoCache(cachePath)).build();
|
||||
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user