Performance improvement
This commit is contained in:
@@ -128,7 +128,7 @@ class GalleryBlockAdapter(private val glide: RequestManager, private val galleri
|
|||||||
fun bind(galleryID: Int) {
|
fun bind(galleryID: Int) {
|
||||||
val cache = Cache.getInstance(view.context, galleryID)
|
val cache = Cache.getInstance(view.context, galleryID)
|
||||||
|
|
||||||
val galleryBlock = cache.metadata.galleryBlock!!
|
val galleryBlock = cache.metadata.galleryBlock ?: return
|
||||||
|
|
||||||
with(view) {
|
with(view) {
|
||||||
val resources = context.resources
|
val resources = context.resources
|
||||||
@@ -153,18 +153,15 @@ class GalleryBlockAdapter(private val glide: RequestManager, private val galleri
|
|||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
val thumbnail = cache.getThumbnail()
|
val thumbnail = cache.getThumbnail()
|
||||||
|
|
||||||
launch(Dispatchers.Main) {
|
glide
|
||||||
glide
|
.load(thumbnail)
|
||||||
.load(thumbnail)
|
.skipMemoryCache(true)
|
||||||
.skipMemoryCache(true)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.error(R.drawable.image_broken_variant)
|
||||||
.error(R.drawable.image_broken_variant)
|
.apply {
|
||||||
.apply {
|
if (BuildConfig.CENSOR)
|
||||||
if (BuildConfig.CENSOR)
|
override(5, 8)
|
||||||
override(5, 8)
|
}.let { launch(Dispatchers.Main) { it.into(galleryblock_thumbnail) } }
|
||||||
}
|
|
||||||
.into(galleryblock_thumbnail)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timerTask == null)
|
if (timerTask == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user