Use LruCache instead of LruCacheEx

This commit is contained in:
seven332 committed 2016-03-14 23:20:00 +08:00
1 parent 9276244b28
commit 59085f1371
2 files changed
+11 -11

No files matched your search

@@ -23,10 +23,10 @@ import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.os.Debug;
import android.support.annotation.NonNull;
import android.support.v4.util.LruCache;
import android.util.Log;
import android.util.SparseArray;
import com.hippo.beerbelly.LruCacheEx;
import com.hippo.beerbelly.SimpleDiskCache;
import com.hippo.conaco.Conaco;
import com.hippo.ehviewer.client.EhClient;
@@ -67,9 +67,9 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
private OkHttpClient mOkHttpClient;
private BitmapHelper mBitmapHelper;
private Conaco<Bitmap> mConaco;
private LruCacheEx<Long, GalleryDetail> mGalleryDetailCache;
private LruCacheEx<String, LargePreviewSet> mLargePreviewSetCache;
private LruCacheEx<Long, Integer> mPreviewPagesCache;
private LruCache<Long, GalleryDetail> mGalleryDetailCache;
private LruCache<String, LargePreviewSet> mLargePreviewSetCache;
private LruCache<Long, Integer> mPreviewPagesCache;
private SimpleDiskCache mSpiderInfoCache;
private DownloadManager mDownloadManager;
@@ -224,31 +224,31 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
}
@NonNull
public static LruCacheEx<Long, GalleryDetail> getGalleryDetailCache(@NonNull Context context) {
public static LruCache<Long, GalleryDetail> getGalleryDetailCache(@NonNull Context context) {
EhApplication application = ((EhApplication) context.getApplicationContext());
if (application.mGalleryDetailCache == null) {
// Max size 25, 3 min timeout
application.mGalleryDetailCache = new LruCacheEx<>(25, 3 * 60 * 1000);
application.mGalleryDetailCache = new LruCache<>(25);
}
return application.mGalleryDetailCache;
}
@NonNull
public static LruCacheEx<String, LargePreviewSet> getLargePreviewSetCache(@NonNull Context context) {
public static LruCache<String, LargePreviewSet> getLargePreviewSetCache(@NonNull Context context) {
EhApplication application = ((EhApplication) context.getApplicationContext());
if (application.mLargePreviewSetCache == null) {
// Max size 50, 3 min timeout
application.mLargePreviewSetCache = new LruCacheEx<>(50, 3 * 60 * 1000);
application.mLargePreviewSetCache = new LruCache<>(50);
}
return application.mLargePreviewSetCache;
}
@NonNull
public static LruCacheEx<Long, Integer> getPreviewPagesCache(@NonNull Context context) {
public static LruCache<Long, Integer> getPreviewPagesCache(@NonNull Context context) {
EhApplication application = ((EhApplication) context.getApplicationContext());
if (application.mPreviewPagesCache == null) {
// Max size 50, 3 min timeout
application.mPreviewPagesCache = new LruCacheEx<>(50, 3 * 60 * 1000);
application.mPreviewPagesCache = new LruCache<>(50);
}
return application.mPreviewPagesCache;
}