use Resource caching at glide image loading

This commit is contained in:
tibbi 2022-09-24 23:33:36 +02:00
parent 13c4f1fafb
commit 11f3b05534
2 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import android.view.ViewGroup
import android.view.ViewTreeObserver import android.view.ViewTreeObserver
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.transition.DrawableCrossFadeFactory import com.bumptech.glide.request.transition.DrawableCrossFadeFactory
import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
@ -84,6 +85,7 @@ class LaunchersAdapter(
Glide.with(activity) Glide.with(activity)
.load(launcher.drawable) .load(launcher.drawable)
.placeholder(placeholderDrawable) .placeholder(placeholderDrawable)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.transition(DrawableTransitionOptions.withCrossFade(factory)) .transition(DrawableTransitionOptions.withCrossFade(factory))
.into(launcher_icon) .into(launcher_icon)

View File

@ -6,6 +6,7 @@ import android.view.ViewGroup
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.extensions.getProperTextColor
import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.launcher.R import com.simplemobiletools.launcher.R
@ -99,6 +100,7 @@ class WidgetsAdapter(
Glide.with(activity) Glide.with(activity)
.load(widget.widgetPreviewImage) .load(widget.widgetPreviewImage)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(widgetPreview.widget_image) .into(widgetPreview.widget_image)
widgetPreview.setOnClickListener { widgetPreview.setOnClickListener {