@Nullable public LottieComposition get(@Nullable String cacheKey) { if (cacheKey == null) { return null; } return cache.get(cacheKey); }
@Override protected Bitmap checkBitmapCache(final int hashCode, final long id) { return sThumbnailCache.get(getKey(hashCode, id)); } }
@Override public Bitmap getBitmap(String url) { return cache.get(url); }
public DocumentBibleBooks getDocumentBibleBooksFor(AbstractPassageBook document) { return cache.get(document); }
/** * Tries to get an artist image from the cache * * @param artist Artist object to check in cache * @return Bitmap if cache hit, null otherwise */ public synchronized Bitmap requestArtistImage(ArtistModel artist) { return mCache.get(getArtistHash(artist)); }
/** * Tries to get an album image from the cache * * @param album Album object to try * @return Bitmap if cache hit, null otherwise */ public synchronized Bitmap requestAlbumBitmap(AlbumModel album) { return mCache.get(getAlbumHash(album)); }
private static final Bitmap getVideoThumbnail(final ContentResolver cr, final long hashCode, final long id, final int requestWidth, final int requestHeight) throws FileNotFoundException, IOException { // try to get from internal thumbnail cache(in memory), this may be redundant final String key = getKey(hashCode, id); Bitmap result = sThumbnailCache.get(key); if (result == null) { BitmapFactory.Options options = null; int kind = MediaStore.Video.Thumbnails.MICRO_KIND; if ((requestWidth > 96) || (requestHeight > 96) || (requestWidth * requestHeight > 128 * 128)) kind = MediaStore.Video.Thumbnails.MINI_KIND; try { result = MediaStore.Video.Thumbnails.getThumbnail(cr, id, kind, options); } catch (final Exception e) { if (DEBUG) Log.w(TAG, e); } if (result != null) { if (DEBUG) Log.v(TAG, String.format("getVideoThumbnail:id=%d(%d,%d)", id, result.getWidth(), result.getHeight())); // add to internal thumbnail cache(in memory) sThumbnailCache.put(key, result); } else { Log.w(TAG, "failed to get video thumbnail ofr id=" + id); } } return result; }
@NonNull public Model getItem(int position) throws NoValueException { if (position >= getItemCount()) { throw new NoValueException( "ouf of range: getItem(" + position + ") for the relation with " + getItemCount() + " items"); } Model item = cache.get(position); if (item == null) { item = relation.get(position); cache.put(position, item); } return item; }
/** * Simple getter for the model data. * This method will call the PBS to get the trackmodel from the current playlist. * * @param position Index of the track to get. No check for boundaries here. * @return The trackmodel at index position. */ @Override public Object getItem(int position) { try { if (mPlaybackServiceConnection != null) { // Check cache first for a hit TrackModel track = mTrackCache.get(position); if (track == null) { track = mPlaybackServiceConnection.getPBS().getPlaylistSong(position); mTrackCache.put(position, track); } return track; } else { return null; } } catch (RemoteException e) { return null; } }
public static Drawable getDrawable(Context context, AppInfo appInfo) { init(context); Drawable drawable = sLruCache.get(appInfo.packageName); if (drawable == null && appInfo.applicationInfo != null) { if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP_MR1) { drawable = appInfo.applicationInfo.loadUnbadgedIcon(context.getPackageManager()); }else { drawable = appInfo.applicationInfo.loadIcon(context.getPackageManager()); } UserInfo currentUser = Users.getInstance().getCurrentUser(); if(currentUser != null && currentUser.isManagedProfile()){ drawable = context.getPackageManager().getUserBadgedIcon(drawable,currentUser.getUserHandle()); } sLruCache.put(appInfo.packageName, drawable); } return drawable; }
if (memoryCache.get(albumUrl) != null || diskCache.get(urlToDiskCacheKey(albumUrl)) != null) { payload.close(); return;
Bitmap result = sThumbnailCache.get(key); if (result == null) { if ((requestWidth <= 0) || (requestHeight <= 0)) {