instance of this class can be created using Builder. val httpEngine = HttpEngine .Builder(applicationContext) .setEnableHttp2(true) .build() return HttpEngineDataSource.Factory(httpEngine, executor) }
constructor * SimpleCache may clear other cache * You should have only 1 instance of SimpleCache * Don’t forget about eviction: LeastRecentlyUsedCacheEvictor(maxCacheSize)
constructor * SimpleCache may clear other cache * You should have only 1 instance of SimpleCache * Don’t forget about eviction: LeastRecentlyUsedCacheEvictor(maxCacheSize) * Don’t forget that URL == cacheKey
Called before view is about to be reused }, onRelease = { view -> // Called when view won’t be reused }, modifier = Modifier, factory = { context -> // create View } )
acquire(creator: () -> T): T { val clazzName = T::class.qualifiedName val typed = viewsCache[clazzName] val iterator = typed?.iterator() while (iterator?.hasNext() == true) { val view = iterator.next() iterator.remove() return view as T } return creator.invoke() }
acquire(creator: () -> T): T { val clazzName = T::class.qualifiedName val typed = viewsCache[clazzName] val iterator = typed?.iterator() while (iterator?.hasNext() == true) { val view = iterator.next() iterator.remove() return view as T } return creator.invoke() }
: View> acquire(creator: () -> T): T { val clazzName = T::class.qualifiedName val typed = viewsCache[clazzName] val iterator = typed?.iterator() while (iterator?.hasNext() == true) { val view = iterator.next() iterator.remove() return view as T } return creator.invoke() }
+ DRM support + Simple to use - Battery consumption - Performance - DRM Support + More accurate frame timing - Complexity - API 24+ (animations/scrolling)