From 014c2b951d64b5ba9c3a5fb7b0631f1194e2ab00 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 9 Nov 2017 13:57:24 +0100 Subject: [PATCH] clear Glide cache after rotating an image, to avoid some glitches --- .../gallery/activities/ViewPagerActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 2a8099959..98497f5f2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -23,6 +23,7 @@ import android.support.v4.view.ViewPager import android.util.DisplayMetrics import android.view.* import android.view.animation.DecelerateInterpolator +import com.bumptech.glide.Glide import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* @@ -530,6 +531,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View it.close() mRotationDegrees = 0f invalidateOptionsMenu() + + // we cannot refresh a specific image in Glide Cache, so just clear it all + val glide = Glide.get(applicationContext) + glide.clearDiskCache() + runOnUiThread { + glide.clearMemory() + } } } catch (e: OutOfMemoryError) { toast(R.string.out_of_memory_error)