/** * Creates a new data binder, which allows to asynchronously render preview images of tabs and * display them afterwards. * * @param parent * The parent view of the tab switcher, the tabs belong to, as an instance of the class * {@link ViewGroup}. The parent may not be null * @param contentViewRecycler * The view recycler, which should be used to inflate the views, which are associated * with tabs, as an instance of the class ViewRecycler. The view recycler may not be * null * @param model * The model of the tab switcher, the tabs belong to, as an instance of the type {@link * Model}. The model may not be null */ public PreviewDataBinder(@NonNull final ViewGroup parent, @NonNull final ViewRecycler<Tab, Void> contentViewRecycler, @NonNull final Model model) { super(parent.getContext().getApplicationContext(), new LruCache<Tab, Bitmap>(7)); Condition.INSTANCE.ensureNotNull(parent, "The parent may not be null"); Condition.INSTANCE .ensureNotNull(contentViewRecycler, "The content view recycler may not be null"); this.parent = parent; this.contentViewRecycler = contentViewRecycler; this.model = model; }
private CustomVolleyRequest(Context context) { this.context = context; this.requestQueue = getRequestQueue(); imageLoader = new ImageLoader(requestQueue, 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); } }); }
public CurrentPlaylistAdapter(Context context, PlaybackServiceConnection playbackServiceConnection) { super(); mContext = context; mPlaybackServiceConnection = playbackServiceConnection; try { mPlaylistSize = mPlaybackServiceConnection.getPBS().getPlaylistSize(); mCurrentPlayingIndex = mPlaybackServiceConnection.getPBS().getCurrentIndex(); } catch (RemoteException e) { mPlaybackServiceConnection = null; e.printStackTrace(); } mArtworkManager = ArtworkManager.getInstance(context.getApplicationContext()); mTrackCache = new LruCache<>(CACHE_SIZE); }