clear Glide cache after rotating an image, to avoid some glitches

This commit is contained in:
tibbi 2017-11-09 13:57:24 +01:00
parent 9141073ed6
commit 014c2b951d
1 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import android.support.v4.view.ViewPager
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.view.* import android.view.*
import android.view.animation.DecelerateInterpolator import android.view.animation.DecelerateInterpolator
import com.bumptech.glide.Glide
import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.PropertiesDialog
import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.dialogs.RenameItemDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
@ -530,6 +531,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
it.close() it.close()
mRotationDegrees = 0f mRotationDegrees = 0f
invalidateOptionsMenu() 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) { } catch (e: OutOfMemoryError) {
toast(R.string.out_of_memory_error) toast(R.string.out_of_memory_error)