@NonNull 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 LruCache<>(25); } return application.mGalleryDetailCache; }
/** * Creates a new Renderer object * * @param map map to place objects on * @param context context needed to add info windows */ public Renderer(GoogleMap map, Context context) { mMap = map; mContext = context; mLayerOnMap = false; mImagesCache = new LruCache<>(LRU_CACHE_SIZE); mMarkerIconUrls = new ArrayList<>(); mStylesRenderer = new HashMap<>(); mDefaultPointStyle = null; mDefaultLineStringStyle = null; mDefaultPolygonStyle = null; mContainerFeatures = new BiMultiMap<>(); }
private MemoryCache() { int maxMemory = (int) Runtime.getRuntime().maxMemory(); int cacheSize = maxMemory / 8; cache = new LruCache<String, Object>(cacheSize); }
mSelectedFrameIndex = new ArrayList<>(); mBitmapCache = new LruCache<>(calculateCacheCount()); mOngoingTasks = new Hashtable<>();
public ExpiringCache(final int timeout, final int maxSize) { lruCache = new LruCache<>(maxSize); expirationTimeout = timeout; }
public BitmapCache(Context context) { mContext = context; mMemoryCache = new LruCache<>(DEFAULT_MEM_CACHE_CAP); }
LruConnectionBuddyCache() { // Use 1/10th of the available memory for this memory cache. this.cache = new LruCache<>(maxMemory / memoryPart); }
public ImageCache(Context context) { this.context = context; bitmapCache = new LruCache<String, Bitmap>(cacheSize); }
public ReflectPool(int maxSize) { this.mMap = new LruCache<>(maxSize); }
public LRUCacheImpl(int maxSize) { super(maxSize); int memCacheSize = (int) (Runtime.getRuntime().maxMemory() / (1024 * 8)); cache = new LruCache<String, Object>(memCacheSize); }
/* package */ KmlRenderer(GoogleMap map, Context context) { mContext = context; mMap = map; mImagesCache = new LruCache<String, Bitmap>(LRU_CACHE_SIZE); mMarkerIconUrls = new ArrayList<String>(); mGroundOverlayUrls = new ArrayList<String>(); mStylesRenderer = new HashMap<String, KmlStyle>(); mLayerVisible = false; mMarkerIconsDownloaded = false; mGroundOverlayImagesDownloaded = false; }
private VolleySingleton(Context context) { mCtx = context; mRequestQueue = getRequestQueue(); mImageLoader = new ImageLoader(mRequestQueue, new ImageLoader.ImageCache() { private final LruCache<String, Bitmap> cache = new LruCache<String, Bitmap>(100); @Override public Bitmap getBitmap(String url) { return cache.get(url); } @Override public void putBitmap(String url, Bitmap bitmap) { cache.put(url, bitmap); } }); }
private MySingleton(Context context) { mCtx = context; mRequestQueue = getRequestQueue(); mImageLoader = new ImageLoader(mRequestQueue, new ImageLoader.ImageCache() { private final LruCache<String, Bitmap> cache = new LruCache<String, Bitmap>(20); @Override public Bitmap getBitmap(String url) { return cache.get(url); } @Override public void putBitmap(String url, Bitmap bitmap) { cache.put(url, bitmap); } }); }
@Inject public GeocodingProvider(@AppContext Context context, Preferences preferences) { cache = new LruCache<>(40); if("".equals(preferences.getOpenCageGeocoderApiKey())) { geocoder = new GeocoderGoogle(context); } else { geocoder = new GeocoderOpencage(preferences.getOpenCageGeocoderApiKey()); } }
private VolleySingleton(){ mRequestQueue = Volley.newRequestQueue(MyApplication.getAppContext()); mImageLoader = new ImageLoader(this.mRequestQueue, new ImageLoader.ImageCache() { private final LruCache<String, Bitmap> mCache = new LruCache<String, Bitmap>(10); public void putBitmap(String url, Bitmap bitmap) { mCache.put(url, bitmap); } public Bitmap getBitmap(String url) { return mCache.get(url); } }); }
sDatabaseHelper = new DatabaseHelper(sContext, name, version); sSQLiteDatabase = sDatabaseHelper.getWritableDatabase(); sCache = new LruCache<String, Model>(cacheSize);
public static synchronized void initialize(Configuration configuration) { if (sIsInitialized) { Log.v("ActiveAndroid already initialized."); return; } sContext = configuration.getContext(); sModelInfo = new ModelInfo(configuration); sDatabaseHelper = new DatabaseHelper(configuration); // TODO: It would be nice to override sizeOf here and calculate the memory // actually used, however at this point it seems like the reflection // required would be too costly to be of any benefit. We'll just set a max // object size instead. sEntities = new LruCache<String, Model>(configuration.getCacheSize()); openDatabase(); sIsInitialized = true; Log.v("ActiveAndroid initialized successfully."); }
public static synchronized void initialize(Configuration configuration) { if (sIsInitialized) { Log.v("ActiveAndroid already initialized."); return; } sContext = configuration.getContext(); sModelInfo = new ModelInfo(configuration); sDatabaseHelper = new DatabaseHelper(configuration); // TODO: It would be nice to override sizeOf here and calculate the memory // actually used, however at this point it seems like the reflection // required would be too costly to be of any benefit. We'll just set a max // object size instead. sEntities = new LruCache<String, Model>(configuration.getCacheSize()); openDatabase(); sIsInitialized = true; Log.v("ActiveAndroid initialized successfully."); }
public static synchronized void initialize(Configuration configuration) { if (sIsInitialized) { Log.v("ActiveAndroid already initialized."); return; } sContext = configuration.getContext(); sModelInfo = new ModelInfo(configuration); sDatabaseHelper = new DatabaseHelper(configuration); // TODO: It would be nice to override sizeOf here and calculate the memory // actually used, however at this point it seems like the reflection // required would be too costly to be of any benefit. We'll just set a max // object size instead. sEntities = new LruCache<String, Model>(configuration.getCacheSize()); openDatabase(); sIsInitialized = true; Log.v("ActiveAndroid initialized successfully."); }