From aa55dfbb155eef59b6cd7998ede9960da0035e41 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 17 Mar 2017 20:17:48 +0100 Subject: [PATCH] increase the image load priority of initially opened images --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index c99d56add..c84784e9b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -10,6 +10,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.bumptech.glide.Glide +import com.bumptech.glide.Priority import com.bumptech.glide.load.engine.DiskCacheStrategy import com.simplemobiletools.commons.extensions.beGone import com.simplemobiletools.commons.extensions.beVisible @@ -124,6 +125,7 @@ class PhotoFragment : ViewPagerFragment() { .load(medium.path) .asGif() .crossFade() + .priority(if (isFragmentVisible) Priority.IMMEDIATE else Priority.LOW) .diskCacheStrategy(DiskCacheStrategy.SOURCE) .into(view.gif_holder) } else { @@ -135,6 +137,7 @@ class PhotoFragment : ViewPagerFragment() { Picasso.with(activity) .load("file:${medium.path}") .resize(ViewPagerActivity.screenWidth * 2, ViewPagerActivity.screenHeight * 2) + .priority(if (isFragmentVisible) Picasso.Priority.HIGH else Picasso.Priority.LOW) .rotate(degrees) .centerInside() .into(view.photo_view)